From 3ff80ec33cfb7d8c9d4cbabc6e5f2e4b0083fd59 Mon Sep 17 00:00:00 2001 From: Mark Zhuang Date: Wed, 29 Jul 2026 09:35:31 +0800 Subject: [PATCH 1/2] tests: use resolved LLVM_SPIRV in promoteInt tests ${LLVM_TOOLS_BINARY_DIR}/llvm-spirv not work for Debian/Ubuntu llvm-spirv-N, which is /usr/bin/llvm-spirv-N --- tests/compiler/promoteInt/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/compiler/promoteInt/CMakeLists.txt b/tests/compiler/promoteInt/CMakeLists.txt index ec4192980..d0a1401af 100644 --- a/tests/compiler/promoteInt/CMakeLists.txt +++ b/tests/compiler/promoteInt/CMakeLists.txt @@ -60,7 +60,7 @@ foreach(IR_FILE ${TEST_IR_FILES}) NAME hipPromoteInt-${BASENAME} COMMAND env LLVM_OPT=${LLVM_TOOLS_BINARY_DIR}/opt - LLVM_SPIRV=${LLVM_TOOLS_BINARY_DIR}/llvm-spirv + LLVM_SPIRV=${LLVM_SPIRV} LLVM_DIS=${LLVM_TOOLS_BINARY_DIR}/llvm-dis HIP_SPV_PASSES_LIB=${CMAKE_BINARY_DIR}/lib/libLLVMHipSpvPasses.so ${CMAKE_CURRENT_BINARY_DIR}/run_promote_int_pass.bash ${CMAKE_CURRENT_BINARY_DIR}/${FILENAME} From 44e18a4b487406f54b3e03d0b4d158bf48485a6a Mon Sep 17 00:00:00 2001 From: Paulius Velesko Date: Wed, 19 Aug 2026 13:43:56 +0300 Subject: [PATCH 2/2] tests: fall back to a real llvm-spirv when the translator is NOT_NEEDED FindLLVM.cmake forces LLVM_SPIRV to the sentinel NOT_NEEDED when chipStar targets LLVM's integrated SPIR-V backend, so the promoteInt tests invoked NOT_NEEDED as a program and all nine failed on the LLVM 22 native lane. --- tests/compiler/promoteInt/CMakeLists.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/compiler/promoteInt/CMakeLists.txt b/tests/compiler/promoteInt/CMakeLists.txt index d0a1401af..14d88bc24 100644 --- a/tests/compiler/promoteInt/CMakeLists.txt +++ b/tests/compiler/promoteInt/CMakeLists.txt @@ -45,6 +45,16 @@ endif() # If we have this, a pass won't help # list(APPEND TEST_IR_FILES ${CMAKE_CURRENT_SOURCE_DIR}/func-return-nonstd.ll) +# LLVM_SPIRV holds the translator resolved by FindLLVM.cmake, which may live +# outside LLVM_TOOLS_BINARY_DIR when one is passed via -DLLVM_SPIRV=. It carries +# the sentinel "NOT_NEEDED" when chipStar targets LLVM's integrated SPIR-V +# backend; these tests still translate to SPIR-V to validate the pass output, so +# they fall back to a translator sitting next to the other LLVM tools. +set(PROMOTE_INT_LLVM_SPIRV "${LLVM_SPIRV}") +if(NOT PROMOTE_INT_LLVM_SPIRV OR PROMOTE_INT_LLVM_SPIRV STREQUAL "NOT_NEEDED") + set(PROMOTE_INT_LLVM_SPIRV "${LLVM_TOOLS_BINARY_DIR}/llvm-spirv") +endif() + foreach(IR_FILE ${TEST_IR_FILES}) get_filename_component(FILENAME ${IR_FILE} NAME) get_filename_component(BASENAME ${IR_FILE} NAME_WE) @@ -60,7 +70,7 @@ foreach(IR_FILE ${TEST_IR_FILES}) NAME hipPromoteInt-${BASENAME} COMMAND env LLVM_OPT=${LLVM_TOOLS_BINARY_DIR}/opt - LLVM_SPIRV=${LLVM_SPIRV} + LLVM_SPIRV=${PROMOTE_INT_LLVM_SPIRV} LLVM_DIS=${LLVM_TOOLS_BINARY_DIR}/llvm-dis HIP_SPV_PASSES_LIB=${CMAKE_BINARY_DIR}/lib/libLLVMHipSpvPasses.so ${CMAKE_CURRENT_BINARY_DIR}/run_promote_int_pass.bash ${CMAKE_CURRENT_BINARY_DIR}/${FILENAME}