-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Add sycl_ext_named_sub_group_sizes kernel properties #12335
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
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8fd29b3
[SYCL] Add sycl_ext_named_sub_group_sizes kernel properties
jzc 3dc8731
Don't use 0 for named_sub_group_size value
jzc fe9bb73
Merge remote-tracking branch 'intel/sycl' into named-sub-group-sizes
jzc 679af20
Merge remote-tracking branch 'intel/sycl' into named-sub-group-sizes
jzc 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
45 changes: 45 additions & 0 deletions
45
sycl/include/sycl/ext/oneapi/experimental/named_sub_group_sizes.hpp
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,45 @@ | ||
//== named_sub_group_sizes.hpp --- SYCL extension for named sub-group sizes ==// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#pragma once | ||
|
||
#include <sycl/ext/oneapi/kernel_properties/properties.hpp> | ||
|
||
namespace sycl { | ||
inline namespace _V1 { | ||
namespace ext::oneapi::experimental { | ||
|
||
struct named_sub_group_size { | ||
static constexpr uint32_t primary = -1; | ||
static constexpr uint32_t automatic = -2; | ||
}; | ||
|
||
inline constexpr sub_group_size_key::value_t<named_sub_group_size::primary> | ||
sub_group_size_primary; | ||
|
||
inline constexpr sub_group_size_key::value_t<named_sub_group_size::automatic> | ||
sub_group_size_automatic; | ||
|
||
namespace detail { | ||
template <> | ||
struct PropertyMetaInfo< | ||
sub_group_size_key::value_t<named_sub_group_size::automatic>> { | ||
// sub_group_size_automatic means that the kernel can be compiled with | ||
// any sub-group size. That is, if the kernel has the sub_group_size_automatic | ||
// property, then no sycl-sub-group-size IR attribute needs to be attached. | ||
// Specializing PropertyMetaInfo for sub_group_size_automatic and setting | ||
// name to an empty string will result in no sycl-sub-group-size IR being | ||
// attached. | ||
static constexpr const char *name = ""; | ||
static constexpr const char *value = 0; | ||
}; | ||
} // namespace detail | ||
|
||
} // namespace ext::oneapi::experimental | ||
} // namespace _V1 | ||
} // namespace sycl |
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
24 changes: 24 additions & 0 deletions
24
sycl/test/extensions/properties/properties_kernel_named_sub_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,24 @@ | ||
// RUN: %clangxx -fsycl-device-only -S -Xclang -emit-llvm %s -o - | FileCheck %s | ||
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify %s | ||
// expected-no-diagnostics | ||
#include <sycl/sycl.hpp> | ||
|
||
int main() { | ||
sycl::queue q; | ||
sycl::nd_range<1> ndr{6, 2}; | ||
|
||
// CHECK: spir_kernel void @{{.*}}Kernel1() | ||
// CHECK-SAME: !intel_reqd_sub_group_size ![[SGSizeAttr:[0-9]+]] | ||
sycl::ext::oneapi::experimental::properties P1{ | ||
sycl::ext::oneapi::experimental::sub_group_size_primary}; | ||
q.parallel_for<class Kernel1>(ndr, P1, [=](auto id) {}); | ||
|
||
// CHECK: spir_kernel void @{{.*}}Kernel2() | ||
// CHECK-NOT: intel_reqd_sub_group_size | ||
// CHECK-SAME: { | ||
sycl::ext::oneapi::experimental::properties P2{ | ||
sycl::ext::oneapi::experimental::sub_group_size_automatic}; | ||
q.parallel_for<class Kernel2>(ndr, P2, [=](auto id) {}); | ||
} | ||
|
||
// CHECK: ![[SGSizeAttr]] = !{i32 -1} |
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.