Skip to content

Commit

Permalink
Add NO_DEFAULT_PATH for llvm-mc, llvm-dis, clang-offload-bundler (#139)
Browse files Browse the repository at this point in the history
* Add NO_DEFAULT_PATH for llvm-mc, llvm-dis, clang-offload-bundler

Found in QA image, where LLVM is installed, but rocm-llvm-dev is not.
`/usr/bin/llvm-dis` and `/opt/rocm/llvm/bin/llvm-mc` were being used to
build the `llvm_ir_to_executable` example. This version mismatch results
in a build failure.

Adding `NO_DEFAULT_PATH` to only search for these programs in the
specified paths. ${ROCM_PATH}, for example.

Signed-off-by: David Galiffi <[email protected]>
  • Loading branch information
dgaliffiAMD authored Jul 8, 2024
1 parent 77f3beb commit 1f02d80
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions HIP-Basic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,21 @@ if(NOT "${GPU_RUNTIME}" STREQUAL "CUDA")
llvm-dis
PATH_SUFFIXES bin
PATHS ${ROCM_ROOT}/llvm ${CMAKE_INSTALL_PREFIX}/llvm
NO_DEFAULT_PATH
)
find_program(
OFFLOAD_BUNDLER_COMMAND
clang-offload-bundler
PATH_SUFFIXES bin
PATHS ${ROCM_ROOT}/llvm ${CMAKE_INSTALL_PREFIX}/llvm
NO_DEFAULT_PATH
)
find_program(
LLVM_MC_COMMAND
llvm-mc
PATH_SUFFIXES bin
PATHS ${ROCM_ROOT}/llvm ${CMAKE_INSTALL_PREFIX}/llvm
NO_DEFAULT_PATH
)

if(LLVM_DIS_COMMAND AND OFFLOAD_BUNDLER_COMMAND AND LLVM_MC_COMMAND)
Expand Down
2 changes: 2 additions & 0 deletions HIP-Basic/assembly_to_executable/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ find_program(
PATH_SUFFIXES bin
PATHS ${ROCM_ROOT}/llvm ${CMAKE_INSTALL_PREFIX}/llvm
REQUIRED
NO_DEFAULT_PATH
)

# Generate object bundle.
Expand Down Expand Up @@ -170,6 +171,7 @@ find_program(
PATH_SUFFIXES bin
PATHS ${ROCM_ROOT}/llvm ${CMAKE_INSTALL_PREFIX}/llvm
REQUIRED
NO_DEFAULT_PATH
)

# Invoke llvm-mc to generate an object file containing the offload bundle.
Expand Down
3 changes: 3 additions & 0 deletions HIP-Basic/llvm_ir_to_executable/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ find_program(
PATH_SUFFIXES bin
PATHS ${ROCM_ROOT}/llvm ${CMAKE_INSTALL_PREFIX}/llvm
REQUIRED
NO_DEFAULT_PATH
)

# Generate the device LLVM IR using the HIP compiler.
Expand Down Expand Up @@ -145,6 +146,7 @@ find_program(
PATH_SUFFIXES bin
PATHS ${ROCM_ROOT}/llvm ${CMAKE_INSTALL_PREFIX}/llvm
REQUIRED
NO_DEFAULT_PATH
)

# Generate object bundle.
Expand Down Expand Up @@ -194,6 +196,7 @@ find_program(
PATH_SUFFIXES bin
PATHS ${ROCM_ROOT}/llvm ${CMAKE_INSTALL_PREFIX}/llvm
REQUIRED
NO_DEFAULT_PATH
)

# Invoke llvm-mc to generate an object file containing the offload bundle.
Expand Down

0 comments on commit 1f02d80

Please sign in to comment.