Skip to content

Commit

Permalink
[SYCL][UR] Bump UR version and add missing values to pi2ur (intel#10049)
Browse files Browse the repository at this point in the history
Includes a large number of missing `pi_result` mappings, so previously
reported errors should no longer map to just `PI_ERROR_UNKNOWN`. NFCI
for the adapters.
  • Loading branch information
callumfare authored Jun 26, 2023
1 parent 67082ae commit a33bc20
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
12 changes: 6 additions & 6 deletions ur_level_zero_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWait(
ur_event_handle_t InternalEvent;
bool IsInternal = OutEvent == nullptr;
ur_event_handle_t *Event = OutEvent ? OutEvent : &InternalEvent;
UR_CALL(createEventAndAssociateQueue(Queue, Event, UR_EXT_COMMAND_TYPE_USER,
UR_CALL(createEventAndAssociateQueue(Queue, Event, UR_COMMAND_EVENTS_WAIT,
CommandList, IsInternal));

ZeEvent = (*Event)->ZeEvent;
Expand Down Expand Up @@ -98,10 +98,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWait(
std::scoped_lock<ur_shared_mutex> lock(Queue->Mutex);

if (OutEvent) {
UR_CALL(createEventAndAssociateQueue(Queue, OutEvent,
UR_EXT_COMMAND_TYPE_USER,
Queue->CommandListMap.end(),
/* IsInternal */ false));
UR_CALL(createEventAndAssociateQueue(
Queue, OutEvent, UR_COMMAND_EVENTS_WAIT, Queue->CommandListMap.end(),
/* IsInternal */ false));
}

Queue->synchronize();
Expand Down Expand Up @@ -161,7 +160,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier(
}

UR_CALL(createEventAndAssociateQueue(
Queue, &Event, UR_EXT_COMMAND_TYPE_USER, CmdList, IsInternal));
Queue, &Event, UR_COMMAND_EVENTS_WAIT_WITH_BARRIER, CmdList,
IsInternal));

Event->WaitList = EventWaitList;

Expand Down
35 changes: 26 additions & 9 deletions ur_level_zero_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgValue(
ur_kernel_handle_t Kernel, ///< [in] handle of the kernel object
uint32_t ArgIndex, ///< [in] argument index in range [0, num args - 1]
size_t ArgSize, ///< [in] size of argument type
const ur_kernel_arg_value_properties_t
*Properties, ///< [in][optional] argument properties
const void
*PArgValue ///< [in] argument value represented as matching arg type.
) {
std::ignore = Properties;

// OpenCL: "the arg_value pointer can be NULL or point to a NULL value
// in which case a NULL value will be used as the value for the argument
// declared as a pointer to global or constant memory in the kernel"
Expand All @@ -410,11 +414,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgValue(
UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgLocal(
ur_kernel_handle_t Kernel, ///< [in] handle of the kernel object
uint32_t ArgIndex, ///< [in] argument index in range [0, num args - 1]
size_t ArgSize ///< [in] size of the local buffer to be allocated by the
size_t ArgSize, ///< [in] size of the local buffer to be allocated by the
///< runtime
const ur_kernel_arg_local_properties_t
*Properties ///< [in][optional] argument properties
) {
std::ignore = Kernel;
std::ignore = ArgIndex;
std::ignore = Properties;
std::ignore = ArgSize;
urPrint("[UR][L0] %s function not implemented!\n", __FUNCTION__);
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
Expand Down Expand Up @@ -603,24 +610,31 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelRelease(

UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgPointer(
ur_kernel_handle_t Kernel, ///< [in] handle of the kernel object
uint32_t ArgIndex, ///< [in] argument index in range [0, num args - 1]
uint32_t ArgIndex, ///< [in] argument index in range [0, num args - 1]
const ur_kernel_arg_pointer_properties_t
*Properties, ///< [in][optional] argument properties
const void *ArgValue ///< [in][optional] SVM pointer to memory location
///< holding the argument value. If null then argument
///< value is considered null.
) {
UR_CALL(
urKernelSetArgValue(Kernel, ArgIndex, sizeof(const void *), ArgValue));
std::ignore = Properties;

UR_CALL(urKernelSetArgValue(Kernel, ArgIndex, sizeof(const void *), nullptr,
ArgValue));
return UR_RESULT_SUCCESS;
}

UR_APIEXPORT ur_result_t UR_APICALL urKernelSetExecInfo(
ur_kernel_handle_t Kernel, ///< [in] handle of the kernel object
ur_kernel_exec_info_t PropName, ///< [in] name of the execution attribute
size_t PropSize, ///< [in] size in byte the attribute value
const ur_kernel_exec_info_properties_t
*Properties, ///< [in][optional] pointer to execution info properties
const void *PropValue ///< [in][range(0, propSize)] pointer to memory
///< location holding the property value.
) {
std::ignore = PropSize;
std::ignore = Properties;

std::scoped_lock<ur_shared_mutex> Guard(Kernel->Mutex);
if (PropName == UR_KERNEL_EXEC_INFO_USM_INDIRECT_ACCESS &&
Expand All @@ -633,15 +647,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelSetExecInfo(
ZE_KERNEL_INDIRECT_ACCESS_FLAG_DEVICE |
ZE_KERNEL_INDIRECT_ACCESS_FLAG_SHARED;
ZE2UR_CALL(zeKernelSetIndirectAccess, (Kernel->ZeKernel, IndirectFlags));
} else if (PropName == UR_EXT_KERNEL_EXEC_INFO_CACHE_CONFIG) {
} else if (PropName == UR_KERNEL_EXEC_INFO_CACHE_CONFIG) {
ze_cache_config_flag_t ZeCacheConfig{};
auto CacheConfig =
*(static_cast<const ur_kernel_cache_config *>(PropValue));
if (CacheConfig == UR_EXT_KERNEL_EXEC_INFO_CACHE_LARGE_SLM)
*(static_cast<const ur_kernel_cache_config_t *>(PropValue));
if (CacheConfig == UR_KERNEL_CACHE_CONFIG_LARGE_SLM)
ZeCacheConfig = ZE_CACHE_CONFIG_FLAG_LARGE_SLM;
else if (CacheConfig == UR_EXT_KERNEL_EXEC_INFO_CACHE_LARGE_DATA)
else if (CacheConfig == UR_KERNEL_CACHE_CONFIG_LARGE_DATA)
ZeCacheConfig = ZE_CACHE_CONFIG_FLAG_LARGE_DATA;
else if (CacheConfig == UR_EXT_KERNEL_EXEC_INFO_CACHE_DEFAULT)
else if (CacheConfig == UR_KERNEL_CACHE_CONFIG_DEFAULT)
ZeCacheConfig = static_cast<ze_cache_config_flag_t>(0);
else
// Unexpected cache configuration value.
Expand All @@ -658,8 +672,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelSetExecInfo(
UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgSampler(
ur_kernel_handle_t Kernel, ///< [in] handle of the kernel object
uint32_t ArgIndex, ///< [in] argument index in range [0, num args - 1]
const ur_kernel_arg_sampler_properties_t
*Properties, ///< [in][optional] argument properties
ur_sampler_handle_t ArgValue ///< [in] handle of Sampler object.
) {
std::ignore = Properties;
std::scoped_lock<ur_shared_mutex> Guard(Kernel->Mutex);
ZE2UR_CALL(zeKernelSetArgumentValue, (Kernel->ZeKernel, ArgIndex,
sizeof(void *), &ArgValue->ZeSampler));
Expand Down
4 changes: 2 additions & 2 deletions ur_level_zero_mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMPrefetch(
ur_event_handle_t InternalEvent;
bool IsInternal = OutEvent == nullptr;
ur_event_handle_t *Event = OutEvent ? OutEvent : &InternalEvent;
UR_CALL(createEventAndAssociateQueue(Queue, Event, UR_EXT_COMMAND_TYPE_USER,
UR_CALL(createEventAndAssociateQueue(Queue, Event, UR_COMMAND_USM_PREFETCH,
CommandList, IsInternal));
ZeEvent = (*Event)->ZeEvent;
(*Event)->WaitList = TmpWaitList;
Expand Down Expand Up @@ -1320,7 +1320,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMAdvise(
ur_event_handle_t InternalEvent{};
bool IsInternal = OutEvent == nullptr;
ur_event_handle_t *Event = OutEvent ? OutEvent : &InternalEvent;
UR_CALL(createEventAndAssociateQueue(Queue, Event, UR_EXT_COMMAND_TYPE_USER,
UR_CALL(createEventAndAssociateQueue(Queue, Event, UR_COMMAND_USM_ADVISE,
CommandList, IsInternal));
ZeEvent = (*Event)->ZeEvent;
(*Event)->WaitList = TmpWaitList;
Expand Down

0 comments on commit a33bc20

Please sign in to comment.