From 3eb2fbccf54d1b40bcbab9f99ef346c6d27577a5 Mon Sep 17 00:00:00 2001 From: Aaron Enye Shi Date: Wed, 14 Jun 2017 16:19:19 -0400 Subject: [PATCH 1/5] SWDEV-123229 HCC RT header needs to trigger re-build SWDEV-123229 - HCC RT header changes don't trigger a re-build. When calling "make" to rebuild hcc after modifying the HCC RT headers, the build is not able to detect the change and to rebuild the .cpp files that include the headers being modified. As a result, developers may be getting an hcc built from stale objects. --- include/CMakeLists.txt | 63 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 8 deletions(-) diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 07c723fd17b..e8d17ea0cd9 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1,13 +1,60 @@ #install commands for headers -FILE(GLOB files ${CMAKE_CURRENT_SOURCE_DIR}/*.h*) -INSTALL(FILES ${files} DESTINATION include) -# Copy the file to directory matching the install directory -file(COPY ${files} DESTINATION "${PROJECT_BINARY_DIR}/include") -FILE(GLOB files ${CMAKE_CURRENT_SOURCE_DIR}/*.inl) -INSTALL(FILES ${files} DESTINATION include) -# Copy the file to directory matching the install directory -file(COPY ${files} DESTINATION "${PROJECT_BINARY_DIR}/include") +set(H_HEADERS + amp_math.h + amp_short_vectors.h + amp.h + grid_launch.h + grid_launch.hpp + hc_am.hpp + hc_defines.h + hc_math.hpp + hc_printf.hpp + hc_rt_debug.h + hc_short_vector.hpp + hc.hpp + hsa_atomic.h + kalmar_aligned_alloc.h + kalmar_buffer.h + kalmar_cpu_launch.h + kalmar_exception.h + kalmar_index.h + kalmar_launch.h + kalmar_math.h + kalmar_runtime.h + kalmar_serialize.h + pinned_vector.hpp) + +set(INL_HEADERS + hc_norm_unorm.inl + hc_short_vector.inl + kalmar_short_vectors.inl) + +set(HCC_HEADERS + ${H_HEADERS} + ${INL_HEADERS}) + +set (output_dir "${PROJECT_BINARY_DIR}/include") + +set(out_files) +foreach( f ${HCC_HEADERS} ) + set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} ) + set( dst ${output_dir}/${f} ) + add_custom_command(OUTPUT ${dst} + DEPENDS ${src} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} + COMMENT "Copying HCC's ${f}...") + list(APPEND out_files ${dst}) +endforeach( f ) + +add_custom_target(hcc-headers ALL DEPENDS ${out_files}) +add_dependencies(world hcc-headers) +set_target_properties(hcc-headers PROPERTIES FOLDER "HCC Misc") + +install(FILES ${HCC_HEADERS} + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ + DESTINATION include) + # N4494 headers FILE(GLOB N4494 ${CMAKE_CURRENT_SOURCE_DIR}/coordinate From 81805cce53bd9948f70626099e2d339521150e24 Mon Sep 17 00:00:00 2001 From: Aaron Enye Shi Date: Wed, 14 Jun 2017 18:08:30 -0400 Subject: [PATCH 2/5] Allows us to generate dependency without explicitly expressing names Generate the dependency without having to specify each header files explicitly. --- include/CMakeLists.txt | 42 +++++++++++------------------------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index e8d17ea0cd9..1d9588736aa 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1,38 +1,18 @@ #install commands for headers -set(H_HEADERS - amp_math.h - amp_short_vectors.h - amp.h - grid_launch.h - grid_launch.hpp - hc_am.hpp - hc_defines.h - hc_math.hpp - hc_printf.hpp - hc_rt_debug.h - hc_short_vector.hpp - hc.hpp - hsa_atomic.h - kalmar_aligned_alloc.h - kalmar_buffer.h - kalmar_cpu_launch.h - kalmar_exception.h - kalmar_index.h - kalmar_launch.h - kalmar_math.h - kalmar_runtime.h - kalmar_serialize.h - pinned_vector.hpp) +FILE(GLOB H_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h*) -set(INL_HEADERS - hc_norm_unorm.inl - hc_short_vector.inl - kalmar_short_vectors.inl) +FILE(GLOB INL_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.inl) + + +set(HCC_HEADERS) + +#Obtain the names of each Header File +foreach(InFName ${H_HEADERS} ${INL_HEADERS}) + STRING(REGEX REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/ "" OutFName ${InFName}) + set(HCC_HEADERS ${HCC_HEADERS} "${OutFName}") +endforeach(InFName) -set(HCC_HEADERS - ${H_HEADERS} - ${INL_HEADERS}) set (output_dir "${PROJECT_BINARY_DIR}/include") From 76168827fdb00ec780e9d180290e3181288bad58 Mon Sep 17 00:00:00 2001 From: Aaron Enye Shi Date: Thu, 15 Jun 2017 11:09:11 -0400 Subject: [PATCH 3/5] Modify CMake Header files to trigger re-build I've added the other header files in the include sub-directories. I've also created a target specific for pstl-headers. --- include/CMakeLists.txt | 26 ++++----- include/experimental/CMakeLists.txt | 73 ++++++++++++++++++++---- include/experimental/impl/CMakeLists.txt | 6 -- 3 files changed, 73 insertions(+), 32 deletions(-) delete mode 100644 include/experimental/impl/CMakeLists.txt diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 1d9588736aa..b09aedd258b 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1,21 +1,23 @@ -#install commands for headers - +# Put all hcc headers into the hcc-headers target +# .h and .hpp headers FILE(GLOB H_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h*) - +# .inl headers FILE(GLOB INL_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.inl) +# N4494 headers +FILE(GLOB N4494 ${CMAKE_CURRENT_SOURCE_DIR}/coordinate + ${CMAKE_CURRENT_SOURCE_DIR}/array_view) set(HCC_HEADERS) - #Obtain the names of each Header File -foreach(InFName ${H_HEADERS} ${INL_HEADERS}) +foreach(InFName ${H_HEADERS} ${INL_HEADERS} ${N4494}) STRING(REGEX REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/ "" OutFName ${InFName}) set(HCC_HEADERS ${HCC_HEADERS} "${OutFName}") endforeach(InFName) -set (output_dir "${PROJECT_BINARY_DIR}/include") - +# Set location for output directory +set(output_dir "${PROJECT_BINARY_DIR}/include") set(out_files) foreach( f ${HCC_HEADERS} ) set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} ) @@ -27,21 +29,15 @@ foreach( f ${HCC_HEADERS} ) list(APPEND out_files ${dst}) endforeach( f ) +# Create target for hcc-headers and set dependencies add_custom_target(hcc-headers ALL DEPENDS ${out_files}) add_dependencies(world hcc-headers) set_target_properties(hcc-headers PROPERTIES FOLDER "HCC Misc") +# Install command for headers install(FILES ${HCC_HEADERS} PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ DESTINATION include) - -# N4494 headers -FILE(GLOB N4494 ${CMAKE_CURRENT_SOURCE_DIR}/coordinate - ${CMAKE_CURRENT_SOURCE_DIR}/array_view) -INSTALL(FILES ${N4494} DESTINATION include) -# Copy the file to directory matching the install directory -file(COPY ${N4494} DESTINATION "${PROJECT_BINARY_DIR}/include") - # PSTL headers ADD_SUBDIRECTORY(experimental) diff --git a/include/experimental/CMakeLists.txt b/include/experimental/CMakeLists.txt index d525b05530e..bb7f99c118f 100644 --- a/include/experimental/CMakeLists.txt +++ b/include/experimental/CMakeLists.txt @@ -1,11 +1,62 @@ -# PSTL headers -FILE(GLOB PSTL ${CMAKE_CURRENT_SOURCE_DIR}/algorithm - ${CMAKE_CURRENT_SOURCE_DIR}/exception_list - ${CMAKE_CURRENT_SOURCE_DIR}/execution_policy - ${CMAKE_CURRENT_SOURCE_DIR}/numeric) -INSTALL(FILES ${PSTL} DESTINATION include/experimental) -# Copy the file to directory matching the install directory -file(COPY ${PSTL} DESTINATION "${PROJECT_BINARY_DIR}/include/experimental") - -# PSTL internal headers -ADD_SUBDIRECTORY(impl) +# Here we have PSTL header files inside experimental directory and impl sub-directory. +# All PSTL headers should be in the same pstl-headers target, but different output dir + +# PSTL headers from experimental/ +set(PSTL_EXP_HEADERS + algorithm + exception_list + execution_policy + numeric) + +# PSTL headers from experimental/impl/ +FILE(GLOB PSTL_IMPL ${CMAKE_CURRENT_SOURCE_DIR}/impl/*.inl) + +# Obtain the names of each impl header and add to PSTL +foreach(InFName ${PSTL_IMPL}) + STRING(REGEX REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/impl/ "" OutFName ${InFName}) + set(PSTL_IMPL_HEADERS ${PSTL_IMPL_HEADERS} "${OutFName}") +endforeach(InFName) + +# Set location for exp/ output directory +set(exp_output_dir "${PROJECT_BINARY_DIR}/include/experimental") +# Set location for exp/impl/ output directory +set(impl_output_dir "${PROJECT_BINARY_DIR}/include/experimental/impl") + +set(exp_out_files) +set(impl_out_files) + +foreach( f ${PSTL_EXP_HEADERS} ) + set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} ) + set( dst ${exp_output_dir}/${f} ) + add_custom_command(OUTPUT ${dst} + DEPENDS ${src} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} + COMMENT "Copying HCC's ${f}...") + list(APPEND exp_out_files ${dst}) +endforeach( f ) + +foreach( f ${PSTL_IMPL_HEADERS} ) + set( src ${CMAKE_CURRENT_SOURCE_DIR}/impl/${f} ) + set( dst ${impl_output_dir}/${f} ) + add_custom_command(OUTPUT ${dst} + DEPENDS ${src} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} + COMMENT "Copying HCC's ${f}...") + list(APPEND impl_out_files ${dst}) +endforeach( f ) + +# Create target for pstl-headers and set dependencies +add_custom_target(pstl-headers ALL DEPENDS ${exp_out_files} ${impl_out_files}) +add_dependencies(world pstl-headers) +set_target_properties(pstl-headers PROPERTIES FOLDER "HCC Misc") + +# Install command for PSTL exp headers +install(FILES ${PSTL_EXP_HEADERS} + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ + DESTINATION include/experimental) + +# Install command for PSTL impl headers +install(FILES ${PSTL_IMPL_HEADERS} + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ + DESTINATION include/experimental/impl) + diff --git a/include/experimental/impl/CMakeLists.txt b/include/experimental/impl/CMakeLists.txt deleted file mode 100644 index ab98f33569a..00000000000 --- a/include/experimental/impl/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# PSTL headers -FILE(GLOB PSTL ${CMAKE_CURRENT_SOURCE_DIR}/*.inl) -INSTALL(FILES ${PSTL} DESTINATION include/experimental/impl) -# Copy the file to directory matching the install directory -file(COPY ${PSTL} DESTINATION "${PROJECT_BINARY_DIR}/include/experimental/impl") - From aa0d1eaeb96f1238f4d169140f334aa0c05c60e8 Mon Sep 17 00:00:00 2001 From: Aaron Enye Shi Date: Thu, 15 Jun 2017 13:28:31 -0400 Subject: [PATCH 4/5] Fix Jenkins build errors for PR358 Fix Jenkin build errors. Seems it dropped the impl/ sub-directory name in cmake_install.cmake. --- include/experimental/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/experimental/CMakeLists.txt b/include/experimental/CMakeLists.txt index bb7f99c118f..8cbf8d4adcd 100644 --- a/include/experimental/CMakeLists.txt +++ b/include/experimental/CMakeLists.txt @@ -13,7 +13,7 @@ FILE(GLOB PSTL_IMPL ${CMAKE_CURRENT_SOURCE_DIR}/impl/*.inl) # Obtain the names of each impl header and add to PSTL foreach(InFName ${PSTL_IMPL}) - STRING(REGEX REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/impl/ "" OutFName ${InFName}) + STRING(REGEX REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/ "" OutFName ${InFName}) set(PSTL_IMPL_HEADERS ${PSTL_IMPL_HEADERS} "${OutFName}") endforeach(InFName) @@ -36,7 +36,7 @@ foreach( f ${PSTL_EXP_HEADERS} ) endforeach( f ) foreach( f ${PSTL_IMPL_HEADERS} ) - set( src ${CMAKE_CURRENT_SOURCE_DIR}/impl/${f} ) + set( src ${CMAKE_CURRENT_SOURCE_DIR}/${f} ) set( dst ${impl_output_dir}/${f} ) add_custom_command(OUTPUT ${dst} DEPENDS ${src} From 3c861776d20d7d176aac659ad771a801b3d6a15a Mon Sep 17 00:00:00 2001 From: Aaron Enye Shi Date: Thu, 15 Jun 2017 14:09:05 -0400 Subject: [PATCH 5/5] Remove not used MSVC UI navigation lines Not using Visual Studio UI Navigation here. --- include/CMakeLists.txt | 1 - include/experimental/CMakeLists.txt | 1 - 2 files changed, 2 deletions(-) diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index b09aedd258b..933af298f33 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -32,7 +32,6 @@ endforeach( f ) # Create target for hcc-headers and set dependencies add_custom_target(hcc-headers ALL DEPENDS ${out_files}) add_dependencies(world hcc-headers) -set_target_properties(hcc-headers PROPERTIES FOLDER "HCC Misc") # Install command for headers install(FILES ${HCC_HEADERS} diff --git a/include/experimental/CMakeLists.txt b/include/experimental/CMakeLists.txt index 8cbf8d4adcd..a46f2929874 100644 --- a/include/experimental/CMakeLists.txt +++ b/include/experimental/CMakeLists.txt @@ -48,7 +48,6 @@ endforeach( f ) # Create target for pstl-headers and set dependencies add_custom_target(pstl-headers ALL DEPENDS ${exp_out_files} ${impl_out_files}) add_dependencies(world pstl-headers) -set_target_properties(pstl-headers PROPERTIES FOLDER "HCC Misc") # Install command for PSTL exp headers install(FILES ${PSTL_EXP_HEADERS}