-
Notifications
You must be signed in to change notification settings - Fork 812
[SYCL] Reimplemented -f[no]sycl-early-optimizations flag #7701
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
bader
merged 28 commits into
intel:sycl
from
andylshort:alamzeds/fsycl-early-optimizations-flag
Jan 6, 2023
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
27597e2
Removed fsycl-early-opts and reimplemented fno-sycl-early-opts
8546bec
Fixed faulty flag assignment
78c9589
Reverted change to sycl-early-opts flag
d4ae056
Reverted two tests with unnecessary changes
dd3445e
Fixed the flag definition and tidied up the logic
2416d7d
clang-format'd BackendUtil changes
63c4430
Merge branch 'sycl' into alamzeds/fsycl-early-optimizations-flag
9c8bbb5
Resolved failing clang-format issues
bc085fd
Changed sycl-early-opts flag back to prev definition w/ change
95b0d3c
DisableLLVMPasses flag now handled by marshalling infrastructure
c69f54f
Optimization pipeline refactor to honour flags and fix logic
b13fa37
Update to group-local-memory test to honour disable-llvm-passes
af1324b
Rolled back uses_aspect test now it adheres to -disable-llvm-passes
5f45075
sub-group-size test change with updated flags
63270a6
Fixed functional pass invocation logic
7c36bb7
Converted inlining test to check nodes in AST
aac0dde
Reverted device_has test to respect disable_llvm_passes flag
b7586ff
Merge branch 'sycl' into alamzeds/fsycl-early-optimizations-flag
f8c9ab1
Ran clang-format over device_has sycl/test test
c46a0db
Refactored pipeline building logic after removing first SYCLPropagate…
639ae36
Merge branch 'sycl' into alamzeds/fsycl-early-optimizations-flag
5d39281
Tidied up and formatted pipeline if logic
2c90ec7
Let DisableSYCLEarlyOpts codegen opt be set by marshalling
786f8c0
Refactor to consolidate logic and clean up code paths
34c9d24
Merge branch 'sycl' into alamzeds/fsycl-early-optimizations-flag
c4c5274
Formatted changes
c2adfd0
Merge branch 'sycl' into alamzeds/fsycl-early-optimizations-flag
9871f46
Updated force inline kernel lambda test
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
43 changes: 43 additions & 0 deletions
43
clang/test/SemaSYCL/sycl-force-inline-kernel-lambda-ast.cpp
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: %clang_cc1 -fno-sycl-force-inline-kernel-lambda -fsycl-is-device -internal-isystem %S/Inputs -disable-llvm-passes -triple spir64-unknown-unknown -ast-dump -o - %s | FileCheck %s --check-prefixes=NOINLINE,CHECK | ||
| // RUN: %clang_cc1 -fsycl-is-device -internal-isystem %S/Inputs -disable-llvm-passes -triple spir64-unknown-unknown -ast-dump -o - %s | FileCheck %s --check-prefixes=INLINE,CHECK | ||
|
|
||
| // Tests that the appropriate inlining attributes are added to kernel lambda functions, | ||
| // with no inline attribute being added when -fno-sycl-force-inline-kernel-lambda is set | ||
| // and attribute not explicitly provided. | ||
|
|
||
andylshort marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| #include "sycl.hpp" | ||
elizabethandrews marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| int main() { | ||
| sycl::queue q; | ||
|
|
||
| q.submit([&](sycl::handler &h) { | ||
| // CHECK: LambdaExpr{{.*}}sycl-force-inline-kernel-lambda-ast.cpp:17 | ||
| // INLINE: AlwaysInlineAttr | ||
| // NOINLINE-NOT: AlwaysInlineAttr | ||
| h.parallel_for<class KernelName>([] {}); | ||
| }); | ||
|
|
||
| q.submit([&](sycl::handler &h) { | ||
| // CHECK: LambdaExpr{{.*}}sycl-force-inline-kernel-lambda-ast.cpp:23 | ||
| // CHECK: AlwaysInlineAttr | ||
| h.parallel_for<class KernelNameInline>([]() __attribute__((always_inline)) {}); | ||
| }); | ||
|
|
||
| q.submit([&](sycl::handler &h) { | ||
| // CHECK: LambdaExpr{{.*}}sycl-force-inline-kernel-lambda-ast.cpp:30 | ||
| // CHECK: NoInlineAttr | ||
| // CHECK-NOT: AlwaysInlineAttr | ||
| h.parallel_for<class KernelNameNoInline>([]() __attribute__((noinline)) {}); | ||
| }); | ||
|
|
||
| /// The flag is ignored for ESIMD kernels | ||
| q.submit([&](sycl::handler &h) { | ||
| // CHECK: LambdaExpr{{.*}}sycl-force-inline-kernel-lambda-ast.cpp:39 | ||
| // CHECK: SYCLSimdAttr | ||
| // CHECK-NOT: AlwaysInlineAttr | ||
| // CHECK-NOT: NoInlineAttr | ||
| h.parallel_for<class KernelNameESIMD>([]() __attribute__((sycl_explicit_simd)) {}); | ||
| }); | ||
|
|
||
| return 0; | ||
| } | ||
This file was deleted.
Oops, something went wrong.
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,71 @@ | ||
| // RUN: %clangxx -fsycl -Xclang -fsycl-is-device -fsycl-device-only -Xclang -fno-sycl-early-optimizations -S -emit-llvm %s -o - | FileCheck %s | ||
|
|
||
| // Tests for IR of device_has(aspect, ...) attribute and | ||
| // !sycl_used_aspects metadata | ||
| #include <sycl/sycl.hpp> | ||
|
|
||
| using namespace sycl; | ||
| queue q; | ||
|
|
||
| // CHECK: define weak_odr dso_local spir_kernel void @{{.*}}kernel_name_1{{.*}} !sycl_declared_aspects ![[ASPECTS1:[0-9]+]] !srcloc ![[SRCLOC1:[0-9]+]] {{.*}} | ||
|
|
||
| // CHECK: define dso_local spir_func void @{{.*}}func1{{.*}} !sycl_declared_aspects ![[ASPECTS1]] !srcloc ![[SRCLOC2:[0-9]+]] | ||
| // CHECK-SAME: !sycl_used_aspects ![[ASPECTS1]] | ||
| [[sycl::device_has(sycl::aspect::cpu)]] void func1() {} | ||
|
|
||
| // CHECK: define dso_local spir_func void @{{.*}}func2{{.*}} !sycl_declared_aspects ![[ASPECTS2:[0-9]+]] !srcloc ![[SRCLOC3:[0-9]+]] | ||
| // CHECK-SAME: !sycl_used_aspects ![[ASPECTS2]] | ||
| [[sycl::device_has(sycl::aspect::fp16, sycl::aspect::gpu)]] void func2() {} | ||
|
|
||
| // CHECK: define dso_local spir_func void @{{.*}}func3{{.*}} !sycl_declared_aspects ![[EMPTYASPECTS:[0-9]+]] !srcloc ![[SRCLOC4:[0-9]+]] { | ||
| [[sycl::device_has()]] void func3() {} | ||
|
|
||
| // CHECK: define linkonce_odr dso_local spir_func void @{{.*}}func4{{.*}} !sycl_declared_aspects ![[ASPECTS3:[0-9]+]] !srcloc ![[SRCLOC5:[0-9]+]] | ||
| // CHECK-SAME: !sycl_used_aspects ![[ASPECTS3]] | ||
| template <sycl::aspect Aspect> [[sycl::device_has(Aspect)]] void func4() {} | ||
|
|
||
| // CHECK: define dso_local spir_func void @{{.*}}func5{{.*}} !sycl_declared_aspects ![[ASPECTS1]] !srcloc ![[SRCLOC6:[0-9]+]] | ||
| // CHECK-SAME: !sycl_used_aspects ![[ASPECTS1]] | ||
| [[sycl::device_has(sycl::aspect::cpu)]] void func5(); | ||
| void func5() {} | ||
|
|
||
| constexpr sycl::aspect getAspect() { return sycl::aspect::cpu; } | ||
| // CHECK: define dso_local spir_func void @{{.*}}func6{{.*}} !sycl_declared_aspects ![[ASPECTS1]] !srcloc ![[SRCLOC7:[0-9]+]] | ||
| // CHECK-SAME: !sycl_used_aspects ![[ASPECTS1]] | ||
| [[sycl::device_has(getAspect())]] void func6() {} | ||
|
|
||
| class KernelFunctor { | ||
| public: | ||
| [[sycl::device_has(sycl::aspect::cpu)]] void operator()() const { | ||
| func1(); | ||
| func2(); | ||
| func3(); | ||
| func4<sycl::aspect::host>(); | ||
| func5(); | ||
| func6(); | ||
| } | ||
| }; | ||
|
|
||
| void foo() { | ||
| q.submit([&](handler &h) { | ||
| KernelFunctor f1; | ||
| h.single_task<class kernel_name_1>(f1); | ||
| // CHECK: define weak_odr dso_local spir_kernel void @{{.*}}kernel_name_2{{.*}} !sycl_declared_aspects ![[ASPECTS4:[0-9]+]] !srcloc ![[SRCLOC8:[0-9]+]] {{.*}} | ||
| h.single_task<class kernel_name_2>( | ||
| []() [[sycl::device_has(sycl::aspect::gpu)]] {}); | ||
| }); | ||
| } | ||
|
|
||
| // CHECK: [[ASPECTS1]] = !{i32 1} | ||
| // CHECK: [[SRCLOC1]] = !{i32 {{[0-9]+}}} | ||
| // CHECK: [[EMPTYASPECTS]] = !{} | ||
| // CHECK: [[SRCLOC2]] = !{i32 {{[0-9]+}}} | ||
| // CHECK: [[ASPECTS2]] = !{i32 5, i32 2} | ||
| // CHECK: [[SRCLOC3]] = !{i32 {{[0-9]+}}} | ||
| // CHECK: [[SRCLOC4]] = !{i32 {{[0-9]+}}} | ||
| // CHECK: [[ASPECTS3]] = !{i32 0} | ||
| // CHECK: [[SRCLOC5]] = !{i32 {{[0-9]+}}} | ||
| // CHECK: [[SRCLOC6]] = !{i32 {{[0-9]+}}} | ||
| // CHECK: [[SRCLOC7]] = !{i32 {{[0-9]+}}} | ||
| // CHECK: [[ASPECTS4]] = !{i32 2} | ||
| // CHECK: [[SRCLOC8]] = !{i32 {{[0-9]+}}} |
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.
Uh oh!
There was an error while loading. Please reload this page.