-
Notifications
You must be signed in to change notification settings - Fork 769
[SYCL] Add kernel properties for three function attributes #14448
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
Closed
frasercrmck
wants to merge
11
commits into
intel:sycl
from
frasercrmck:sycl-launch-bounds-kernel-prop
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
397fcde
[SYCL] Add kernel properties for three function attributes
frasercrmck a677fae
remove unnecessary comment
frasercrmck f9df938
fix formatting; fix max_work_group_size property value; test it
frasercrmck 781aeee
make assertion do as it says
frasercrmck 2df674f
Merge remote-tracking branch 'origin/sycl' into sycl-launch-bounds-ke…
frasercrmck f30b594
remove unused code
frasercrmck 323d1d0
bounds check
frasercrmck 14ffb1a
Merge remote-tracking branch 'origin/sycl' into sycl-launch-bounds-ke…
frasercrmck 7496935
update comment
frasercrmck 60da7cd
feedback: property doesn't need parameter pack
frasercrmck a10c350
rename properties
frasercrmck 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
27 changes: 27 additions & 0 deletions
27
sycl/test/check_device_code/extensions/properties/properties_kernel_launch_bounds.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,27 @@ | ||
// RUN: %clangxx -fsycl-device-only -S -Xclang -emit-llvm %s -o - | FileCheck %s --check-prefix CHECK-IR | ||
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify %s | ||
// expected-no-diagnostics | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
int main() { | ||
sycl::queue Q; | ||
|
||
constexpr auto Props = sycl::ext::oneapi::experimental::properties{ | ||
sycl::ext::oneapi::experimental::min_work_groups_per_multiprocessor<8>, | ||
sycl::ext::oneapi::experimental::max_work_groups_per_cluster<4>, | ||
}; | ||
// CHECK-IR: spir_kernel void @{{.*}}LaunchBoundsKernel(){{.*}} #[[LaunchBoundsAttrs:[0-9]+]] | ||
// CHECK-IR-SAME: !max_work_groups_per_cluster ![[MaxWGsPerCMD:[0-9]+]] | ||
// CHECK-IR-SAME: !min_work_groups_per_multiprocessor ![[MinWGsPerMPMD:[0-9]+]] | ||
Q.single_task<class LaunchBoundsKernel>(Props, []() {}); | ||
|
||
return 0; | ||
} | ||
|
||
// CHECK-IR: attributes #[[LaunchBoundsAttrs]] = { | ||
// CHECK-IR-SAME: "sycl-max-work-groups-per-cluster"="4" | ||
// CHECK-IR-SAME: "sycl-min-work-groups-per-multiprocessor"="8" | ||
|
||
// CHECK-IR: ![[MaxWGsPerCMD]] = !{i32 4} | ||
// CHECK-IR: ![[MinWGsPerMPMD]] = !{i32 8} |
27 changes: 27 additions & 0 deletions
27
sycl/test/check_device_code/extensions/properties/properties_kernel_launch_bounds_nvptx.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,27 @@ | ||
// REQUIRES: cuda | ||
|
||
// RUN: %clangxx -fsycl-device-only -fsycl-targets=nvptx64-nvidia-cuda -S -Xclang -emit-llvm %s -o - | FileCheck %s --check-prefix CHECK-IR | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
int main() { | ||
sycl::queue Q; | ||
|
||
constexpr auto Props = sycl::ext::oneapi::experimental::properties{ | ||
sycl::ext::oneapi::experimental::min_work_groups_per_multiprocessor<8>, | ||
sycl::ext::oneapi::experimental::max_work_groups_per_cluster<4>, | ||
}; | ||
|
||
// CHECK-IR: define{{.*}}void @[[LaunchBoundsKernelFn:.*LaunchBoundsKernel0]](){{.*}} #[[LaunchBoundsAttrs:[0-9]+]] | ||
Q.single_task<class LaunchBoundsKernel0>(Props, []() {}); | ||
|
||
return 0; | ||
} | ||
|
||
// CHECK-IR: attributes #[[LaunchBoundsAttrs]] = { | ||
// CHECK-IR-SAME: "sycl-max-work-groups-per-cluster"="4" | ||
// CHECK-IR-SAME: "sycl-min-work-groups-per-multiprocessor"="8" | ||
|
||
// CHECK-IR-DAG: !{ptr @[[LaunchBoundsKernelFn]], !"kernel", i32 1} | ||
// CHECK-IR-DAG: !{ptr @[[LaunchBoundsKernelFn]], !"minctasm", i32 8} | ||
// CHECK-IR-DAG: !{ptr @[[LaunchBoundsKernelFn]], !"maxclusterrank", i32 4} |
29 changes: 29 additions & 0 deletions
29
sycl/test/check_device_code/extensions/properties/properties_kernel_max_work_group_size.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,29 @@ | ||
// RUN: %clangxx -fsycl-device-only -S -Xclang -emit-llvm %s -o - | FileCheck %s --check-prefix CHECK-IR | ||
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify %s | ||
// expected-no-diagnostics | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
int main() { | ||
sycl::queue Q; | ||
sycl::event Ev; | ||
|
||
constexpr auto Props = sycl::ext::oneapi::experimental::properties{ | ||
sycl::ext::oneapi::experimental::max_work_group_size<8, 4, 2>}; | ||
|
||
// CHECK-IR: spir_kernel void @{{.*}}MaxWGSizeKernel0(){{.*}} #[[MaxWGSizeAttr1:[0-9]+]] | ||
// CHECK-IR-SAME: !max_work_group_size ![[MaxWGSizeMD1:[0-9]+]] | ||
Q.single_task<class MaxWGSizeKernel0>(Props, []() {}); | ||
// CHECK-IR: spir_kernel void @{{.*}}MaxWGSizeKernel1(){{.*}} #[[MaxWGSizeAttr1]] | ||
// CHECK-IR-SAME: !max_work_group_size ![[MaxWGSizeMD1]] | ||
Q.single_task<class MaxWGSizeKernel1>(Ev, Props, []() {}); | ||
// CHECK-IR: spir_kernel void @{{.*}}MaxWGSizeKernel2(){{.*}} #[[MaxWGSizeAttr1]] | ||
// CHECK-IR-SAME: !max_work_group_size ![[MaxWGSizeMD1]] | ||
Q.single_task<class MaxWGSizeKernel2>({Ev}, Props, []() {}); | ||
|
||
return 0; | ||
} | ||
|
||
// CHECK-IR: attributes #[[MaxWGSizeAttr1]] = { {{.*}}"sycl-max-work-group-size"="8,4,2" | ||
|
||
// CHECK-IR: ![[MaxWGSizeMD1]] = !{i64 2, i64 4, i64 8} |
25 changes: 25 additions & 0 deletions
25
...t/check_device_code/extensions/properties/properties_kernel_max_work_group_size_nvptx.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,25 @@ | ||
// REQUIRES: cuda | ||
|
||
// RUN: %clangxx -fsycl-device-only -fsycl-targets=nvptx64-nvidia-cuda -S -Xclang -emit-llvm %s -o - | FileCheck %s --check-prefix CHECK-IR | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
int main() { | ||
sycl::queue Q; | ||
|
||
constexpr auto Props = sycl::ext::oneapi::experimental::properties{ | ||
sycl::ext::oneapi::experimental::max_work_group_size<8, 4, 2>}; | ||
|
||
// CHECK-IR: define{{.*}}void @[[MaxWGSizeKernelFn:.*MaxWGSizeKernel0]](){{.*}} #[[MaxWGSizeAttr1:[0-9]+]] | ||
Q.single_task<class MaxWGSizeKernel0>(Props, []() {}); | ||
|
||
return 0; | ||
} | ||
|
||
// CHECK-IR: attributes #[[MaxWGSizeAttr1]] = { | ||
// CHECK-IR-SAME: "sycl-max-work-group-size"="8,4,2" | ||
|
||
// CHECK-IR-DAG: !{ptr @[[MaxWGSizeKernelFn]], !"kernel", i32 1} | ||
// CHECK-IR-DAG: !{ptr @[[MaxWGSizeKernelFn]], !"maxntidx", i32 2} | ||
// CHECK-IR-DAG: !{ptr @[[MaxWGSizeKernelFn]], !"maxntidy", i32 4} | ||
// CHECK-IR-DAG: !{ptr @[[MaxWGSizeKernelFn]], !"maxntidz", i32 8} |
Oops, something went wrong.
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.
There's a lot of code overlap between NVPTX lowering of kernel properties and
CompileTimePropertiesPass
lowering of kernel properties. We might want to think of a shared utility to work with kernel properties.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.
Hiding the fact that they're all represented as strings in LLVM IR as an "implementation detail" and providing a
std::optional<T> KernelPropertyAttr::getAsInteger
orgetAsIntegerList
might be a good step.