Skip to content

Reland "[HIP] Use original file path for CUID" (#108771) #111885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2025

Conversation

yxsamliu
Copy link
Collaborator

This patch fixes the buildbots failure of lit tests on MacOS. Since clang driver options depend on toolchain, we cannot hardcode CUID hash. On MacOS there is an extra -mlinker-version= option.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Oct 10, 2024
@yxsamliu yxsamliu requested a review from dyung October 10, 2024 18:29
@llvmbot
Copy link
Member

llvmbot commented Oct 10, 2024

@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: Yaxun (Sam) Liu (yxsamliu)

Changes

This patch fixes the buildbots failure of lit tests on MacOS. Since clang driver options depend on toolchain, we cannot hardcode CUID hash. On MacOS there is an extra -mlinker-version= option.


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

2 Files Affected:

  • (modified) clang/lib/Driver/Driver.cpp (+1-4)
  • (modified) clang/test/Driver/hip-cuid-hash.hip (+6-4)
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index ba850cf3803e9b..0d0b8d68159297 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -3060,10 +3060,7 @@ class OffloadingActionBuilder final {
           else if (UseCUID == CUID_Hash) {
             llvm::MD5 Hasher;
             llvm::MD5::MD5Result Hash;
-            SmallString<256> RealPath;
-            llvm::sys::fs::real_path(IA->getInputArg().getValue(), RealPath,
-                                     /*expand_tilde=*/true);
-            Hasher.update(RealPath);
+            Hasher.update(IA->getInputArg().getValue());
             for (auto *A : Args) {
               if (A->getOption().matches(options::OPT_INPUT))
                 continue;
diff --git a/clang/test/Driver/hip-cuid-hash.hip b/clang/test/Driver/hip-cuid-hash.hip
index 103a1cbf26d50a..28efd6197b2303 100644
--- a/clang/test/Driver/hip-cuid-hash.hip
+++ b/clang/test/Driver/hip-cuid-hash.hip
@@ -1,13 +1,15 @@
 // Check CUID generated by hash.
 // The same CUID is generated for the same file with the same options.
 
+// RUN: cd %S
+
 // RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu --no-offload-new-driver \
 // RUN:   --offload-arch=gfx906 -c -nogpuinc -nogpulib -fuse-cuid=hash \
-// RUN:   %S/Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1
+// RUN:   Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1
 
 // RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu --no-offload-new-driver \
 // RUN:   --offload-arch=gfx906 -c -nogpuinc -nogpulib -fuse-cuid=hash \
-// RUN:   %S/Inputs/hip_multiple_inputs/a.cu >>%t.out 2>&1
+// RUN:   Inputs/hip_multiple_inputs/a.cu >>%t.out 2>&1
 
 // RUN: FileCheck %s -check-prefixes=SAME -input-file %t.out
 
@@ -16,11 +18,11 @@
 
 // RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu -DX=1 --no-offload-new-driver \
 // RUN:   --offload-arch=gfx906 -c -nogpuinc -nogpulib -fuse-cuid=hash \
-// RUN:   %S/Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1
+// RUN:   Inputs/hip_multiple_inputs/a.cu >%t.out 2>&1
 
 // RUN: %clang -### -x hip --target=x86_64-unknown-linux-gnu -DX=2 --no-offload-new-driver \
 // RUN:   --offload-arch=gfx906 -c -nogpuinc -nogpulib -fuse-cuid=hash \
-// RUN:   %S/Inputs/../Inputs/hip_multiple_inputs/a.cu >>%t.out 2>&1
+// RUN:   Inputs/../Inputs/hip_multiple_inputs/a.cu >>%t.out 2>&1
 
 // RUN: FileCheck %s -check-prefixes=DIFF -input-file %t.out
 

@yxsamliu yxsamliu requested a review from Artem-B October 10, 2024 18:29
@yxsamliu yxsamliu force-pushed the cuid-hash branch 2 times, most recently from 5fe838d to 6a3a200 Compare January 22, 2025 18:54
@yxsamliu
Copy link
Collaborator Author

ping

This patch fixes the buildbots failure of lit tests on MacOS.
Since clang driver options depend on toolchain, we cannot
hardcode CUID hash. On MacOS there is an extra -mlinker-version=
option.
@yxsamliu
Copy link
Collaborator Author

yxsamliu commented Mar 6, 2025

ping

@yxsamliu yxsamliu merged commit 2674034 into llvm:main Mar 7, 2025
8 checks passed
jph-13 pushed a commit to jph-13/llvm-project that referenced this pull request Mar 21, 2025
This patch fixes the buildbots failure of lit tests on MacOS. Since
clang driver options depend on toolchain, we cannot hardcode CUID hash.
On MacOS there is an extra -mlinker-version= option.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants