@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / a377631d21
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 3, 00:30 UTC

[CI] Fix AMD docker build tests (#43329)

Signed-off-by: haosdent <haosdent@gmail.com>

haosdent committed May 22, 2026 at 22:06 UTC a377631d21cc97db678727455d33c4257435f417
2 files changed +46 -13
CMakeLists.txt
+6
@@ -1289,6 +1289,12 @@ if(VLLM_GPU_LANG STREQUAL "HIP")
1289 WITH_SOABI)
1290 endif()
1291
1292 +# Must run after the last HIP `define_extension_target` so every extension
1293 +# has registered its sources.
1294 +if (VLLM_GPU_LANG STREQUAL "HIP")
1295 + vllm_finalize_hipify_target()
1296 +endif()
1297 +
1298 # For CUDA and HIP builds also build the triton_kernels external package.
1299 if(VLLM_GPU_LANG STREQUAL "CUDA" OR VLLM_GPU_LANG STREQUAL "HIP")
1300 include(cmake/external_projects/triton_kernels.cmake)
cmake/utils.cmake
+40 -13
@@ -47,12 +47,17 @@ macro (append_cmake_prefix_path PKG EXPR)
47 list(APPEND CMAKE_PREFIX_PATH ${_PREFIX_PATH})
48 endmacro()
49
50 -#
51 -# Add a target named `hipify${NAME}` that runs the hipify preprocessor on a set
52 -# of CUDA source files. The names of the corresponding "hipified" sources are
53 -# stored in `OUT_SRCS`.
54 -#
50 +# Resolve hipified output paths for `NAME` into `OUT_SRCS` and register the
51 +# `.cu` sources with the shared `hipify_all` target. Per-extension hipify
52 +# targets are unsafe to run in parallel against a shared csrc/ output dir, so
53 +# accumulation here is paired with a single finalize step.
54 function (hipify_sources_target OUT_SRCS NAME ORIG_SRCS)
55 + if (TARGET hipify_all)
56 + message(FATAL_ERROR
57 + "hipify_sources_target(${NAME}) called after vllm_finalize_hipify_target. "
58 + "Add the new HIP extension before the finalizer call in CMakeLists.txt.")
59 + endif()
60 +
61 #
62 # Split into C++ and non-C++ (i.e. CUDA) sources.
63 #
@@ -73,19 +78,41 @@ function (hipify_sources_target OUT_SRCS NAME ORIG_SRCS)
78 list(APPEND HIP_SRCS "${CMAKE_CURRENT_BINARY_DIR}/${SRC}")
79 endforeach()
80
76 - set(CSRC_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/csrc)
77 - add_custom_target(
78 - hipify${NAME}
79 - COMMAND ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/cmake/hipify.py -p ${CMAKE_SOURCE_DIR}/csrc -o ${CSRC_BUILD_DIR} ${SRCS}
80 - DEPENDS ${CMAKE_SOURCE_DIR}/cmake/hipify.py ${SRCS}
81 - BYPRODUCTS ${HIP_SRCS}
82 - COMMENT "Running hipify on ${NAME} extension source files.")
81 + set_property(GLOBAL APPEND PROPERTY VLLM_HIPIFY_ALL_SRCS ${SRCS})
82 + set_property(GLOBAL APPEND PROPERTY VLLM_HIPIFY_ALL_BYPRODUCTS ${HIP_SRCS})
83
84 # Swap out original extension sources with hipified sources.
85 list(APPEND HIP_SRCS ${CXX_SRCS})
86 set(${OUT_SRCS} ${HIP_SRCS} PARENT_SCOPE)
87 endfunction()
88
89 +# Define the single shared `hipify_all` custom target that runs hipify once
90 +# on the union of every HIP extension's sources. Call after the last HIP
91 +# `define_extension_target`.
92 +function (vllm_finalize_hipify_target)
93 + if (TARGET hipify_all)
94 + return()
95 + endif()
96 +
97 + get_property(ALL_SRCS GLOBAL PROPERTY VLLM_HIPIFY_ALL_SRCS)
98 + get_property(ALL_BYPRODUCTS GLOBAL PROPERTY VLLM_HIPIFY_ALL_BYPRODUCTS)
99 +
100 + if (NOT ALL_SRCS)
101 + return()
102 + endif()
103 +
104 + list(REMOVE_DUPLICATES ALL_SRCS)
105 + list(REMOVE_DUPLICATES ALL_BYPRODUCTS)
106 +
107 + set(CSRC_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/csrc)
108 + add_custom_target(
109 + hipify_all
110 + COMMAND ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/cmake/hipify.py -p ${CMAKE_SOURCE_DIR}/csrc -o ${CSRC_BUILD_DIR} ${ALL_SRCS}
111 + DEPENDS ${CMAKE_SOURCE_DIR}/cmake/hipify.py ${ALL_SRCS}
112 + BYPRODUCTS ${ALL_BYPRODUCTS}
113 + COMMENT "Running hipify on all extension source files.")
114 +endfunction()
115 +
116 #
117 # Get additional GPU compiler flags from torch.
118 #
@@ -551,7 +578,7 @@ function (define_extension_target MOD_NAME)
578
579 if (ARG_LANGUAGE STREQUAL "HIP")
580 # Make this target dependent on the hipify preprocessor step.
554 - add_dependencies(${MOD_NAME} hipify${MOD_NAME})
581 + add_dependencies(${MOD_NAME} hipify_all)
582 # Make sure we include the hipified versions of the headers, and avoid conflicts with the ones in the original source folder
583 target_include_directories(${MOD_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/csrc
584 ${ARG_INCLUDE_DIRECTORIES})