-
Notifications
You must be signed in to change notification settings - Fork 786
[DAE][SYCL] Enable DAE in SYCL kernel functions #2226
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
39e166d
[DAE][SYCL] Enable DAE in SYCL kernel functions
DenisBakhvalov 18e7bd0
Skipped using temporary directory
DenisBakhvalov 5b0c754
Fixed minor code review comment
DenisBakhvalov e30b2bf
Skip DAE if the integration header is not specified
DenisBakhvalov ab6f272
Renamed SCYL kernels to SPIR kernels
DenisBakhvalov bcbbbb1
Fixed tests
DenisBakhvalov 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
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
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
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
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
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
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
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
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
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
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
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,17 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature | ||
; RUN: opt < %s -deadargelim-sycl -S | FileCheck %s | ||
; Skip DAE if the path to the integration header is not specified. | ||
|
||
target triple = "spir64-unknown-unknown-sycldevice" | ||
|
||
define weak_odr spir_kernel void @NegativeSpirKernel(float %arg1, float %arg2) { | ||
; CHECK-LABEL: define {{[^@]+}}@NegativeSpirKernel | ||
; CHECK-SAME: (float [[ARG1:%.*]], float [[ARG2:%.*]]) | ||
; CHECK-NEXT: call void @foo(float [[ARG1]]) | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @foo(float %arg1) | ||
ret void | ||
} | ||
|
||
declare void @foo(float %arg) |
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,13 @@ | ||
; RUN: touch %t-int_header.h | ||
; RUN: not --crash opt < %s -deadargelim-sycl -S -integr-header-file %t-bad_file.h | ||
|
||
; Path to the integration header is wrong. | ||
|
||
target triple = "spir64-unknown-unknown-sycldevice" | ||
|
||
define weak_odr spir_kernel void @NegativeSpirKernel(float %arg1, float %arg2) { | ||
call void @foo(float %arg1) | ||
ret void | ||
} | ||
|
||
declare void @foo(float %arg) |
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,16 @@ | ||
; RUN: echo 'static constexpr const bool param_omit_table[] = {' > %t-int_header.h | ||
; RUN: echo ' // NegativeSpirKernel' >> %t-int_header.h | ||
; RUN: echo ' false, false,' >> %t-int_header.h | ||
; RUN: echo '};' >> %t-int_header.h | ||
; RUN: not --crash opt < %s -deadargelim-sycl -S -integr-header-file %t-int_header.h | ||
|
||
; No OMIT_TABLE markers in the integration header. | ||
|
||
target triple = "spir64-unknown-unknown-sycldevice" | ||
|
||
define weak_odr spir_kernel void @NegativeSpirKernel(float %arg1, float %arg2) { | ||
call void @foo(float %arg1) | ||
ret void | ||
} | ||
|
||
declare void @foo(float %arg) |
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,18 @@ | ||
; RUN: echo 'static constexpr const bool param_omit_table[] = {' > %t-int_header.h | ||
; RUN: echo ' // OMIT_TABLE_BEGIN' >> %t-int_header.h | ||
; RUN: echo ' // WrongKernelName' >> %t-int_header.h | ||
; RUN: echo ' false, false,' >> %t-int_header.h | ||
; RUN: echo ' // OMIT_TABLE_END' >> %t-int_header.h | ||
; RUN: echo '};' >> %t-int_header.h | ||
; RUN: not --crash opt < %s -deadargelim-sycl -S -integr-header-file %t-int_header.h | ||
|
||
; Wrong kernel name in the integration header. | ||
|
||
target triple = "spir64-unknown-unknown-sycldevice" | ||
|
||
define weak_odr spir_kernel void @NegativeSpirKernel(float %arg1, float %arg2) { | ||
call void @foo(float %arg1) | ||
ret void | ||
} | ||
|
||
declare void @foo(float %arg) |
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,20 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature | ||
; RUN: opt < %s -deadargelim -S | FileCheck %s | ||
; RUN: opt < %s -deadargelim-sycl -S | FileCheck %s | ||
|
||
; This test ensures dead arguments are not eliminated | ||
; from a global function that is not a SYCL kernel. | ||
|
||
target triple = "spir64-unknown-unknown-sycldevice" | ||
|
||
define weak_odr void @NotASpirKernel(float %arg1, float %arg2) { | ||
; CHECK-LABEL: define {{[^@]+}}@NotASpirKernel | ||
; CHECK-SAME: (float [[ARG1:%.*]], float [[ARG2:%.*]]) | ||
; CHECK-NEXT: call void @foo(float [[ARG1]]) | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @foo(float %arg1) | ||
ret void | ||
} | ||
|
||
declare void @foo(float %arg) |
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.
Are you going to replace this with assert(s)?
Another option to use LLVM_DEBUG and just skip the optimization.
Hard fail like this probably not the best approach for an optimization.
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 think it is a hard fail. If we did not update int header it will result in a later runtime fail.
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.
If we keep all arguments, it should be okay. I mean if anything is wrong with pre-requisites, this pass can just do nothing instead of crashing and it won't break anything.
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.
Introduced an early exit if
IntegrationHeaderFileName
is not provided.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.
Great. I think we can replace all error checking with asserts in this file.
This way we can "hard fail" on build with enabled assertions and there is no overhead on internal consistency checking on the builds w/o assertions.
->
assert(<cond> & <msg>);
I don't think we should do thorough runtime checking for integration header format. This file is auto-generated by the compiler, so it's should be validated in scope of #2236. We can validate that file format is correct with asserts.
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.
Feel free to address this in a separate PR.