Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion offload/test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ else: # Unices
if config.cuda_libdir:
config.test_flags += " -Wl,-rpath," + config.cuda_libdir
if config.libomptarget_current_target.startswith('nvptx'):
config.test_flags_clang += " --libomptarget-nvptx-bc-path=" + config.llvm_library_intdir
config.test_flags_clang += " --libomptarget-nvptx-bc-path=" + config.llvm_library_intdir + "/nvptx64-nvidia-cuda"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, config.llvm_library_intdir is /home/jdenny/llvm/build/lib. But the file that's needed is /home/jdenny/llvm/build/runtimes/runtimes-nvptx64-nvidia-cuda-bins/openmp/device/libomptarget-nvptx.bc. So the above doesn't fix the problem.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought at one point we set the intermediate directory for those bitcode files explicitly to config.llvm_library_intdir.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not getting installed there? It's supposed to be installed to build/lib/nvptx64-nvidia-cuda but it's possible something's messed up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a quick fix, likely what we want is to inform the runtimes which targets are active or something.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ ls build/lib/nvptx64-nvidia-cuda/
crt1.o  libc.a  libm.a  libompdevice.a

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not installing before testing. But I thought you were pointing to a build directory anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to specify the output to the right place, should hopefully work now.

Copy link
Collaborator

@jdenny-ornl jdenny-ornl Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A clean build (on my amd gpu system or nvidia gpu system) now fails with something like:

ninja: error: 'openmp/device/libomptarget-amdgpu.bc', needed by '/home/jdenny/llvm/build/lib/amdgcn-amd-amdhsa/libompdevice.a', missing and no known rule to make it

I have not pulled since this morning. I only applied your diff.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me. Thanks.

if config.libomptarget_current_target.endswith('-LTO'):
config.test_flags += " -foffload-lto"
if config.libomptarget_current_target.endswith('-JIT-LTO') and evaluate_bool_env(
Expand Down
4 changes: 2 additions & 2 deletions openmp/device/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ endif()
# Trick to combine these into a bitcode file via the linker's LTO pass.
add_executable(libompdevice ${src_files})
set_target_properties(libompdevice PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
RUNTIME_OUTPUT_DIRECTORY "${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}"
LINKER_LANGUAGE CXX
BUILD_RPATH ""
INSTALL_RPATH ""
Expand Down Expand Up @@ -85,7 +85,7 @@ install(TARGETS libompdevice

add_library(ompdevice.all_objs OBJECT IMPORTED)
set_property(TARGET ompdevice.all_objs APPEND PROPERTY IMPORTED_OBJECTS
${CMAKE_CURRENT_BINARY_DIR}/libomptarget-${target_name}.bc)
${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/libomptarget-${target_name}.bc)

# Archive all the object files generated above into a static library
add_library(ompdevice STATIC)
Expand Down
Loading