-
Notifications
You must be signed in to change notification settings - Fork 794
[SYCL] Do not emit "llvm.used" to output module(s) in the post link tool #2995
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
pvchupin
merged 2 commits into
intel:sycl
from
sndmitriev:public/sndmitriev/post-link-erase-used
Jan 6, 2021
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
There are no files selected for viewing
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,19 @@ | ||
; This test checks that the post-link tool does not add "llvm.used" global to | ||
; the output modules when splitting kernels. | ||
; | ||
; RUN: sycl-post-link -split=kernel -S %s -o %T/files.table | ||
; RUN: FileCheck %s -input-file=%T/files_0.ll | ||
; RUN: FileCheck %s -input-file=%T/files_1.ll | ||
|
||
target triple = "spir64-unknown-unknown-sycldevice" | ||
|
||
; CHECK-NOT: llvm.used | ||
@llvm.used = appending global [2 x i8*] [i8* bitcast (void ()* @foo to i8*), i8* bitcast (void ()* @bar to i8*)], section "llvm.metadata" | ||
|
||
define weak_odr spir_kernel void @foo() { | ||
ret void | ||
} | ||
|
||
define weak_odr spir_kernel void @bar() { | ||
ret void | ||
} |
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
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.
@sndmitriev, could you clarify what kind of problems might be caused, please?
Uh oh!
There was an error while loading. Please reload this page.
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.
After linking device bitcode llvm.used holds references to the kernels that are defined in the device image. But after splitting device image into separate kernels (with -fsycl-device-code-split=per_kernel option) we may end up with having references to kernel declaration originating from “llvm.used” in the IR that is passed to llvm-spirv tool, and these declarations cause an assertion in llvm-spirv
Uh oh!
There was an error while loading. Please reload this page.
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.
I'm a bit confused with the reasoning.
That FP-contract related assertion seems like an unhandled situation in the translator which should be fixed there.
However, I do agree that
@llvm.used
might cause problems with the translation, because it contains function pointers and can't be translated into SPIR-V without corresponding extension (SPV_INTEL_function_pointers
) enabledThere 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.
I do not argue with that, the problem needs to be fixed in the translator as well.
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.
How do we get this metadata in device code? It's not emitted in SYCL mode: aa35161. Is it emitted in other modes?
If so, shouldn't we drop
@llvm.used
during FE IR generation?Anyway, it would be nice if we add clarification with reasoning to drop
@llvm.used
in sycl-post-link tool from this comment: #2995 (comment).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.
"llvm.used" variable may appear in the IR after linking with "deps" bitcode file (please see #2872 for more details).
I have created #3012 to address your comment. Please review it.