-
Notifications
You must be signed in to change notification settings - Fork 779
[SYCL] Merge sycl_declared_aspects to sycl_used_aspects #7419
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
AlexeySachkov
merged 8 commits into
intel:sycl
from
KornevNikita:propagate-declared-aspects
Nov 17, 2022
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e8c3e32
[SYCL] Merge sycl_declared_aspects to sycl_used_aspects
KornevNikita db97401
Fix test
KornevNikita ae09ca5
Apply suggestions
KornevNikita 4c9f301
Format
KornevNikita 435c611
Adjust FE test
KornevNikita 586281c
Adjust comment
KornevNikita e647f36
Adjust CHECK-SAME lines
KornevNikita 6ec407f
Fix format
KornevNikita 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
49 changes: 49 additions & 0 deletions
49
llvm/test/SYCLLowerIR/PropagateAspectsUsage/PropageteDeclaredAspects/propagate-declared-1.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,49 @@ | ||
; RUN: opt -passes=sycl-propagate-aspects-usage %s -S | FileCheck %s | ||
|
||
; kernel() | ||
; | | ||
; v | ||
; baz() | ||
; | | ||
; v | ||
; bar() | ||
; | | ||
; v | ||
; foo() | ||
|
||
source_filename = "main.cpp" | ||
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64" | ||
target triple = "spir64-unknown-unknown" | ||
|
||
; CHECK: void @kernel() !sycl_used_aspects ![[#ASPECT:]] | ||
define weak_odr dso_local spir_kernel void @kernel() { | ||
entry: | ||
call spir_func void @_Z3bazv() | ||
ret void | ||
} | ||
|
||
; CHECK: void @_Z3bazv() !sycl_used_aspects ![[#ASPECT]] { | ||
define dso_local spir_func void @_Z3bazv() { | ||
entry: | ||
call spir_func void @_Z3barv() | ||
ret void | ||
} | ||
|
||
; CHECK: void @_Z3barv() !sycl_used_aspects ![[#ASPECT]] { | ||
define dso_local spir_func void @_Z3barv() { | ||
entry: | ||
call spir_func void @_Z3foov() | ||
ret void | ||
} | ||
|
||
; CHECK: void @_Z3foov() !sycl_declared_aspects ![[#ASPECT]] !sycl_used_aspects ![[#ASPECT]] { | ||
define dso_local spir_func void @_Z3foov() !sycl_declared_aspects !2 { | ||
entry: | ||
ret void | ||
} | ||
|
||
!sycl_aspects = !{!0, !1} | ||
|
||
!0 = !{!"gpu", i32 2} | ||
!1 = !{!"fp64", i32 6} | ||
!2 = !{i32 2} |
43 changes: 43 additions & 0 deletions
43
llvm/test/SYCLLowerIR/PropagateAspectsUsage/PropageteDeclaredAspects/propagate-declared-2.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,43 @@ | ||
; RUN: opt -passes=sycl-propagate-aspects-usage %s -S | FileCheck %s | ||
|
||
; baz() | ||
; / \ | ||
; v v | ||
; bar() foo() | ||
|
||
source_filename = "main.cpp" | ||
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64" | ||
target triple = "spir64-unknown-unknown" | ||
|
||
; CHECK: void @_Z3bazv() !sycl_used_aspects ![[#ASPECT1:]] | ||
define dso_local spir_kernel void @_Z3bazv() { | ||
entry: | ||
call spir_func void @_Z3barv() | ||
call spir_func void @_Z3foov() | ||
ret void | ||
} | ||
|
||
; CHECK: void @_Z3barv() !sycl_used_aspects ![[#ASPECT2:]] { | ||
define dso_local spir_func void @_Z3barv() !sycl_used_aspects !3 { | ||
entry: | ||
ret void | ||
} | ||
|
||
; CHECK: void @_Z3foov() !sycl_used_aspects ![[#ASPECT3:]] | ||
; CHECK-SAME: !sycl_declared_aspects ![[#ASPECT3]] { | ||
define dso_local spir_func void @_Z3foov() !sycl_declared_aspects !4 { | ||
entry: | ||
ret void | ||
} | ||
|
||
; CHECK: ![[#ASPECT1]] = !{i32 2, i32 1} | ||
; CHECK: ![[#ASPECT2]] = !{i32 2} | ||
; CHECK: ![[#ASPECT3]] = !{i32 1} | ||
|
||
!sycl_aspects = !{!0, !1, !2} | ||
|
||
!0 = !{!"cpu", i32 1} | ||
!1 = !{!"gpu", i32 2} | ||
!2 = !{!"fp64", i32 6} | ||
!3 = !{i32 2} | ||
!4 = !{i32 1} |
51 changes: 51 additions & 0 deletions
51
llvm/test/SYCLLowerIR/PropagateAspectsUsage/PropageteDeclaredAspects/propagate-declared-3.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,51 @@ | ||
; RUN: opt -passes=sycl-propagate-aspects-usage %s -S | FileCheck %s | ||
|
||
; K | ||
; / \ | ||
; F1 F2 | ||
; \ / \ | ||
; F3 F4 | ||
|
||
; CHECK: spir_kernel void @kernel() !sycl_used_aspects ![[#ID1:]] | ||
define spir_kernel void @kernel() { | ||
call spir_func void @func1() | ||
call spir_func void @func2() | ||
ret void | ||
} | ||
|
||
; CHECK: spir_func void @func1() !sycl_used_aspects ![[#ID2:]] { | ||
define spir_func void @func1() { | ||
call spir_func void @func3() | ||
ret void | ||
} | ||
|
||
; CHECK: spir_func void @func2() !sycl_used_aspects ![[#ID1]] { | ||
define spir_func void @func2() { | ||
call spir_func void @func3() | ||
call spir_func void @func4() | ||
ret void | ||
} | ||
|
||
; CHECK: spir_func void @func3() !sycl_used_aspects ![[#ID2]] { | ||
define spir_func void @func3() !sycl_used_aspects !4 { | ||
ret void | ||
} | ||
|
||
; CHECK: spir_func void @func4() !sycl_used_aspects ![[#ID3:]] | ||
; CHECK-SAME: !sycl_declared_aspects ![[#ID3]] { | ||
define spir_func void @func4() !sycl_declared_aspects !3 { | ||
ret void | ||
} | ||
|
||
!sycl_aspects = !{!0, !1, !2} | ||
|
||
!0 = !{!"host", i32 0} | ||
!1 = !{!"cpu", i32 1} | ||
!2 = !{!"fp64", i32 6} | ||
!3 = !{i32 0} | ||
!4 = !{i32 1} | ||
!5 = !{i32 0, i32 1} | ||
|
||
; CHECK: ![[#ID1]] = !{i32 1, i32 0} | ||
; CHECK: ![[#ID2]] = !{i32 1} | ||
; CHECK: ![[#ID3]] = !{i32 0} |
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.
Do we run the pass even if
-disable-llvm-passes
option is passed?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 trying to understand why the clang-only test was changed :)
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.
Hm, I fixed this test because it was failed. Seems like we are.
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.
https://github.com/intel/llvm/blob/sycl/clang/lib/CodeGen/BackendUtil.cpp#L880
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.
Seems like we need this FE test changes for now
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 assume
sycl_used_aspects
metadata is being added here since the pass runs even if we pass -disable-llvm-passes. Can you modify the CHECK to test for it 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.
Exactly. Sure thing
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 435c611
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.
Please modify the comment at the top of the test to indicate we check sycl_used_aspects here 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.
@premanandrao Done 586281c