Skip to content

Commit 750627b

Browse files
committed
[SYCL] Remove the old mechanism of instantiating kernel on the host
1 parent ceae49b commit 750627b

File tree

3 files changed

+0
-93
lines changed

3 files changed

+0
-93
lines changed

sycl/include/sycl/detail/cg_types.hpp

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,6 @@ class HostKernelBase {
152152
// Used to extract captured variables.
153153
virtual char *getPtr() = 0;
154154
virtual ~HostKernelBase() noexcept = default;
155-
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
156-
// NOTE: InstatiateKernelOnHost() should not be called.
157-
virtual void InstantiateKernelOnHost() = 0;
158-
#endif
159155
};
160156

161157
// Class which stores specific lambda object.
@@ -170,69 +166,6 @@ class HostKernel : public HostKernelBase {
170166
char *getPtr() override { return reinterpret_cast<char *>(&MKernel); }
171167

172168
~HostKernel() noexcept override = default;
173-
174-
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
175-
// This function is needed for host-side compilation to keep kernels
176-
// instantitated. This is important for debuggers to be able to associate
177-
// kernel code instructions with source code lines.
178-
// NOTE: InstatiateKernelOnHost() should not be called.
179-
void InstantiateKernelOnHost() override {
180-
using IDBuilder = sycl::detail::Builder;
181-
constexpr bool HasKernelHandlerArg =
182-
KernelLambdaHasKernelHandlerArgT<KernelType, KernelArgType>::value;
183-
if constexpr (std::is_same_v<KernelArgType, void>) {
184-
runKernelWithoutArg(MKernel, std::bool_constant<HasKernelHandlerArg>());
185-
} else if constexpr (std::is_same_v<KernelArgType, sycl::id<Dims>>) {
186-
sycl::id ID = InitializedVal<Dims, id>::template get<0>();
187-
runKernelWithArg<const KernelArgType &>(
188-
MKernel, ID, std::bool_constant<HasKernelHandlerArg>());
189-
} else if constexpr (std::is_same_v<KernelArgType, item<Dims, true>> ||
190-
std::is_same_v<KernelArgType, item<Dims, false>>) {
191-
constexpr bool HasOffset =
192-
std::is_same_v<KernelArgType, item<Dims, true>>;
193-
if constexpr (!HasOffset) {
194-
KernelArgType Item = IDBuilder::createItem<Dims, HasOffset>(
195-
InitializedVal<Dims, range>::template get<1>(),
196-
InitializedVal<Dims, id>::template get<0>());
197-
runKernelWithArg<KernelArgType>(
198-
MKernel, Item, std::bool_constant<HasKernelHandlerArg>());
199-
} else {
200-
KernelArgType Item = IDBuilder::createItem<Dims, HasOffset>(
201-
InitializedVal<Dims, range>::template get<1>(),
202-
InitializedVal<Dims, id>::template get<0>(),
203-
InitializedVal<Dims, id>::template get<0>());
204-
runKernelWithArg<KernelArgType>(
205-
MKernel, Item, std::bool_constant<HasKernelHandlerArg>());
206-
}
207-
} else if constexpr (std::is_same_v<KernelArgType, nd_item<Dims>>) {
208-
sycl::range<Dims> Range = InitializedVal<Dims, range>::template get<1>();
209-
sycl::id<Dims> ID = InitializedVal<Dims, id>::template get<0>();
210-
sycl::group<Dims> Group =
211-
IDBuilder::createGroup<Dims>(Range, Range, Range, ID);
212-
sycl::item<Dims, true> GlobalItem =
213-
IDBuilder::createItem<Dims, true>(Range, ID, ID);
214-
sycl::item<Dims, false> LocalItem =
215-
IDBuilder::createItem<Dims, false>(Range, ID);
216-
KernelArgType NDItem =
217-
IDBuilder::createNDItem<Dims>(GlobalItem, LocalItem, Group);
218-
runKernelWithArg<const KernelArgType>(
219-
MKernel, NDItem, std::bool_constant<HasKernelHandlerArg>());
220-
} else if constexpr (std::is_same_v<KernelArgType, sycl::group<Dims>>) {
221-
sycl::range<Dims> Range = InitializedVal<Dims, range>::template get<1>();
222-
sycl::id<Dims> ID = InitializedVal<Dims, id>::template get<0>();
223-
KernelArgType Group =
224-
IDBuilder::createGroup<Dims>(Range, Range, Range, ID);
225-
runKernelWithArg<KernelArgType>(
226-
MKernel, Group, std::bool_constant<HasKernelHandlerArg>());
227-
} else {
228-
// Assume that anything else can be default-constructed. If not, this
229-
// should fail to compile and the implementor should implement a generic
230-
// case for the new argument type.
231-
runKernelWithArg<KernelArgType>(
232-
MKernel, KernelArgType{}, std::bool_constant<HasKernelHandlerArg>());
233-
}
234-
}
235-
#endif
236169
};
237170

238171
// the class keeps reference to a lambda allocated externally on stack
@@ -243,11 +176,6 @@ class HostKernelRefBase : public HostKernelBase {
243176
HostKernelRefBase &operator=(const HostKernelRefBase &) = delete;
244177

245178
virtual std::unique_ptr<HostKernelBase> takeOrCopyOwnership() const = 0;
246-
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
247-
// The kernels that are passed via HostKernelRefBase are instantiated along
248-
// ctor call with GetInstantiateKernelOnHostPtr().
249-
void InstantiateKernelOnHost() override {}
250-
#endif
251179
};
252180

253181
// Primary template for movable objects.

sycl/test/abi/vtable.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,6 @@
88
// Changing vtable breaks ABI. If this test fails, please, refer to ABI Policy
99
// Guide for further instructions.
1010

11-
void foo(sycl::detail::HostKernelBase &HKB) {
12-
HKB.InstantiateKernelOnHost();
13-
}
14-
// CHECK: Vtable for 'sycl::detail::HostKernelBase' (6 entries).
15-
// CHECK-NEXT: 0 | offset_to_top (0)
16-
// CHECK-NEXT: 1 | sycl::detail::HostKernelBase RTTI
17-
// CHECK-NEXT: -- (sycl::detail::HostKernelBase, 0) vtable address --
18-
// CHECK-NEXT: 2 | char *sycl::detail::HostKernelBase::getPtr() [pure]
19-
// CHECK-NEXT: 3 | sycl::detail::HostKernelBase::~HostKernelBase() [complete]
20-
// CHECK-NEXT: 4 | sycl::detail::HostKernelBase::~HostKernelBase() [deleting]
21-
// CHECK-NEXT: 5 | void sycl::detail::HostKernelBase::InstantiateKernelOnHost() [pure]
22-
2311
void foo(sycl::detail::PropertyWithDataBase *Prop) { delete Prop; }
2412
// CHECK: Vtable for 'sycl::detail::PropertyWithDataBase' (4 entries).
2513
// CHECK-NEXT: 0 | offset_to_top (0)

sycl/test/basic_tests/single_task_error_message.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ int main() {
1212
.single_task([&](sycl::handler &cgh) {
1313
// expected-error-re@sycl/queue.hpp:* {{static assertion failed due to requirement '{{.*}}': sycl::queue.single_task() requires a kernel instead of command group.{{.*}} Use queue.submit() instead}}
1414
// expected-error-re@sycl/detail/cg_types.hpp:* {{no matching function for call to object of type '(lambda at {{.*}}single_task_error_message.cpp:{{.*}})'}}
15-
// TODO Investigate why this function template is not instantiated
16-
// (if this is expected).
17-
// expected-error@sycl/detail/cg_types.hpp:* {{no matching function for call to 'runKernelWithoutArg'}}
1815
})
1916
.wait();
2017
}
@@ -31,9 +28,6 @@ int main() {
3128
[&](sycl::handler &cgh) {
3229
// expected-error-re@sycl/queue.hpp:* {{static assertion failed due to requirement '{{.*}}': sycl::queue.single_task() requires a kernel instead of command group.{{.*}} Use queue.submit() instead}}
3330
// expected-error-re@sycl/detail/cg_types.hpp:* {{no matching function for call to object of type '(lambda at {{.*}}single_task_error_message.cpp:{{.*}})'}}
34-
// TODO Investigate why this function template is not
35-
// instantiated (if this is expected).
36-
// expected-error@sycl/detail/cg_types.hpp:* {{no matching function for call to 'runKernelWithoutArg'}}
3731
})
3832
.wait();
3933
}
@@ -50,9 +44,6 @@ int main() {
5044
[&](sycl::handler &cgh) {
5145
// expected-error-re@sycl/queue.hpp:* {{static assertion failed due to requirement '{{.*}}': sycl::queue.single_task() requires a kernel instead of command group.{{.*}} Use queue.submit() instead}}
5246
// expected-error-re@sycl/detail/cg_types.hpp:* {{no matching function for call to object of type '(lambda at {{.*}}single_task_error_message.cpp:{{.*}})'}}
53-
// TODO Investigate why this function template is not
54-
// instantiated (if this is expected).
55-
// expected-error@sycl/detail/cg_types.hpp:* {{no matching function for call to 'runKernelWithoutArg'}}
5647
})
5748
.wait();
5849
}

0 commit comments

Comments
 (0)