This is an archive of the discontinued LLVM Phabricator instance.

OpenMP/cmake: Use TARGET instead of looking for amdgpu-arch
ClosedPublic

Authored by arsenm on Jun 23 2023, 6:57 AM.

Details

Summary

Not sure if the standalone build case is supposed to be a supported
path. Should probably rely on find_package and imported targets
anyway.

Diff Detail

Event Timeline

arsenm created this revision.Jun 23 2023, 6:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2023, 6:57 AM
arsenm requested review of this revision.Jun 23 2023, 6:57 AM
This revision is now accepted and ready to land.Jun 23 2023, 7:17 AM
arsenm updated this revision to Diff 534046.Jun 23 2023, 12:21 PM

I do not understand the contexts where generator expressions work. Also make execution a fatal error. If it's found it should work

arsenm requested review of this revision.Jun 23 2023, 12:26 PM

$<TARGET_FILE:amdgpu-arch> should work. We have similar code in openmp/libomptarget/DeviceRTL/CMakeLists.txt.

$<TARGET_FILE:amdgpu-arch> should work. We have similar code in openmp/libomptarget/DeviceRTL/CMakeLists.txt.

But those are to add_custom_command with an output that targets depend on, which is at build time. It seems to not work with execute_process which is configure time?

$<TARGET_FILE:amdgpu-arch> should work. We have similar code in openmp/libomptarget/DeviceRTL/CMakeLists.txt.

But those are to add_custom_command with an output that targets depend on, which is at build time. It seems to not work with execute_process which is configure time?

Hmm, that's odd as TARGET_FILE is supposed to give the full path of the target binary file (https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#genex:TARGET_FILE), and using that in execute_process should be fine. Not sure what error you encountered.

$<TARGET_FILE:amdgpu-arch> should work. We have similar code in openmp/libomptarget/DeviceRTL/CMakeLists.txt.

But those are to add_custom_command with an output that targets depend on, which is at build time. It seems to not work with execute_process which is configure time?

Hmm, that's odd as TARGET_FILE is supposed to give the full path of the target binary file (https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#genex:TARGET_FILE), and using that in execute_process should be fine. Not sure what error you encountered.

It tries to execute the literal string '$<TARGET_FILE:amdgpu-arch>' and produces no such file or directory error

tianshilei1992 accepted this revision.Jun 23 2023, 1:20 PM

$<TARGET_FILE:amdgpu-arch> should work. We have similar code in openmp/libomptarget/DeviceRTL/CMakeLists.txt.

But those are to add_custom_command with an output that targets depend on, which is at build time. It seems to not work with execute_process which is configure time?

Hmm, that's odd as TARGET_FILE is supposed to give the full path of the target binary file (https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#genex:TARGET_FILE), and using that in execute_process should be fine. Not sure what error you encountered.

It tries to execute the literal string '$<TARGET_FILE:amdgpu-arch>' and produces no such file or directory error

Oh you are right. The generator expression will not be evaluated at configure time.

This revision is now accepted and ready to land.Jun 23 2023, 1:20 PM
arsenm closed this revision.Jun 28 2023, 3:55 AM
arsenm retitled this revision from OpenMP/cmake: Use TARGET_FILE instead of looking for amdgpu-arch to OpenMP/cmake: Use TARGET instead of looking for amdgpu-arch.