Skip to content

Conversation

jhuber6
Copy link
Contributor

@jhuber6 jhuber6 commented May 2, 2025

Summary:
Another hacky fix done until
#136729 lands. This time for
-mcpu.

Summary:
Another hacky fix done until
llvm#136729 lands. This time for
`-mcpu`.
@llvmbot
Copy link
Member

llvmbot commented May 2, 2025

@llvm/pr-subscribers-offload

Author: Joseph Huber (jhuber6)

Changes

Summary:
Another hacky fix done until
#136729 lands. This time for
-mcpu.


Full diff: https://github.com/llvm/llvm-project/pull/138327.diff

1 Files Affected:

  • (modified) offload/DeviceRTL/CMakeLists.txt (+7-3)
diff --git a/offload/DeviceRTL/CMakeLists.txt b/offload/DeviceRTL/CMakeLists.txt
index f8a6d8563916a..09710e5e3da43 100644
--- a/offload/DeviceRTL/CMakeLists.txt
+++ b/offload/DeviceRTL/CMakeLists.txt
@@ -132,9 +132,12 @@ function(compileDeviceRTLLibrary target_name target_triple)
     BUILD_RPATH ""
     INSTALL_RPATH ""
     RUNTIME_OUTPUT_NAME libomptarget-${target_name}.bc)
-  target_compile_options(libomptarget-${target_name} PRIVATE "--target=${target_triple}" "-fuse-ld=lld" "-march=")
+  target_compile_options(libomptarget-${target_name} PRIVATE
+    "--target=${target_triple}" "-fuse-ld=lld" "-march=" "-mcpu="
+    "-Wno-unused-command-line-argument")
   target_link_options(libomptarget-${target_name} PRIVATE "--target=${target_triple}"
-                      "-r" "-nostdlib" "-flto" "-Wl,--lto-emit-llvm" "-fuse-ld=lld" "-march=")
+                      "-mcpu=power8" "-r" "-nostdlib" "-flto" "-Wl,--lto-emit-llvm"
+                      "-fuse-ld=lld" "-march=" "-mcpu=")
   install(TARGETS libomptarget-${target_name}
           PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ
           DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${target_triple}")
@@ -152,7 +155,8 @@ function(compileDeviceRTLLibrary target_name target_triple)
   )
   target_link_libraries(omptarget.${target_name} PRIVATE omptarget.${target_name}.all_objs)
   target_link_options(omptarget.${target_name} PRIVATE "--target=${target_triple}"
-                      "-r" "-nostdlib" "-flto" "-Wl,--lto-emit-llvm" "-fuse-ld=lld" "-march=")
+                      "-Wno-unused-command-line-argument""-r" "-nostdlib" "-flto"
+                       "-Wl,--lto-emit-llvm" "-fuse-ld=lld" "-march=" "-mcpu=")
 
   install(TARGETS omptarget.${target_name}
           ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${target_triple}")

@jhuber6
Copy link
Contributor Author

jhuber6 commented May 5, 2025

@tstellar ping

"-Wno-unused-command-line-argument")
target_link_options(libomptarget-${target_name} PRIVATE "--target=${target_triple}"
"-r" "-nostdlib" "-flto" "-Wl,--lto-emit-llvm" "-fuse-ld=lld" "-march=")
"-mcpu=power8" "-r" "-nostdlib" "-flto" "-Wl,--lto-emit-llvm"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why can we hard code power8 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lol, oops, forgot to delete that to check that it fixed the error Tom reported.

@jhuber6 jhuber6 merged commit dbe070e into llvm:main May 6, 2025
7 of 9 checks passed
@jhuber6 jhuber6 deleted the PPC branch May 6, 2025 19:14
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
Summary:
Another hacky fix done until
llvm#136729 lands. This time for
`-mcpu`.
@nikic
Copy link
Contributor

nikic commented Jul 31, 2025

Another variant of this issue:

clang++: error: unsupported option '-mtls-dialect=' for target 'amdgcn-amd-amdhsa'

@nikic
Copy link
Contributor

nikic commented Jul 31, 2025

Would it make sense to strip all default compilation flags and explicitly specify the desired ones only?

@jhuber6
Copy link
Contributor Author

jhuber6 commented Jul 31, 2025

Would it make sense to strip all default compilation flags and explicitly specify the desired ones only?

The proper solution is #136729 but this was delayed endlessly by https://discourse.llvm.org/t/rfc-llvm-policy-for-top-level-directories-and-language-runtimes/86143. Given the PR at #144372 I'm going to assume that the community is more in favor of my approach.

@bader
Copy link
Contributor

bader commented Jul 31, 2025

Would it make sense to strip all default compilation flags and explicitly specify the desired ones only?

The proper solution is #136729 but this was delayed endlessly by https://discourse.llvm.org/t/rfc-llvm-policy-for-top-level-directories-and-language-runtimes/86143. Given the PR at #144372 I'm going to assume that the community is more in favor of my approach.

@jhuber6, I'm going to merge #144372 as soon as CI passes. libcxx tests hang for unknown reason, but unlikely due to changes in the PR.

@jhuber6
Copy link
Contributor Author

jhuber6 commented Jul 31, 2025

@jhuber6, I'm going to merge #144372 as soon as CI passes. libcxx tests hang for unknown reason, but unlikely due to changes in the PR.

Alright, I can try to rebase that.

@bader
Copy link
Contributor

bader commented Jul 31, 2025

@jhuber6, #144372 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants