Skip to content

Commit 5d5d419

Browse files
authored
[Bugfix][CI/Build][ROCm] Make sure to use the headers from the build folder on ROCm (#22264)
Signed-off-by: Gregory Shtrasberg <[email protected]>
1 parent 302962e commit 5d5d419

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cmake/utils.cmake

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,12 @@ function (define_gpu_extension_target GPU_MOD_NAME)
467467
if (GPU_LANGUAGE STREQUAL "HIP")
468468
# Make this target dependent on the hipify preprocessor step.
469469
add_dependencies(${GPU_MOD_NAME} hipify${GPU_MOD_NAME})
470+
# Make sure we include the hipified versions of the headers, and avoid conflicts with the ones in the original source folder
471+
target_include_directories(${GPU_MOD_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/csrc
472+
${GPU_INCLUDE_DIRECTORIES})
473+
else()
474+
target_include_directories(${GPU_MOD_NAME} PRIVATE csrc
475+
${GPU_INCLUDE_DIRECTORIES})
470476
endif()
471477

472478
if (GPU_ARCHITECTURES)
@@ -482,8 +488,6 @@ function (define_gpu_extension_target GPU_MOD_NAME)
482488
target_compile_definitions(${GPU_MOD_NAME} PRIVATE
483489
"-DTORCH_EXTENSION_NAME=${GPU_MOD_NAME}")
484490

485-
target_include_directories(${GPU_MOD_NAME} PRIVATE csrc
486-
${GPU_INCLUDE_DIRECTORIES})
487491

488492
target_link_libraries(${GPU_MOD_NAME} PRIVATE torch ${GPU_LIBRARIES})
489493

0 commit comments

Comments
 (0)