Skip to content

Commit c378133

Browse files
authored
[SYCL][ABI-Break][PI] Remove deprecated piEnqueueNativeKernel (#10008)
This patch removes the deprecated entry-point `piEnqueueNativeKernel`. This change is being made in preparation for porting the OpenCL plugin to Unified Runtime which does not intend to support enqueuing native kernels since it has already being deprecated.
1 parent 8c53527 commit c378133

25 files changed

+3
-513
lines changed

sycl/include/sycl/detail/cg.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class CG {
6161
BarrierWaitlist = 6,
6262
Fill = 7,
6363
UpdateHost = 8,
64-
RunOnHostIntel = 9,
6564
CopyUSM = 10,
6665
FillUSM = 11,
6766
PrefetchUSM = 12,
@@ -190,8 +189,7 @@ class CGExecKernel : public CG {
190189
MKernelName(std::move(KernelName)), MStreams(std::move(Streams)),
191190
MAuxiliaryResources(std::move(AuxiliaryResources)),
192191
MKernelCacheConfig(std::move(KernelCacheConfig)) {
193-
assert((getType() == RunOnHostIntel || getType() == Kernel) &&
194-
"Wrong type of exec kernel CG.");
192+
assert(getType() == Kernel && "Wrong type of exec kernel CG.");
195193
}
196194

197195
CGExecKernel(const CGExecKernel &CGExec) = default;

sycl/include/sycl/detail/pi.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ _PI_API(piSamplerRetain)
106106
_PI_API(piSamplerRelease)
107107
// Queue commands
108108
_PI_API(piEnqueueKernelLaunch)
109-
_PI_API(piEnqueueNativeKernel)
110109
_PI_API(piEnqueueEventsWait)
111110
_PI_API(piEnqueueEventsWaitWithBarrier)
112111
_PI_API(piEnqueueMemBufferRead)

sycl/include/sycl/detail/pi.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,12 +1636,6 @@ __SYCL_EXPORT pi_result piEnqueueKernelLaunch(
16361636
const size_t *local_work_size, pi_uint32 num_events_in_wait_list,
16371637
const pi_event *event_wait_list, pi_event *event);
16381638

1639-
__SYCL_EXPORT pi_result piEnqueueNativeKernel(
1640-
pi_queue queue, void (*user_func)(void *), void *args, size_t cb_args,
1641-
pi_uint32 num_mem_objects, const pi_mem *mem_list,
1642-
const void **args_mem_loc, pi_uint32 num_events_in_wait_list,
1643-
const pi_event *event_wait_list, pi_event *event);
1644-
16451639
__SYCL_EXPORT pi_result piEnqueueEventsWait(pi_queue command_queue,
16461640
pi_uint32 num_events_in_wait_list,
16471641
const pi_event *event_wait_list,

sycl/include/sycl/handler.hpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,24 +1696,6 @@ class __SYCL_EXPORT handler {
16961696
std::move(KernelFunc));
16971697
}
16981698

1699-
/// Defines and invokes a SYCL kernel on host device.
1700-
///
1701-
/// \param Func is a SYCL kernel function defined by lambda function or a
1702-
/// named function object type.
1703-
template <typename FuncT>
1704-
__SYCL_DEPRECATED(
1705-
"run_on_host_intel() is deprecated, use host_task() instead")
1706-
void run_on_host_intel(FuncT Func) {
1707-
throwIfActionIsCreated();
1708-
// No need to check if range is out of INT_MAX limits as it's compile-time
1709-
// known constant
1710-
MNDRDesc.set(range<1>{1});
1711-
1712-
MArgs = std::move(MAssociatedAccesors);
1713-
MHostKernel.reset(new detail::HostKernel<FuncT, void, 1>(std::move(Func)));
1714-
setType(detail::CG::RunOnHostIntel);
1715-
}
1716-
17171699
/// Enqueues a command to the SYCL runtime to invoke \p Func once.
17181700
template <typename FuncT>
17191701
std::enable_if_t<detail::check_fn_signature<std::remove_reference_t<FuncT>,

sycl/plugins/cuda/pi_cuda.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ pi_result piPluginInit(pi_plugin *PluginInit) {
139139
_PI_CL(piSamplerRelease, pi2ur::piSamplerRelease)
140140
// Queue commands
141141
_PI_CL(piEnqueueKernelLaunch, pi2ur::piEnqueueKernelLaunch)
142-
_PI_CL(piEnqueueNativeKernel, pi2ur::piEnqueueNativeKernel)
143142
_PI_CL(piEnqueueEventsWait, pi2ur::piEnqueueEventsWait)
144143
_PI_CL(piEnqueueEventsWaitWithBarrier, pi2ur::piEnqueueEventsWaitWithBarrier)
145144
_PI_CL(piEnqueueMemBufferRead, pi2ur::piEnqueueMemBufferRead)

sycl/plugins/esimd_emulator/pi_esimd_emulator.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,12 +1919,6 @@ pi_result piextKernelGetNativeHandle(pi_kernel, pi_native_handle *) {
19191919
DIE_NO_IMPLEMENTATION;
19201920
}
19211921

1922-
pi_result piEnqueueNativeKernel(pi_queue, void (*)(void *), void *, size_t,
1923-
pi_uint32, const pi_mem *, const void **,
1924-
pi_uint32, const pi_event *, pi_event *) {
1925-
DIE_NO_IMPLEMENTATION;
1926-
}
1927-
19281922
pi_result piextGetDeviceFunctionPointer(pi_device, pi_program, const char *,
19291923
pi_uint64 *) {
19301924
DIE_NO_IMPLEMENTATION;

sycl/plugins/hip/pi_hip.cpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3178,30 +3178,6 @@ pi_result hip_piEnqueueKernelLaunch(
31783178
return retError;
31793179
}
31803180

3181-
/// \TODO Not implemented
3182-
pi_result
3183-
hip_piEnqueueNativeKernel(pi_queue queue, void (*user_func)(void *), void *args,
3184-
size_t cb_args, pi_uint32 num_mem_objects,
3185-
const pi_mem *mem_list, const void **args_mem_loc,
3186-
pi_uint32 num_events_in_wait_list,
3187-
const pi_event *event_wait_list, pi_event *event) {
3188-
(void)queue;
3189-
(void)user_func;
3190-
(void)args;
3191-
(void)cb_args;
3192-
(void)num_mem_objects;
3193-
(void)mem_list;
3194-
(void)args_mem_loc;
3195-
(void)num_events_in_wait_list;
3196-
(void)event_wait_list;
3197-
(void)event;
3198-
3199-
sycl::detail::pi::die("Not implemented in HIP backend");
3200-
return {};
3201-
}
3202-
3203-
/// \TODO Not implemented
3204-
32053181
pi_result hip_piMemImageCreate(pi_context context, pi_mem_flags flags,
32063182
const pi_image_format *image_format,
32073183
const pi_image_desc *image_desc, void *host_ptr,
@@ -6001,7 +5977,6 @@ pi_result piPluginInit(pi_plugin *PluginInit) {
60015977
_PI_CL(piSamplerRelease, hip_piSamplerRelease)
60025978
// Queue commands
60035979
_PI_CL(piEnqueueKernelLaunch, hip_piEnqueueKernelLaunch)
6004-
_PI_CL(piEnqueueNativeKernel, hip_piEnqueueNativeKernel)
60055980
_PI_CL(piEnqueueEventsWait, hip_piEnqueueEventsWait)
60065981
_PI_CL(piEnqueueEventsWaitWithBarrier, hip_piEnqueueEventsWaitWithBarrier)
60075982
_PI_CL(piEnqueueMemBufferRead, hip_piEnqueueMemBufferRead)

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -723,18 +723,6 @@ pi_result piMemBufferPartition(pi_mem Buffer, pi_mem_flags Flags,
723723
BufferCreateInfo, RetMem);
724724
}
725725

726-
pi_result piEnqueueNativeKernel(pi_queue Queue, void (*UserFunc)(void *),
727-
void *Args, size_t CbArgs,
728-
pi_uint32 NumMemObjects, const pi_mem *MemList,
729-
const void **ArgsMemLoc,
730-
pi_uint32 NumEventsInWaitList,
731-
const pi_event *EventWaitList,
732-
pi_event *Event) {
733-
return pi2ur::piEnqueueNativeKernel(
734-
Queue, UserFunc, Args, CbArgs, NumMemObjects, MemList, ArgsMemLoc,
735-
NumEventsInWaitList, EventWaitList, Event);
736-
}
737-
738726
// TODO: Check if the function_pointer_ret type can be converted to void**.
739727
pi_result piextGetDeviceFunctionPointer(pi_device Device, pi_program Program,
740728
const char *FunctionName,

sycl/plugins/opencl/pi_opencl.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2680,7 +2680,6 @@ pi_result piPluginInit(pi_plugin *PluginInit) {
26802680
_PI_CL(piSamplerRelease, clReleaseSampler)
26812681
// Queue commands
26822682
_PI_CL(piEnqueueKernelLaunch, clEnqueueNDRangeKernel)
2683-
_PI_CL(piEnqueueNativeKernel, clEnqueueNativeKernel)
26842683
_PI_CL(piEnqueueEventsWait, clEnqueueMarkerWithWaitList)
26852684
_PI_CL(piEnqueueEventsWaitWithBarrier, clEnqueueBarrierWithWaitList)
26862685
_PI_CL(piEnqueueMemBufferRead, clEnqueueReadBuffer)

sycl/plugins/unified_runtime/pi2ur.hpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,28 +1964,6 @@ piEnqueueMemImageFill(pi_queue Queue, pi_mem Image, const void *FillColor,
19641964
return PI_SUCCESS;
19651965
}
19661966

1967-
inline pi_result
1968-
piEnqueueNativeKernel(pi_queue Queue, void (*UserFunc)(void *), void *Args,
1969-
size_t CbArgs, pi_uint32 NumMemObjects,
1970-
const pi_mem *MemList, const void **ArgsMemLoc,
1971-
pi_uint32 NumEventsInWaitList,
1972-
const pi_event *EventsWaitList, pi_event *Event) {
1973-
std::ignore = UserFunc;
1974-
std::ignore = Args;
1975-
std::ignore = CbArgs;
1976-
std::ignore = NumMemObjects;
1977-
std::ignore = MemList;
1978-
std::ignore = ArgsMemLoc;
1979-
std::ignore = NumEventsInWaitList;
1980-
std::ignore = EventsWaitList;
1981-
std::ignore = Event;
1982-
1983-
PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
1984-
1985-
die("piEnqueueNativeKernel: not implemented");
1986-
return PI_SUCCESS;
1987-
}
1988-
19891967
inline pi_result piextGetDeviceFunctionPointer(pi_device Device,
19901968
pi_program Program,
19911969
const char *FunctionName,

sycl/plugins/unified_runtime/pi_unified_runtime.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -722,16 +722,6 @@ __SYCL_EXPORT pi_result piMemRelease(pi_mem Mem) {
722722
return pi2ur::piMemRelease(Mem);
723723
}
724724

725-
__SYCL_EXPORT pi_result piEnqueueNativeKernel(
726-
pi_queue Queue, void (*UserFunc)(void *), void *Args, size_t CbArgs,
727-
pi_uint32 NumMemObjects, const pi_mem *MemList, const void **ArgsMemLoc,
728-
pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList,
729-
pi_event *Event) {
730-
return pi2ur::piEnqueueNativeKernel(
731-
Queue, UserFunc, Args, CbArgs, NumMemObjects, MemList, ArgsMemLoc,
732-
NumEventsInWaitList, EventWaitList, Event);
733-
}
734-
735725
__SYCL_EXPORT pi_result piextGetDeviceFunctionPointer(
736726
pi_device Device, pi_program Program, const char *FunctionName,
737727
pi_uint64 *FunctionPointerRet) {
@@ -1252,7 +1242,6 @@ __SYCL_EXPORT pi_result piPluginInit(pi_plugin *PluginInit) {
12521242
_PI_API(piEnqueueMemBufferRead)
12531243
_PI_API(piEnqueueEventsWaitWithBarrier)
12541244
_PI_API(piEnqueueEventsWait)
1255-
_PI_API(piEnqueueNativeKernel)
12561245
_PI_API(piEnqueueMemImageFill)
12571246

12581247
_PI_API(piEventSetCallback)

sycl/source/detail/graph_impl.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ class node_impl {
121121
std::unique_ptr<sycl::detail::CG> getCGCopy() const {
122122
switch (MCGType) {
123123
case sycl::detail::CG::Kernel:
124-
case sycl::detail::CG::RunOnHostIntel:
125124
return createCGCopy<sycl::detail::CGExecKernel>();
126125
case sycl::detail::CG::CopyAccToPtr:
127126
case sycl::detail::CG::CopyPtrToAcc:

sycl/source/detail/scheduler/commands.cpp

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -2320,8 +2320,6 @@ static pi_result SetKernelParamsAndLaunch(
23202320
}
23212321

23222322
// The function initialize accessors and calls lambda.
2323-
// The function is used as argument to piEnqueueNativeKernel which requires
2324-
// that the passed function takes one void* argument.
23252323
void DispatchNativeKernel(void *Blob) {
23262324
void **CastedBlob = (void **)Blob;
23272325

@@ -2596,93 +2594,6 @@ pi_int32 ExecCGCommand::enqueueImp() {
25962594

25972595
return PI_SUCCESS;
25982596
}
2599-
case CG::CGTYPE::RunOnHostIntel: {
2600-
CGExecKernel *HostTask = (CGExecKernel *)MCommandGroup.get();
2601-
2602-
// piEnqueueNativeKernel takes arguments blob which is passes to user
2603-
// function.
2604-
// Need the following items to restore context in the host task.
2605-
// Make a copy on heap to "dettach" from the command group as it can be
2606-
// released before the host task completes.
2607-
std::vector<void *> ArgsBlob(HostTask->MArgs.size() + 3);
2608-
2609-
std::vector<Requirement *> *CopyReqs =
2610-
new std::vector<Requirement *>(HostTask->getRequirements());
2611-
2612-
// Create a shared_ptr on the heap so that the reference count is
2613-
// incremented until the DispatchNativeKernel() callback is run, which
2614-
// will free the heap shared_ptr and decrement the reference count. This
2615-
// prevents errors when the HostTask command-group is deleted before
2616-
// DispatchNativeKernel() can be run.
2617-
std::shared_ptr<HostKernelBase> *CopyHostKernel =
2618-
new std::shared_ptr<HostKernelBase>(HostTask->MHostKernel);
2619-
2620-
NDRDescT *CopyNDRDesc = new NDRDescT(HostTask->MNDRDesc);
2621-
2622-
ArgsBlob[0] = (void *)CopyReqs;
2623-
ArgsBlob[1] = (void *)CopyHostKernel;
2624-
ArgsBlob[2] = (void *)CopyNDRDesc;
2625-
2626-
void **NextArg = ArgsBlob.data() + 3;
2627-
2628-
if (MQueue->is_host()) {
2629-
for (ArgDesc &Arg : HostTask->MArgs) {
2630-
assert(Arg.MType == kernel_param_kind_t::kind_accessor);
2631-
2632-
Requirement *Req = (Requirement *)(Arg.MPtr);
2633-
AllocaCommandBase *AllocaCmd = getAllocaForReq(Req);
2634-
2635-
*NextArg = AllocaCmd->getMemAllocation();
2636-
NextArg++;
2637-
}
2638-
2639-
if (!RawEvents.empty()) {
2640-
// Assuming that the events are for devices to the same Plugin.
2641-
const PluginPtr &Plugin = EventImpls[0]->getPlugin();
2642-
Plugin->call<PiApiKind::piEventsWait>(RawEvents.size(), &RawEvents[0]);
2643-
}
2644-
DispatchNativeKernel((void *)ArgsBlob.data());
2645-
2646-
return PI_SUCCESS;
2647-
}
2648-
2649-
std::vector<pi_mem> Buffers;
2650-
// piEnqueueNativeKernel requires additional array of pointers to args
2651-
// blob, values that pointers point to are replaced with actual pointers
2652-
// to the memory before execution of user function.
2653-
std::vector<void *> MemLocs;
2654-
2655-
for (ArgDesc &Arg : HostTask->MArgs) {
2656-
assert(Arg.MType == kernel_param_kind_t::kind_accessor);
2657-
2658-
Requirement *Req = (Requirement *)(Arg.MPtr);
2659-
AllocaCommandBase *AllocaCmd = getAllocaForReq(Req);
2660-
pi_mem MemArg = (pi_mem)AllocaCmd->getMemAllocation();
2661-
2662-
Buffers.push_back(MemArg);
2663-
MemLocs.push_back(NextArg);
2664-
NextArg++;
2665-
}
2666-
const PluginPtr &Plugin = MQueue->getPlugin();
2667-
pi_result Error = Plugin->call_nocheck<PiApiKind::piEnqueueNativeKernel>(
2668-
MQueue->getHandleRef(), DispatchNativeKernel, (void *)ArgsBlob.data(),
2669-
ArgsBlob.size() * sizeof(ArgsBlob[0]), Buffers.size(), Buffers.data(),
2670-
const_cast<const void **>(MemLocs.data()), RawEvents.size(),
2671-
RawEvents.empty() ? nullptr : RawEvents.data(), Event);
2672-
2673-
switch (Error) {
2674-
case PI_ERROR_INVALID_OPERATION:
2675-
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
2676-
"Device doesn't support run_on_host_intel tasks. " +
2677-
detail::codeToString(Error));
2678-
case PI_SUCCESS:
2679-
return Error;
2680-
default:
2681-
throw sycl::exception(sycl::make_error_code(sycl::errc::runtime),
2682-
"Enqueueing run_on_host_intel task has failed. " +
2683-
detail::codeToString(Error));
2684-
}
2685-
}
26862597
case CG::CGTYPE::Kernel: {
26872598
CGExecKernel *ExecKernel = (CGExecKernel *)MCommandGroup.get();
26882599

sycl/source/handler.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,7 @@ event handler::finalize() {
273273

274274
std::unique_ptr<detail::CG> CommandGroup;
275275
switch (type) {
276-
case detail::CG::Kernel:
277-
case detail::CG::RunOnHostIntel: {
276+
case detail::CG::Kernel: {
278277
// Copy kernel name here instead of move so that it's available after
279278
// running of this method by reductions implementation. This allows for
280279
// assert feature to check if kernel uses assertions

sycl/test-e2e/Basic/handler/run_on_host_intel.cpp

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)