Repository navigation
[clang-nvlink-wrapper] Keep LTO task outputs distinct #238883
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
jhuber6
merged 2 commits into
llvm:main
from
0z5a:codex/nvlink-lto-saved-partitions-20261104
Nov 10, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
clang/test/OffloadTools/clang-nvlink-wrapper/lto-save-temps.ll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| ; REQUIRES: nvptx-registered-target | ||
| ; | ||
| ; RUN: llvm-as %s -o %t.bc | ||
| ; RUN: mkdir -p %t.dir | ||
| ; RUN: cd %t.dir && clang-nvlink-wrapper --dry-run --save-temps --plugin-opt=lto-partitions=2 -arch sm_90 %t.bc -o multi 2>&1 | FileCheck %s --check-prefix=MULTI | ||
| ; RUN: cd %t.dir && clang-nvlink-wrapper --dry-run --save-temps -arch sm_90 %t.bc -o single 2>&1 | FileCheck %s --check-prefix=SINGLE | ||
| ; | ||
| ; MULTI: ptxas{{.*}} -c multi.s {{.*}} -o multi.cubin | ||
| ; MULTI: ptxas{{.*}} -c multi.1.s {{.*}} -o multi.1.cubin | ||
| ; MULTI: nvlink{{.*}} -o multi multi.cubin multi.1.cubin | ||
| ; SINGLE: ptxas{{.*}} -c single.s {{.*}} -o single.cubin | ||
| ; SINGLE: nvlink{{.*}} -o single single.cubin | ||
|
|
||
| target datalayout = "e-p6:32:32-i64:64-i128:128-i256:256-v16:16-v32:32-n16:32:64" | ||
| target triple = "nvptx64-nvidia-cuda" | ||
|
|
||
| define i32 @foo(i32 %x) { | ||
| %r = add i32 %x, 1 | ||
| ret i32 %r | ||
| } | ||
|
|
||
| define i32 @bar(i32 %x) { | ||
| %r = mul i32 %x, 3 | ||
| ret i32 %r | ||
| } |
10 changes: 10 additions & 0 deletions
10
clang/test/OffloadTools/clang-nvlink-wrapper/thinlto-save-temps.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| // REQUIRES: nvptx-registered-target | ||
| // RUN: %clang -cc1 -triple nvptx64-nvidia-cuda -flto=thin -funified-lto -emit-llvm-bc %s -o %t.bc | ||
| // RUN: mkdir -p %t.dir | ||
| // RUN: cd %t.dir && clang-nvlink-wrapper --dry-run --save-temps --plugin-opt=thinlto -arch sm_90 %t.bc -o thin 2>&1 | FileCheck %s | ||
| // CHECK-NOT: ptxas{{.*}} -c -O | ||
| // CHECK: ptxas{{.*}} -c thin.1.s {{.*}} -o thin.1.cubin | ||
| // CHECK-NEXT: {{.*}}nvlink{{.*}} -o thin thin.1.cubin | ||
|
|
||
| int foo(int x) { return x + 1; } | ||
| int bar(int x) { return x * 3; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be changed to instead derive its name from the input file (i.e. foo.s -> foo.cubin). That should fix this and make the signature changes unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 56ceb02: runPTXAs names the cubin after its input (
foo.s->foo.cubin) and keeps its old signature.