Skip to content

Commit 0c4e3ac

Browse files
authored
[SYCL] RoundedRangeKernel should inherit properties from the original (#18900)
Fix issue #16839. --------- Signed-off-by: Hu, Peisen <peisen.hu@intel.com>
1 parent bbbd081 commit 0c4e3ac

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

sycl/include/sycl/handler.hpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,16 @@ class RoundedRangeKernel {
349349
KernelFunc(item);
350350
}
351351
}
352+
353+
// Copy the properties_tag getter from the original kernel to propagate
354+
// property(s)
355+
template <
356+
typename T = KernelType,
357+
typename = std::enable_if_t<ext::oneapi::experimental::detail::
358+
HasKernelPropertiesGetMethod<T>::value>>
359+
auto get(ext::oneapi::experimental::properties_tag) const {
360+
return KernelFunc.get(ext::oneapi::experimental::properties_tag{});
361+
}
352362
};
353363

354364
template <typename TransformedArgType, int Dims, typename KernelType>
@@ -364,6 +374,16 @@ class RoundedRangeKernelWithKH {
364374
KernelFunc(item, KH);
365375
}
366376
}
377+
378+
// Copy the properties_tag getter from the original kernel to propagate
379+
// property(s)
380+
template <
381+
typename T = KernelType,
382+
typename = std::enable_if_t<ext::oneapi::experimental::detail::
383+
HasKernelPropertiesGetMethod<T>::value>>
384+
auto get(ext::oneapi::experimental::properties_tag) const {
385+
return KernelFunc.get(ext::oneapi::experimental::properties_tag{});
386+
}
367387
};
368388

369389
using std::enable_if_t;

sycl/test-e2e/VirtualFunctions/misc/range-non-uniform-vf-2.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
// kernels when different work-items perform calls to different virtual
55
// functions using the same object.
66
//
7-
// TODO: Currently using the -Wno-deprecated-declarations flag due to issue
8-
// https://github.com/intel/llvm/issues/16839. Remove the flag as well as the
9-
// variable 'props' once the issue is resolved.
10-
// RUN: %{build} -o %t.out -Wno-deprecated-declarations %helper-includes
7+
// RUN: %{build} -o %t.out %helper-includes
118
// RUN: %{run} %t.out
129

1310
#include <sycl/detail/core.hpp>
@@ -76,7 +73,6 @@ int main() try {
7673
auto *DeviceStorage = sycl::malloc_shared<storage_t>(1, q);
7774
sycl::range R{1024};
7875

79-
constexpr oneapi::properties props{oneapi::assume_indirect_calls};
8076
for (size_t TestCase = 0; TestCase < 2; ++TestCase) {
8177
std::vector<int> HostData(R.size());
8278
std::iota(HostData.begin(), HostData.end(), 0);
@@ -91,7 +87,7 @@ int main() try {
9187

9288
q.submit([&](sycl::handler &CGH) {
9389
sycl::accessor DataAcc(DataStorage, CGH, sycl::read_write);
94-
CGH.parallel_for(R, props, KernelFunctor(DeviceStorage, DataAcc));
90+
CGH.parallel_for(R, KernelFunctor(DeviceStorage, DataAcc));
9591
});
9692

9793
BaseOp *Ptr = HostStorage.construct</* ret type = */ BaseOp>(TestCase);

sycl/test-e2e/VirtualFunctions/misc/range-non-uniform-vf.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
// kernels when different work-items perform a virtual function calls using
55
// different objects.
66
//
7-
// TODO: Currently using the -Wno-deprecated-declarations flag due to issue
8-
// https://github.com/intel/llvm/issues/16839. Remove the flag as well as the
9-
// variable 'props' once the issue is resolved.
10-
// RUN: %{build} -o %t.out -Wno-deprecated-declarations %helper-includes
7+
// RUN: %{build} -o %t.out %helper-includes
118
// RUN: %{run} %t.out
129

1310
#include <sycl/builtins.hpp>
@@ -71,7 +68,6 @@ int main() try {
7168
auto *DeviceStorage = sycl::malloc_shared<storage_t>(3, q);
7269
sycl::range R{1024};
7370

74-
constexpr oneapi::properties props{oneapi::assume_indirect_calls};
7571
{
7672
std::vector<float> HostData(R.size());
7773
for (size_t I = 1; I < HostData.size(); ++I)
@@ -89,7 +85,7 @@ int main() try {
8985

9086
q.submit([&](sycl::handler &CGH) {
9187
sycl::accessor DataAcc(DataStorage, CGH, sycl::read_write);
92-
CGH.parallel_for(R, props, KernelFunctor(DeviceStorage, DataAcc));
88+
CGH.parallel_for(R, KernelFunctor(DeviceStorage, DataAcc));
9389
});
9490

9591
BaseOp *Ptr[] = {HostStorage[0].construct</* ret type = */ BaseOp>(0),

sycl/test-e2e/VirtualFunctions/misc/range-uniform-vf.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
// kernels when every work-item calls the same virtual function on the same
55
// object.
66
//
7-
// TODO: Currently using the -Wno-deprecated-declarations flag due to issue
8-
// https://github.com/intel/llvm/issues/16839. Remove the flag as well as the
9-
// variable 'props' once the issue is resolved.
10-
// RUN: %{build} -o %t.out -Wno-deprecated-declarations %helper-includes
7+
// RUN: %{build} -o %t.out %helper-includes
118
// RUN: %{run} %t.out
129

1310
#include <sycl/builtins.hpp>
@@ -69,7 +66,6 @@ int main() try {
6966
auto *DeviceStorage = sycl::malloc_shared<storage_t>(1, q);
7067
sycl::range R{1024};
7168

72-
constexpr oneapi::properties props{oneapi::assume_indirect_calls};
7369
for (unsigned TestCase = 0; TestCase < 3; ++TestCase) {
7470
std::vector<float> HostData(R.size());
7571
for (size_t I = 1; I < HostData.size(); ++I)
@@ -85,7 +81,7 @@ int main() try {
8581

8682
q.submit([&](sycl::handler &CGH) {
8783
sycl::accessor DataAcc(DataStorage, CGH, sycl::read_write);
88-
CGH.parallel_for(R, props, KernelFunctor(DeviceStorage, DataAcc));
84+
CGH.parallel_for(R, KernelFunctor(DeviceStorage, DataAcc));
8985
});
9086

9187
auto *Ptr = HostStorage.construct</* ret type = */ BaseOp>(TestCase);

0 commit comments

Comments
 (0)