18 if (urResult == UR_RESULT_SUCCESS)
22 case UR_RESULT_ERROR_INVALID_OPERATION:
23 return PI_ERROR_INVALID_OPERATION;
24 case UR_RESULT_ERROR_INVALID_QUEUE_PROPERTIES:
25 return PI_ERROR_INVALID_QUEUE_PROPERTIES;
26 case UR_RESULT_ERROR_INVALID_QUEUE:
27 return PI_ERROR_INVALID_QUEUE;
28 case UR_RESULT_ERROR_INVALID_VALUE:
29 return PI_ERROR_INVALID_VALUE;
30 case UR_RESULT_ERROR_INVALID_CONTEXT:
31 return PI_ERROR_INVALID_CONTEXT;
32 case UR_RESULT_ERROR_INVALID_PLATFORM:
33 return PI_ERROR_INVALID_PLATFORM;
34 case UR_RESULT_ERROR_INVALID_BINARY:
35 return PI_ERROR_INVALID_BINARY;
36 case UR_RESULT_ERROR_INVALID_PROGRAM:
37 return PI_ERROR_INVALID_PROGRAM;
38 case UR_RESULT_ERROR_INVALID_SAMPLER:
39 return PI_ERROR_INVALID_SAMPLER;
40 case UR_RESULT_ERROR_INVALID_MEM_OBJECT:
41 return PI_ERROR_INVALID_MEM_OBJECT;
42 case UR_RESULT_ERROR_INVALID_EVENT:
43 return PI_ERROR_INVALID_EVENT;
44 case UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST:
45 return PI_ERROR_INVALID_EVENT_WAIT_LIST;
46 case UR_RESULT_ERROR_MISALIGNED_SUB_BUFFER_OFFSET:
47 return PI_ERROR_MISALIGNED_SUB_BUFFER_OFFSET;
48 case UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE:
49 return PI_ERROR_INVALID_WORK_GROUP_SIZE;
50 case UR_RESULT_ERROR_COMPILER_NOT_AVAILABLE:
51 return PI_ERROR_COMPILER_NOT_AVAILABLE;
52 case UR_RESULT_ERROR_PROFILING_INFO_NOT_AVAILABLE:
53 return PI_ERROR_PROFILING_INFO_NOT_AVAILABLE;
54 case UR_RESULT_ERROR_DEVICE_NOT_FOUND:
55 return PI_ERROR_DEVICE_NOT_FOUND;
56 case UR_RESULT_ERROR_INVALID_DEVICE:
57 return PI_ERROR_INVALID_DEVICE;
58 case UR_RESULT_ERROR_DEVICE_REQUIRES_RESET:
59 case UR_RESULT_ERROR_DEVICE_LOST:
60 case UR_RESULT_ERROR_DEVICE_NOT_AVAILABLE:
61 return PI_ERROR_DEVICE_NOT_AVAILABLE;
62 case UR_RESULT_ERROR_DEVICE_PARTITION_FAILED:
63 return PI_ERROR_DEVICE_PARTITION_FAILED;
64 case UR_RESULT_ERROR_INVALID_DEVICE_PARTITION_COUNT:
65 return PI_ERROR_INVALID_DEVICE_PARTITION_COUNT;
66 case UR_RESULT_ERROR_INVALID_WORK_ITEM_SIZE:
67 return PI_ERROR_INVALID_WORK_ITEM_SIZE;
68 case UR_RESULT_ERROR_INVALID_WORK_DIMENSION:
69 return PI_ERROR_INVALID_WORK_DIMENSION;
70 case UR_RESULT_ERROR_INVALID_KERNEL_ARGS:
71 return PI_ERROR_INVALID_KERNEL_ARGS;
72 case UR_RESULT_ERROR_INVALID_KERNEL:
73 return PI_ERROR_INVALID_KERNEL;
74 case UR_RESULT_ERROR_INVALID_KERNEL_NAME:
75 return PI_ERROR_INVALID_KERNEL_NAME;
76 case UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX:
77 return PI_ERROR_INVALID_ARG_INDEX;
78 case UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE:
79 return PI_ERROR_INVALID_ARG_SIZE;
80 case UR_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE:
81 return PI_ERROR_INVALID_VALUE;
82 case UR_RESULT_ERROR_INVALID_IMAGE_SIZE:
83 return PI_ERROR_INVALID_IMAGE_SIZE;
84 case UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR:
85 return PI_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR;
86 case UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED:
87 return PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED;
88 case UR_RESULT_ERROR_MEM_OBJECT_ALLOCATION_FAILURE:
89 return PI_ERROR_MEM_OBJECT_ALLOCATION_FAILURE;
90 case UR_RESULT_ERROR_INVALID_PROGRAM_EXECUTABLE:
91 return PI_ERROR_INVALID_PROGRAM_EXECUTABLE;
92 case UR_RESULT_ERROR_UNINITIALIZED:
93 return PI_ERROR_UNINITIALIZED;
94 case UR_RESULT_ERROR_OUT_OF_HOST_MEMORY:
95 return PI_ERROR_OUT_OF_HOST_MEMORY;
96 case UR_RESULT_ERROR_OUT_OF_DEVICE_MEMORY:
97 case UR_RESULT_ERROR_OUT_OF_RESOURCES:
98 return PI_ERROR_OUT_OF_RESOURCES;
99 case UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE:
100 return PI_ERROR_BUILD_PROGRAM_FAILURE;
101 case UR_RESULT_ERROR_PROGRAM_LINK_FAILURE:
102 return PI_ERROR_LINK_PROGRAM_FAILURE;
103 case UR_RESULT_ERROR_UNSUPPORTED_VERSION:
104 return PI_ERROR_INVALID_OPERATION;
105 case UR_RESULT_ERROR_UNSUPPORTED_FEATURE:
106 return PI_ERROR_UNSUPPORTED_FEATURE;
107 case UR_RESULT_ERROR_INVALID_ARGUMENT:
108 case UR_RESULT_ERROR_INVALID_NULL_HANDLE:
109 case UR_RESULT_ERROR_HANDLE_OBJECT_IN_USE:
110 case UR_RESULT_ERROR_INVALID_NULL_POINTER:
111 return PI_ERROR_INVALID_VALUE;
112 case UR_RESULT_ERROR_INVALID_SIZE:
113 case UR_RESULT_ERROR_UNSUPPORTED_SIZE:
114 return PI_ERROR_INVALID_BUFFER_SIZE;
115 case UR_RESULT_ERROR_UNSUPPORTED_ALIGNMENT:
116 return PI_ERROR_INVALID_VALUE;
117 case UR_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT:
118 case UR_RESULT_ERROR_INVALID_ENUMERATION:
119 case UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION:
120 return PI_ERROR_INVALID_VALUE;
121 case UR_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT:
122 return PI_ERROR_IMAGE_FORMAT_NOT_SUPPORTED;
123 case UR_RESULT_ERROR_INVALID_NATIVE_BINARY:
124 return PI_ERROR_INVALID_BINARY;
125 case UR_RESULT_ERROR_INVALID_GLOBAL_NAME:
126 return PI_ERROR_INVALID_VALUE;
127 case UR_RESULT_ERROR_INVALID_FUNCTION_NAME:
128 return PI_ERROR_FUNCTION_ADDRESS_IS_NOT_AVAILABLE;
129 case UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION:
130 return PI_ERROR_INVALID_WORK_DIMENSION;
131 case UR_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION:
132 return PI_ERROR_INVALID_VALUE;
133 case UR_RESULT_ERROR_PROGRAM_UNLINKED:
134 return PI_ERROR_INVALID_PROGRAM_EXECUTABLE;
135 case UR_RESULT_ERROR_OVERLAPPING_REGIONS:
136 return PI_ERROR_MEM_COPY_OVERLAP;
137 case UR_RESULT_ERROR_INVALID_HOST_PTR:
138 return PI_ERROR_INVALID_HOST_PTR;
139 case UR_RESULT_ERROR_INVALID_USM_SIZE:
140 return PI_ERROR_INVALID_BUFFER_SIZE;
141 case UR_RESULT_ERROR_OBJECT_ALLOCATION_FAILURE:
142 return PI_ERROR_OUT_OF_RESOURCES;
143 case UR_RESULT_ERROR_ADAPTER_SPECIFIC:
144 return PI_ERROR_PLUGIN_SPECIFIC_ERROR;
145 case UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP:
146 return PI_ERROR_INVALID_COMMAND_BUFFER_KHR;
147 case UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP:
148 return PI_ERROR_INVALID_SYNC_POINT_WAIT_LIST_KHR;
149 case UR_RESULT_ERROR_IN_EVENT_LIST_EXEC_STATUS:
150 return PI_ERROR_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST;
151 case UR_RESULT_ERROR_UNKNOWN:
153 return PI_ERROR_UNKNOWN;
158 #define PI_ASSERT(condition, error) \
163 #define HANDLE_ERRORS(urCall) \
164 if (auto Result = urCall) \
165 return ur2piResult(Result);
170 using UrReturnHelper::UrReturnHelper;
181 return ur2piResult(UrReturnHelper::operator()<RetType>(
t, s));
187 using ReturnHelper::ReturnHelper;
191 template <
typename TypeUR,
typename TypePI>
193 *param_value_size_ret =
sizeof(TypePI);
199 auto pValueUR =
static_cast<TypeUR *
>(param_value);
200 auto pValuePI =
static_cast<TypePI *
>(param_value);
203 PI_ASSERT(
sizeof(TypePI) >=
sizeof(TypeUR), PI_ERROR_UNKNOWN);
205 *pValuePI = Func(*pValueUR);
210 template <
typename TypeUR,
typename TypePI>
213 PI_ASSERT(
sizeof(TypePI) >=
sizeof(TypeUR), PI_ERROR_UNKNOWN);
215 const uint32_t NumberElements =
216 *param_value_size_ret /
sizeof(ur_device_partition_t);
218 *param_value_size_ret *=
sizeof(TypePI) /
sizeof(TypeUR);
224 PI_ASSERT(*param_value_size_ret %
sizeof(TypePI) == 0, PI_ERROR_UNKNOWN);
228 auto ValueUR =
new char[*param_value_size_ret];
229 auto pValueUR =
reinterpret_cast<TypeUR *
>(ValueUR);
230 auto pValuePI =
static_cast<TypePI *
>(param_value);
231 memcpy(pValueUR, param_value, *param_value_size_ret);
233 for (uint32_t I = 0; I < NumberElements; ++I) {
234 *pValuePI = Func(*pValueUR);
244 template <
typename TypeUR,
typename TypePI>
250 auto pValuePI =
static_cast<TypePI *
>(param_value);
251 auto pValueUR =
static_cast<TypeUR *
>(param_value);
254 PI_ASSERT(
sizeof(TypeUR) <=
sizeof(
size_t), PI_ERROR_UNKNOWN);
255 size_t In = *pValueUR;
259 while ((Val = In & -In)) {
263 *pValueUR = TypeUR(Val);
268 *pValuePI = TypePI(Out);
275 size_t *ParamValueSizeRetPI,
276 size_t ParamValueSize,
void *ParamValue) {
277 if (ParamValueSizeRetUR == 1 && ParamValueSize == 4) {
280 auto *ValIn =
static_cast<bool *
>(ParamValue);
281 auto *ValOut =
static_cast<pi_bool *
>(ParamValue);
282 *ValOut =
static_cast<pi_bool>(*ValIn);
284 if (ParamValueSizeRetPI) {
285 *ParamValueSizeRetPI =
sizeof(
pi_bool);
292 size_t ParamValueSizePI,
293 size_t *ParamValueSizeUR,
296 ConvertHelper Value(ParamValueSizePI, ParamValue, ParamValueSizeUR);
299 case UR_PLATFORM_INFO_EXTENSIONS:
300 case UR_PLATFORM_INFO_NAME:
301 case UR_PLATFORM_INFO_PROFILE:
302 case UR_PLATFORM_INFO_VENDOR_NAME:
303 case UR_PLATFORM_INFO_VERSION:
306 case UR_PLATFORM_INFO_BACKEND: {
307 auto ConvertFunc = [](ur_platform_backend_t UrValue) {
309 case UR_PLATFORM_BACKEND_UNKNOWN:
311 case UR_PLATFORM_BACKEND_LEVEL_ZERO:
313 case UR_PLATFORM_BACKEND_OPENCL:
315 case UR_PLATFORM_BACKEND_CUDA:
317 case UR_PLATFORM_BACKEND_HIP:
319 case UR_PLATFORM_BACKEND_NATIVE_CPU:
322 die(
"UR_PLATFORM_INFO_BACKEND: unhandled value");
329 return PI_ERROR_UNKNOWN;
332 if (ParamValueSizePI && ParamValueSizePI != *ParamValueSizeUR) {
333 fprintf(stderr,
"UR PlatformInfoType=%d PI=%d but UR=%d\n", ParamName,
334 (
int)ParamValueSizePI, (
int)*ParamValueSizeUR);
335 die(
"ur2piPlatformInfoValue: size mismatch");
350 size_t ParamValueSize,
void *ParamValue,
351 size_t *ParamValueSizeRet) {
354 ConvertHelper Value(ParamValueSize, ParamValue, ParamValueSizeRet);
357 if (ParamName == UR_DEVICE_INFO_TYPE) {
358 auto ConvertFunc = [](ur_device_type_t UrValue) {
360 case UR_DEVICE_TYPE_CPU:
362 case UR_DEVICE_TYPE_GPU:
364 case UR_DEVICE_TYPE_FPGA:
367 die(
"UR_DEVICE_INFO_TYPE: unhandled value");
371 }
else if (ParamName == UR_DEVICE_INFO_QUEUE_PROPERTIES) {
372 auto ConvertFunc = [](ur_queue_flag_t UrValue) {
374 case UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE:
376 case UR_QUEUE_FLAG_PROFILING_ENABLE:
378 case UR_QUEUE_FLAG_ON_DEVICE:
380 case UR_QUEUE_FLAG_ON_DEVICE_DEFAULT:
382 case UR_QUEUE_FLAG_SYNC_WITH_DEFAULT_STREAM:
384 case UR_QUEUE_FLAG_USE_DEFAULT_STREAM:
387 die(
"UR_DEVICE_INFO_QUEUE_PROPERTIES: unhandled value");
392 }
else if (ParamName == UR_DEVICE_INFO_EXECUTION_CAPABILITIES) {
393 auto ConvertFunc = [](ur_device_exec_capability_flag_t UrValue) {
395 case UR_DEVICE_EXEC_CAPABILITY_FLAG_KERNEL:
397 case UR_DEVICE_EXEC_CAPABILITY_FLAG_NATIVE_KERNEL:
400 die(
"UR_DEVICE_INFO_EXECUTION_CAPABILITIES: unhandled value");
406 }
else if (ParamName == UR_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN) {
407 auto ConvertFunc = [](ur_device_affinity_domain_flag_t UrValue) {
409 case UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA:
411 case UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE:
414 die(
"UR_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN: unhandled value");
419 }
else if (ParamName == UR_DEVICE_INFO_PARTITION_TYPE) {
421 auto ConvertFunc = [](ur_device_partition_t UrValue) {
422 switch (
static_cast<uint32_t
>(UrValue)) {
423 case UR_DEVICE_PARTITION_EQUALLY:
425 case UR_DEVICE_PARTITION_BY_COUNTS:
427 case UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN:
429 case UR_DEVICE_PARTITION_BY_CSLICE:
432 die(
"UR_DEVICE_INFO_PARTITION_TYPE: unhandled value");
445 sizeof(ur_device_partition_property_t),
448 const uint32_t UrNumberElements =
449 *ParamValueSizeRet /
sizeof(ur_device_partition_property_t);
452 auto ParamValueCopy =
453 std::make_unique<ur_device_partition_property_t[]>(UrNumberElements);
454 std::memcpy(ParamValueCopy.get(), ParamValue,
455 UrNumberElements *
sizeof(ur_device_partition_property_t));
458 ur_device_partition_property_t *pValueUR =
459 reinterpret_cast<ur_device_partition_property_t *
>(
460 ParamValueCopy.get());
461 const ur_device_partition_t Type = pValueUR->type;
462 *pValuePI = ConvertFunc(Type);
465 for (uint32_t i = 0; i < UrNumberElements; ++i) {
466 switch (pValueUR->type) {
467 case UR_DEVICE_PARTITION_EQUALLY: {
468 *pValuePI = pValueUR->value.equally;
471 case UR_DEVICE_PARTITION_BY_COUNTS: {
472 *pValuePI = pValueUR->value.count;
475 case UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN: {
476 *pValuePI = pValueUR->value.affinity_domain;
479 case UR_DEVICE_PARTITION_BY_CSLICE: {
484 die(
"UR_DEVICE_INFO_PARTITION_TYPE query returned unsupported type");
492 if (ParamValueSizeRet && *ParamValueSizeRet != 0) {
500 else if (ParamName == UR_DEVICE_INFO_SUPPORTED_PARTITIONS) {
501 auto ConvertFunc = [](ur_device_partition_t UrValue) {
502 switch (
static_cast<uint32_t
>(UrValue)) {
503 case UR_DEVICE_PARTITION_EQUALLY:
505 case UR_DEVICE_PARTITION_BY_COUNTS:
507 case UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN:
509 case UR_DEVICE_PARTITION_BY_CSLICE:
512 die(
"UR_DEVICE_INFO_SUPPORTED_PARTITIONS: unhandled value");
520 const uint32_t NumberElements =
523 ParamValue)[NumberElements] = 0;
526 if (ParamValueSizeRet && *ParamValueSizeRet != 0) {
530 }
else if (ParamName == UR_DEVICE_INFO_LOCAL_MEM_TYPE) {
531 auto ConvertFunc = [](ur_device_local_mem_type_t UrValue) {
533 case UR_DEVICE_LOCAL_MEM_TYPE_LOCAL:
535 case UR_DEVICE_LOCAL_MEM_TYPE_GLOBAL:
538 die(
"UR_DEVICE_INFO_LOCAL_MEM_TYPE: unhandled value");
543 }
else if (ParamName == UR_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES ||
544 ParamName == UR_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES) {
545 auto ConvertFunc = [](ur_memory_order_capability_flag_t UrValue) {
547 case UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED:
549 case UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE:
551 case UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE:
553 case UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL:
555 case UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST:
558 die(
"UR_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES: unhandled "
562 return Value.
convertBitSet<ur_memory_order_capability_flag_t,
564 }
else if (ParamName == UR_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES ||
565 ParamName == UR_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES) {
566 auto ConvertFunc = [](ur_memory_scope_capability_flag_t UrValue) {
568 case UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM:
570 case UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP:
572 case UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP:
574 case UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE:
576 case UR_MEMORY_SCOPE_CAPABILITY_FLAG_SYSTEM:
579 die(
"UR_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES: unhandled "
583 return Value.
convertBitSet<ur_memory_scope_capability_flag_t,
585 }
else if (*ParamValueSizeRet == 1 && ParamValueSize == 4) {
592 }
else if (ParamName == UR_DEVICE_INFO_QUEUE_PROPERTIES ||
593 ParamName == UR_DEVICE_INFO_QUEUE_ON_DEVICE_PROPERTIES ||
594 ParamName == UR_DEVICE_INFO_QUEUE_ON_HOST_PROPERTIES ||
595 ParamName == UR_DEVICE_INFO_EXECUTION_CAPABILITIES ||
596 ParamName == UR_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN ||
597 ParamName == UR_DEVICE_INFO_USM_HOST_SUPPORT ||
598 ParamName == UR_DEVICE_INFO_USM_DEVICE_SUPPORT ||
599 ParamName == UR_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT ||
600 ParamName == UR_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT ||
601 ParamName == UR_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT) {
607 }
else if (ParamName == UR_DEVICE_INFO_SINGLE_FP_CONFIG ||
608 ParamName == UR_DEVICE_INFO_HALF_FP_CONFIG ||
609 ParamName == UR_DEVICE_INFO_DOUBLE_FP_CONFIG) {
615 }
else if (ParamName == UR_DEVICE_INFO_COMPONENT_DEVICES) {
616 if (ParamValueSizeRet && *ParamValueSizeRet != 0) {
617 const uint32_t UrNumberElements =
618 *ParamValueSizeRet /
sizeof(ur_device_handle_t);
619 *ParamValueSizeRet = UrNumberElements *
sizeof(
pi_device);
626 if (ParamValueSize && ParamValueSizeRet &&
627 ParamValueSize != *ParamValueSizeRet) {
628 fprintf(stderr,
"UR DeviceInfoType=%d PI=%d but UR=%d\n", ParamName,
629 (
int)ParamValueSize, (
int)*ParamValueSizeRet);
630 die(
"ur2piDeviceInfoValue: size mismatch");
636 size_t ParamValueSizePI,
637 size_t *ParamValueSizeUR,
640 ConvertHelper Value(ParamValueSizePI, ParamValue, ParamValueSizeUR);
642 case UR_SAMPLER_INFO_ADDRESSING_MODE: {
643 auto ConvertFunc = [](ur_sampler_addressing_mode_t UrValue) {
645 case UR_SAMPLER_ADDRESSING_MODE_CLAMP:
647 case UR_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE:
649 case UR_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT:
651 case UR_SAMPLER_ADDRESSING_MODE_NONE:
653 case UR_SAMPLER_ADDRESSING_MODE_REPEAT:
657 die(
"UR_SAMPLER_ADDRESSING_MODE_TYPE: unhandled value");
664 case UR_SAMPLER_INFO_FILTER_MODE: {
665 auto ConvertFunc = [](ur_sampler_filter_mode_t UrValue) {
667 case UR_SAMPLER_FILTER_MODE_LINEAR:
669 case UR_SAMPLER_FILTER_MODE_NEAREST:
672 die(
"UR_SAMPLER_FILTER_MODE: unhandled value");
685 size_t ParamValueSizePI,
686 size_t *ParamValueSizeUR,
688 ConvertHelper Value(ParamValueSizePI, ParamValue, ParamValueSizeUR);
690 if (ParamName == UR_USM_ALLOC_INFO_TYPE) {
691 auto ConvertFunc = [](ur_usm_type_t UrValue) {
693 case UR_USM_TYPE_UNKNOWN:
695 case UR_USM_TYPE_HOST:
697 case UR_USM_TYPE_DEVICE:
699 case UR_USM_TYPE_SHARED:
702 die(
"UR_USM_ALLOC_INFO_TYPE: unhandled value");
713 size_t ParamValueSizePI,
714 size_t *ParamValueSizeUR,
716 ConvertHelper Value(ParamValueSizePI, ParamValue, ParamValueSizeUR);
718 if (ParamName == UR_PROGRAM_BUILD_INFO_BINARY_TYPE) {
719 auto ConvertFunc = [](ur_program_binary_type_t UrValue) {
721 case UR_PROGRAM_BINARY_TYPE_NONE:
723 case UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT:
725 case UR_PROGRAM_BINARY_TYPE_LIBRARY:
727 case UR_PROGRAM_BINARY_TYPE_EXECUTABLE:
730 die(
"ur_program_binary_type_t: unhandled value");
737 if (ParamName == UR_PROGRAM_BUILD_INFO_STATUS) {
738 auto ConvertFunc = [](ur_program_build_status_t UrValue) {
740 case UR_PROGRAM_BUILD_STATUS_NONE:
742 case UR_PROGRAM_BUILD_STATUS_ERROR:
744 case UR_PROGRAM_BUILD_STATUS_SUCCESS:
746 case UR_PROGRAM_BUILD_STATUS_IN_PROGRESS:
749 die(
"ur_program_build_status_t: unhandled value");
761 ur_program_metadata_t *ur_metadata) {
762 ur_metadata->pName = (*pi_metadata)->Name;
763 ur_metadata->size = (*pi_metadata)->ValSize;
764 switch ((*pi_metadata)->Type) {
766 ur_metadata->type = UR_PROGRAM_METADATA_TYPE_UINT32;
767 ur_metadata->value.data32 = (*pi_metadata)->ValSize;
768 return UR_RESULT_SUCCESS;
770 ur_metadata->type = UR_PROGRAM_METADATA_TYPE_BYTE_ARRAY;
771 ur_metadata->value.pData = (*pi_metadata)->ValAddr;
772 return UR_RESULT_SUCCESS;
774 ur_metadata->type = UR_PROGRAM_METADATA_TYPE_STRING;
775 ur_metadata->value.pString =
776 reinterpret_cast<char *
>((*pi_metadata)->ValAddr);
777 return UR_RESULT_SUCCESS;
779 return UR_RESULT_ERROR_INVALID_VALUE;
786 bool *pluginTeardown =
static_cast<bool *
>(PluginParameter);
787 *pluginTeardown =
true;
792 static std::once_flag AdapterReleaseFlag;
793 ur_adapter_handle_t Adapter;
794 ur_result_t Ret = UR_RESULT_SUCCESS;
795 std::call_once(AdapterReleaseFlag, [&]() {
796 Ret = urAdapterGet(1, &Adapter,
nullptr);
797 if (Ret == UR_RESULT_SUCCESS) {
798 Ret = urAdapterRelease(Adapter);
799 Ret = urAdapterRelease(Adapter);
811 static ur_adapter_handle_t Adapter;
812 static std::once_flag AdapterGetFlag;
813 ur_result_t Ret = UR_RESULT_SUCCESS;
814 std::call_once(AdapterGetFlag,
815 [&Ret]() { Ret = urAdapterGet(1, &Adapter,
nullptr); });
827 ur_adapter_handle_t adapter =
nullptr;
828 if (
auto res =
PiGetAdapter(adapter); res != PI_SUCCESS) {
832 auto phPlatforms =
reinterpret_cast<ur_platform_handle_t *
>(Platforms);
834 urPlatformGet(&adapter, 1, NumEntries, phPlatforms, NumPlatforms));
841 PI_ASSERT(Platform, PI_ERROR_INVALID_PLATFORM);
842 PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);
844 auto UrPlatform =
reinterpret_cast<ur_platform_handle_t
>(Platform);
846 ur_native_handle_t UrNativeHandle{};
847 HANDLE_ERRORS(urPlatformGetNativeHandle(UrPlatform, &UrNativeHandle));
858 PI_ASSERT(Platform, PI_ERROR_INVALID_PLATFORM);
859 PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);
861 ur_adapter_handle_t adapter =
nullptr;
862 if (
auto res =
PiGetAdapter(adapter); res != PI_SUCCESS) {
867 ur_platform_handle_t UrPlatform{};
868 ur_native_handle_t UrNativeHandle =
869 reinterpret_cast<ur_native_handle_t
>(NativeHandle);
870 ur_platform_native_properties_t UrProperties{};
871 urPlatformCreateWithNativeHandle(UrNativeHandle, &UrProperties, &UrPlatform);
873 *Platform =
reinterpret_cast<pi_platform>(UrPlatform);
880 size_t ParamValueSize,
void *ParamValue,
881 size_t *ParamValueSizeRet) {
883 PI_ASSERT(Platform, PI_ERROR_INVALID_PLATFORM);
885 ur_platform_info_t UrParamName = {};
888 UrParamName = UR_PLATFORM_INFO_EXTENSIONS;
892 UrParamName = UR_PLATFORM_INFO_NAME;
896 UrParamName = UR_PLATFORM_INFO_PROFILE;
900 UrParamName = UR_PLATFORM_INFO_VENDOR_NAME;
904 UrParamName = UR_PLATFORM_INFO_VERSION;
908 UrParamName = UR_PLATFORM_INFO_BACKEND;
912 die(
"urGetContextInfo: unsuppported ParamName.");
915 size_t UrParamValueSizeRet;
916 auto UrPlatform =
reinterpret_cast<ur_platform_handle_t
>(Platform);
917 HANDLE_ERRORS(urPlatformGetInfo(UrPlatform, UrParamName, ParamValueSize,
918 ParamValue, &UrParamValueSizeRet));
920 if (ParamValueSizeRet) {
921 *ParamValueSizeRet = UrParamValueSizeRet;
932 void **opaque_data_return) {
933 (void)opaque_data_param;
934 (void)opaque_data_return;
935 return PI_ERROR_UNKNOWN;
939 const char *FrontendOption,
940 const char **PlatformOption) {
942 auto UrPlatform =
reinterpret_cast<ur_platform_handle_t
>(Platform);
944 urPlatformGetBackendOption(UrPlatform, FrontendOption, PlatformOption));
957 ur_device_type_t Type;
958 switch (DeviceType) {
960 Type = UR_DEVICE_TYPE_ALL;
963 Type = UR_DEVICE_TYPE_GPU;
966 Type = UR_DEVICE_TYPE_CPU;
969 Type = UR_DEVICE_TYPE_FPGA;
972 return PI_ERROR_UNKNOWN;
975 PI_ASSERT(Platform, PI_ERROR_INVALID_PLATFORM);
977 auto UrPlatform =
reinterpret_cast<ur_platform_handle_t
>(Platform);
978 auto UrDevices =
reinterpret_cast<ur_device_handle_t *
>(Devices);
980 urDeviceGet(UrPlatform, Type, NumEntries, UrDevices, NumDevices));
986 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
987 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
993 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
995 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
1005 ur_adapter_handle_t Adapter;
1006 urAdapterGet(1, &Adapter,
nullptr);
1010 ur_result_t Res = urAdapterGetLastError(
1011 Adapter,
const_cast<const char **
>(Message), &ErrorCode);
1012 urAdapterRelease(Adapter);
1018 size_t ParamValueSize,
void *ParamValue,
1019 size_t *ParamValueSizeRet) {
1020 ur_device_info_t InfoType;
1021 switch (ParamName) {
1022 #define PI_TO_UR_MAP_DEVICE_INFO(FROM, TO) \
1029 UR_DEVICE_INFO_PARENT_DEVICE)
1035 UR_DEVICE_INFO_EXTENSIONS)
1038 UR_DEVICE_INFO_COMPILER_AVAILABLE)
1040 UR_DEVICE_INFO_LINKER_AVAILABLE)
1042 UR_DEVICE_INFO_MAX_COMPUTE_UNITS)
1044 UR_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS)
1046 UR_DEVICE_INFO_MAX_WORK_GROUP_SIZE)
1048 UR_DEVICE_INFO_MAX_WORK_ITEM_SIZES)
1050 UR_DEVICE_INFO_MAX_CLOCK_FREQUENCY)
1052 UR_DEVICE_INFO_ADDRESS_BITS)
1054 UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE)
1056 UR_DEVICE_INFO_GLOBAL_MEM_SIZE)
1058 UR_DEVICE_INFO_LOCAL_MEM_SIZE)
1060 UR_DEVICE_INFO_IMAGE_SUPPORTED)
1062 UR_DEVICE_INFO_HOST_UNIFIED_MEMORY)
1066 UR_DEVICE_INFO_DRIVER_VERSION)
1069 UR_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES)
1071 UR_DEVICE_INFO_REFERENCE_COUNT)
1073 UR_DEVICE_INFO_SUPPORTED_PARTITIONS)
1075 UR_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN)
1077 UR_DEVICE_INFO_PARTITION_TYPE)
1079 UR_EXT_DEVICE_INFO_OPENCL_C_VERSION)
1081 UR_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC)
1083 UR_DEVICE_INFO_PRINTF_BUFFER_SIZE)
1086 UR_DEVICE_INFO_BUILT_IN_KERNELS)
1088 UR_DEVICE_INFO_QUEUE_PROPERTIES)
1090 UR_DEVICE_INFO_EXECUTION_CAPABILITIES)
1092 UR_DEVICE_INFO_ENDIAN_LITTLE)
1094 UR_DEVICE_INFO_ERROR_CORRECTION_SUPPORT)
1096 UR_DEVICE_INFO_PROFILING_TIMER_RESOLUTION)
1098 UR_DEVICE_INFO_LOCAL_MEM_TYPE)
1100 UR_DEVICE_INFO_MAX_CONSTANT_ARGS)
1102 UR_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE)
1104 UR_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE)
1106 UR_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE)
1108 UR_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE)
1110 UR_DEVICE_INFO_MAX_PARAMETER_SIZE)
1112 UR_DEVICE_INFO_MEM_BASE_ADDR_ALIGN)
1114 UR_DEVICE_INFO_MAX_SAMPLERS)
1116 UR_DEVICE_INFO_MAX_READ_IMAGE_ARGS)
1118 UR_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS)
1120 UR_DEVICE_INFO_SINGLE_FP_CONFIG)
1122 UR_DEVICE_INFO_HALF_FP_CONFIG)
1124 UR_DEVICE_INFO_DOUBLE_FP_CONFIG)
1126 UR_DEVICE_INFO_IMAGE2D_MAX_WIDTH)
1128 UR_DEVICE_INFO_IMAGE2D_MAX_HEIGHT)
1130 UR_DEVICE_INFO_IMAGE3D_MAX_WIDTH)
1132 UR_DEVICE_INFO_IMAGE3D_MAX_HEIGHT)
1134 UR_DEVICE_INFO_IMAGE3D_MAX_DEPTH)
1136 UR_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE)
1138 UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR)
1140 UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR)
1142 UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT)
1144 UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT)
1146 UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT)
1148 UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT)
1150 UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG)
1152 UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG)
1154 UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT)
1156 UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT)
1158 UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE)
1160 UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE)
1162 UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF)
1164 UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF)
1166 UR_DEVICE_INFO_MAX_NUM_SUB_GROUPS)
1169 UR_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS)
1171 UR_DEVICE_INFO_SUB_GROUP_SIZES_INTEL)
1173 UR_DEVICE_INFO_IL_VERSION)
1175 UR_DEVICE_INFO_USM_HOST_SUPPORT)
1177 UR_DEVICE_INFO_USM_DEVICE_SUPPORT)
1179 UR_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT)
1181 UR_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT)
1183 UR_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT)
1185 UR_DEVICE_INFO_PCI_ADDRESS)
1187 UR_DEVICE_INFO_GPU_EU_COUNT)
1189 UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH)
1191 UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE)
1193 UR_DEVICE_INFO_IP_VERSION)
1195 UR_DEVICE_INFO_BUILD_ON_SUBDEVICE)
1197 UR_DEVICE_INFO_MAX_WORK_GROUPS_3D)
1199 UR_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE)
1202 UR_DEVICE_INFO_GLOBAL_MEM_FREE)
1204 UR_DEVICE_INFO_MEMORY_CLOCK_RATE)
1206 UR_DEVICE_INFO_MEMORY_BUS_WIDTH)
1208 UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES)
1210 UR_DEVICE_INFO_GPU_EU_SLICES)
1212 UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE)
1214 UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU)
1216 UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH)
1218 UR_DEVICE_INFO_BFLOAT16)
1221 UR_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES)
1224 UR_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES)
1226 UR_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES)
1228 UR_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES)
1230 UR_DEVICE_INFO_MEM_CHANNEL_SUPPORT)
1232 UR_DEVICE_INFO_IMAGE_SRGB)
1234 UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION)
1237 UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP)
1239 UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP)
1242 UR_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP)
1245 UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP)
1248 UR_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT_EXP)
1250 UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP)
1252 UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP)
1254 UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP)
1256 UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP)
1258 UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP)
1261 UR_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT_EXP)
1263 UR_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY_EXP)
1266 UR_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT_EXP)
1268 UR_DEVICE_INFO_CUBEMAP_SUPPORT_EXP)
1271 UR_DEVICE_INFO_CUBEMAP_SEAMLESS_FILTERING_SUPPORT_EXP)
1274 UR_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT_EXP)
1277 UR_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT_EXP)
1280 UR_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT_EXP)
1283 UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP)
1285 UR_DEVICE_INFO_ESIMD_SUPPORT)
1287 UR_DEVICE_INFO_COMPONENT_DEVICES)
1289 UR_DEVICE_INFO_COMPOSITE_DEVICE)
1291 UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP)
1294 UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_SUPPORT_EXP)
1295 #undef PI_TO_UR_MAP_DEVICE_INFO
1297 return PI_ERROR_UNKNOWN;
1300 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
1302 size_t ParamValueSizeRetUR;
1303 auto DeviceUR =
reinterpret_cast<ur_device_handle_t
>(Device);
1305 HANDLE_ERRORS(urDeviceGetInfo(DeviceUR, InfoType, ParamValueSize, ParamValue,
1306 &ParamValueSizeRetUR));
1309 &ParamValueSizeRetUR);
1311 if (ParamValueSizeRet) {
1312 *ParamValueSizeRet = ParamValueSizeRetUR;
1320 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
1321 PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);
1323 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
1325 ur_native_handle_t UrNativeHandle{};
1326 HANDLE_ERRORS(urDeviceGetNativeHandle(UrDevice, &UrNativeHandle));
1335 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
1336 PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);
1338 ur_adapter_handle_t adapter =
nullptr;
1339 if (
auto res =
PiGetAdapter(adapter); res != PI_SUCCESS) {
1344 ur_native_handle_t UrNativeDevice =
1345 reinterpret_cast<ur_native_handle_t
>(NativeHandle);
1346 ur_platform_handle_t UrPlatform =
1347 reinterpret_cast<ur_platform_handle_t
>(Platform);
1348 auto UrDevice =
reinterpret_cast<ur_device_handle_t *
>(Device);
1349 ur_device_native_properties_t UrProperties{};
1350 HANDLE_ERRORS(urDeviceCreateWithNativeHandle(UrNativeDevice, UrPlatform,
1351 &UrProperties, UrDevice));
1360 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
1362 if (!Properties || !Properties[0]) {
1363 return PI_ERROR_INVALID_VALUE;
1366 ur_device_partition_t UrType;
1367 switch (Properties[0]) {
1369 UrType = UR_DEVICE_PARTITION_EQUALLY;
1372 UrType = UR_DEVICE_PARTITION_BY_COUNTS;
1375 UrType = UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN;
1378 UrType = UR_DEVICE_PARTITION_BY_CSLICE;
1381 return PI_ERROR_UNKNOWN;
1384 std::vector<ur_device_partition_property_t> UrProperties{};
1388 if (UrType == UR_DEVICE_PARTITION_BY_CSLICE) {
1389 ur_device_partition_property_t UrProperty{};
1390 UrProperty.type = UrType;
1391 UrProperties.push_back(UrProperty);
1393 while (*(++Properties)) {
1394 ur_device_partition_property_t UrProperty;
1395 UrProperty.type = UrType;
1397 case UR_DEVICE_PARTITION_EQUALLY: {
1398 UrProperty.value.equally = *Properties;
1401 case UR_DEVICE_PARTITION_BY_COUNTS: {
1402 UrProperty.value.count = *Properties;
1405 case UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN: {
1408 UrProperty.value.affinity_domain = *Properties;
1412 die(
"Invalid properties for call to piDevicePartition");
1415 UrProperties.push_back(UrProperty);
1418 const ur_device_partition_properties_t UrPropertiesStruct{
1419 UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES,
1421 UrProperties.data(),
1422 UrProperties.size(),
1425 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
1426 auto UrSubDevices =
reinterpret_cast<ur_device_handle_t *
>(SubDevices);
1427 HANDLE_ERRORS(urDevicePartition(UrDevice, &UrPropertiesStruct, NumEntries,
1428 UrSubDevices, NumSubDevices));
1433 uint64_t *HostTime) {
1434 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
1435 HANDLE_ERRORS(urDeviceGetGlobalTimestamps(UrDevice, DeviceTime, HostTime));
1444 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
1445 std::vector<ur_device_binary_t> UrBinaries(NumBinaries);
1447 for (uint32_t BinaryCount = 0; BinaryCount < NumBinaries; BinaryCount++) {
1448 if (strcmp(Binaries[BinaryCount]->DeviceTargetSpec,
1450 UrBinaries[BinaryCount].pDeviceTargetSpec =
1451 UR_DEVICE_BINARY_TARGET_UNKNOWN;
1452 else if (strcmp(Binaries[BinaryCount]->DeviceTargetSpec,
1454 UrBinaries[BinaryCount].pDeviceTargetSpec =
1455 UR_DEVICE_BINARY_TARGET_SPIRV32;
1456 else if (strcmp(Binaries[BinaryCount]->DeviceTargetSpec,
1458 UrBinaries[BinaryCount].pDeviceTargetSpec =
1459 UR_DEVICE_BINARY_TARGET_SPIRV64;
1460 else if (strcmp(Binaries[BinaryCount]->DeviceTargetSpec,
1462 UrBinaries[BinaryCount].pDeviceTargetSpec =
1463 UR_DEVICE_BINARY_TARGET_SPIRV64_X86_64;
1464 else if (strcmp(Binaries[BinaryCount]->DeviceTargetSpec,
1466 UrBinaries[BinaryCount].pDeviceTargetSpec =
1467 UR_DEVICE_BINARY_TARGET_SPIRV64_GEN;
1468 else if (strcmp(Binaries[BinaryCount]->DeviceTargetSpec,
1470 UrBinaries[BinaryCount].pDeviceTargetSpec =
1471 UR_DEVICE_BINARY_TARGET_SPIRV64_FPGA;
1472 else if (strcmp(Binaries[BinaryCount]->DeviceTargetSpec,
1474 UrBinaries[BinaryCount].pDeviceTargetSpec =
1475 UR_DEVICE_BINARY_TARGET_NVPTX64;
1476 else if (strcmp(Binaries[BinaryCount]->DeviceTargetSpec,
1478 UrBinaries[BinaryCount].pDeviceTargetSpec =
1479 UR_DEVICE_BINARY_TARGET_AMDGCN;
1480 else if (strcmp(Binaries[BinaryCount]->DeviceTargetSpec,
1482 UrBinaries[BinaryCount].pDeviceTargetSpec =
1485 UrBinaries[BinaryCount].pDeviceTargetSpec =
1486 UR_DEVICE_BINARY_TARGET_UNKNOWN;
1489 HANDLE_ERRORS(urDeviceSelectBinary(UrDevice, UrBinaries.data(), NumBinaries,
1490 SelectedBinaryInd));
1501 void (*PFnNotify)(
const char *ErrInfo,
1502 const void *PrivateInfo,
1503 size_t CB,
void *UserData),
1505 std::ignore = Properties;
1506 std::ignore = PFnNotify;
1507 std::ignore = UserData;
1508 auto UrDevices =
reinterpret_cast<const ur_device_handle_t *
>(Devices);
1510 ur_context_handle_t *UrContext =
1511 reinterpret_cast<ur_context_handle_t *
>(RetContext);
1513 ur_context_properties_t UrProperties{};
1515 urContextCreate(NumDevices, UrDevices, &UrProperties, UrContext));
1521 auto hContext =
reinterpret_cast<ur_context_handle_t
>(Context);
1523 HANDLE_ERRORS(urContextSetExtendedDeleter(hContext, Function, UserData));
1531 ur_context_handle_t UrContext =
1532 reinterpret_cast<ur_context_handle_t
>(Context);
1533 ur_native_handle_t UrNativeHandle{};
1534 HANDLE_ERRORS(urContextGetNativeHandle(UrContext, &UrNativeHandle));
1542 PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);
1543 PI_ASSERT(RetContext, PI_ERROR_INVALID_VALUE);
1545 ur_adapter_handle_t adapter =
nullptr;
1546 if (
auto res =
PiGetAdapter(adapter); res != PI_SUCCESS) {
1551 ur_native_handle_t NativeContext =
1552 reinterpret_cast<ur_native_handle_t
>(NativeHandle);
1553 const ur_device_handle_t *UrDevices =
1554 reinterpret_cast<const ur_device_handle_t *
>(Devices);
1555 ur_context_handle_t *UrContext =
1556 reinterpret_cast<ur_context_handle_t *
>(RetContext);
1558 ur_context_native_properties_t Properties{
1559 UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES,
nullptr, OwnNativeHandle};
1562 NativeContext, NumDevices, UrDevices, &Properties, UrContext));
1568 size_t ParamValueSize,
void *ParamValue,
1569 size_t *ParamValueSizeRet) {
1571 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
1573 ur_context_handle_t hContext =
reinterpret_cast<ur_context_handle_t
>(Context);
1574 ur_context_info_t ContextInfoType{};
1576 switch (ParamName) {
1578 ContextInfoType = UR_CONTEXT_INFO_DEVICES;
1582 ContextInfoType = UR_CONTEXT_INFO_NUM_DEVICES;
1586 ContextInfoType = UR_CONTEXT_INFO_REFERENCE_COUNT;
1591 ContextInfoType = UR_CONTEXT_INFO_USM_FILL2D_SUPPORT;
1595 ContextInfoType = UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT;
1604 die(
"These queries should have never come here");
1607 die(
"piContextGetInfo: unsuppported ParamName.");
1611 size_t UrParamValueSizeRet;
1612 HANDLE_ERRORS(urContextGetInfo(hContext, ContextInfoType, ParamValueSize,
1613 ParamValue, &UrParamValueSizeRet));
1614 if (ParamValueSizeRet) {
1615 *ParamValueSizeRet = UrParamValueSizeRet;
1623 ur_context_handle_t hContext =
reinterpret_cast<ur_context_handle_t
>(Context);
1631 ur_context_handle_t UrContext =
1632 reinterpret_cast<ur_context_handle_t
>(Context);
1645 PI_ASSERT(Properties, PI_ERROR_INVALID_VALUE);
1651 PI_ERROR_INVALID_VALUE);
1663 PI_ERROR_INVALID_VALUE);
1665 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
1666 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
1667 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
1669 ur_queue_properties_t UrProperties{};
1670 UrProperties.stype = UR_STRUCTURE_TYPE_QUEUE_PROPERTIES;
1672 UrProperties.flags |= UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE;
1674 UrProperties.flags |= UR_QUEUE_FLAG_PROFILING_ENABLE;
1676 UrProperties.flags |= UR_QUEUE_FLAG_ON_DEVICE;
1678 UrProperties.flags |= UR_QUEUE_FLAG_ON_DEVICE_DEFAULT;
1680 UrProperties.flags |= UR_QUEUE_FLAG_DISCARD_EVENTS;
1682 UrProperties.flags |= UR_QUEUE_FLAG_PRIORITY_LOW;
1684 UrProperties.flags |= UR_QUEUE_FLAG_PRIORITY_HIGH;
1686 UrProperties.flags |= UR_QUEUE_FLAG_SYNC_WITH_DEFAULT_STREAM;
1688 UrProperties.flags |= UR_QUEUE_FLAG_USE_DEFAULT_STREAM;
1690 UrProperties.flags |= UR_QUEUE_FLAG_SUBMISSION_BATCHED;
1692 UrProperties.flags |= UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE;
1694 ur_queue_index_properties_t IndexProperties{};
1695 IndexProperties.stype = UR_STRUCTURE_TYPE_QUEUE_INDEX_PROPERTIES;
1696 if (Properties[2] != 0) {
1697 IndexProperties.computeIndex = Properties[3];
1700 UrProperties.pNext = &IndexProperties;
1702 ur_context_handle_t UrContext =
1703 reinterpret_cast<ur_context_handle_t
>(Context);
1704 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
1706 ur_queue_handle_t *UrQueue =
reinterpret_cast<ur_queue_handle_t *
>(Queue);
1707 HANDLE_ERRORS(urQueueCreate(UrContext, UrDevice, &UrProperties, UrQueue));
1722 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
1723 PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);
1724 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
1726 ur_context_handle_t UrContext =
1727 reinterpret_cast<ur_context_handle_t
>(Context);
1728 ur_device_handle_t UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
1729 ur_native_handle_t UrNativeHandle =
1730 reinterpret_cast<ur_native_handle_t
>(NativeHandle);
1731 ur_queue_handle_t *UrQueue =
reinterpret_cast<ur_queue_handle_t *
>(Queue);
1732 ur_queue_native_properties_t UrNativeProperties{};
1733 UrNativeProperties.isNativeHandleOwned = OwnNativeHandle;
1735 ur_queue_properties_t UrProperties{};
1736 UrProperties.stype = UR_STRUCTURE_TYPE_QUEUE_PROPERTIES;
1738 UrProperties.flags |= UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE;
1740 UrProperties.flags |= UR_QUEUE_FLAG_PROFILING_ENABLE;
1742 UrProperties.flags |= UR_QUEUE_FLAG_ON_DEVICE;
1744 UrProperties.flags |= UR_QUEUE_FLAG_ON_DEVICE_DEFAULT;
1746 UrProperties.flags |= UR_QUEUE_FLAG_DISCARD_EVENTS;
1748 UrProperties.flags |= UR_QUEUE_FLAG_PRIORITY_LOW;
1750 UrProperties.flags |= UR_QUEUE_FLAG_PRIORITY_HIGH;
1752 ur_queue_native_desc_t UrNativeDesc{};
1753 UrNativeDesc.stype = UR_STRUCTURE_TYPE_QUEUE_NATIVE_DESC;
1754 UrNativeDesc.pNativeData = &NativeHandleDesc;
1756 UrProperties.pNext = &UrNativeDesc;
1757 UrNativeProperties.pNext = &UrProperties;
1760 UrNativeHandle, UrContext, UrDevice, &UrNativeProperties, UrQueue));
1766 int32_t *NativeHandleDesc) {
1768 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
1769 PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);
1771 ur_queue_native_desc_t UrNativeDesc{};
1772 UrNativeDesc.pNativeData = NativeHandleDesc;
1774 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
1776 ur_native_handle_t UrNativeQueue{};
1777 HANDLE_ERRORS(urQueueGetNativeHandle(UrQueue, &UrNativeDesc, &UrNativeQueue));
1785 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
1787 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
1796 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
1798 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
1806 size_t ParamValueSize,
void *ParamValue,
1807 size_t *ParamValueSizeRet) {
1808 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
1810 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
1812 ur_queue_info_t UrParamName{};
1814 switch (ParamName) {
1816 UrParamName = UR_QUEUE_INFO_CONTEXT;
1820 UrParamName = UR_QUEUE_INFO_DEVICE;
1824 UrParamName = UR_QUEUE_INFO_DEVICE_DEFAULT;
1828 UrParamName = UR_QUEUE_INFO_FLAGS;
1832 UrParamName = UR_QUEUE_INFO_REFERENCE_COUNT;
1836 UrParamName = UR_QUEUE_INFO_SIZE;
1840 UrParamName = UR_QUEUE_INFO_EMPTY;
1844 die(
"Unsupported ParamName in piQueueGetInfo");
1845 return PI_ERROR_INVALID_VALUE;
1849 HANDLE_ERRORS(urQueueGetInfo(UrQueue, UrParamName, ParamValueSize, ParamValue,
1850 ParamValueSizeRet));
1857 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
1859 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
1868 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
1870 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
1886 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
1887 PI_ASSERT(ILBytes && Length, PI_ERROR_INVALID_VALUE);
1888 PI_ASSERT(Program, PI_ERROR_INVALID_PROGRAM);
1890 ur_context_handle_t UrContext =
1891 reinterpret_cast<ur_context_handle_t
>(Context);
1893 ur_program_properties_t UrProperties{};
1894 ur_program_handle_t *UrProgram =
1895 reinterpret_cast<ur_program_handle_t *
>(Program);
1896 HANDLE_ERRORS(urProgramCreateWithIL(UrContext, ILBytes, Length, &UrProperties,
1904 const size_t *Lengths,
const unsigned char **Binaries,
1907 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
1908 PI_ASSERT(DeviceList && NumDevices, PI_ERROR_INVALID_VALUE);
1909 PI_ASSERT(Binaries && Lengths, PI_ERROR_INVALID_VALUE);
1910 PI_ASSERT(Program, PI_ERROR_INVALID_PROGRAM);
1912 if (!Binaries[0] || !Lengths[0]) {
1914 *BinaryStatus = PI_ERROR_INVALID_VALUE;
1915 return PI_ERROR_INVALID_VALUE;
1918 ur_context_handle_t UrContext =
1919 reinterpret_cast<ur_context_handle_t
>(Context);
1920 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(DeviceList[0]);
1922 ur_program_properties_t Properties = {};
1923 Properties.stype = UR_STRUCTURE_TYPE_PROGRAM_PROPERTIES;
1924 Properties.pNext =
nullptr;
1925 Properties.count = NumMetadataEntries;
1927 std::unique_ptr<ur_program_metadata_t[]> pMetadatas;
1928 if (NumMetadataEntries) {
1929 pMetadatas.reset(
new ur_program_metadata_t[NumMetadataEntries]);
1930 for (
unsigned i = 0; i < NumMetadataEntries; i++) {
1934 Properties.pMetadatas = pMetadatas.get();
1937 ur_program_handle_t *UrProgram =
1938 reinterpret_cast<ur_program_handle_t *
>(Program);
1939 HANDLE_ERRORS(urProgramCreateWithBinary(UrContext, UrDevice, Lengths[0],
1940 Binaries[0], &Properties, UrProgram));
1943 *BinaryStatus = PI_SUCCESS;
1949 size_t ParamValueSize,
void *ParamValue,
1950 size_t *ParamValueSizeRet) {
1952 PI_ASSERT(Program, PI_ERROR_INVALID_PROGRAM);
1954 ur_program_handle_t UrProgram =
1955 reinterpret_cast<ur_program_handle_t
>(Program);
1957 ur_program_info_t PropName{};
1959 switch (ParamName) {
1961 PropName = UR_PROGRAM_INFO_REFERENCE_COUNT;
1965 PropName = UR_PROGRAM_INFO_CONTEXT;
1969 PropName = UR_PROGRAM_INFO_NUM_DEVICES;
1973 PropName = UR_PROGRAM_INFO_DEVICES;
1977 PropName = UR_PROGRAM_INFO_SOURCE;
1981 PropName = UR_PROGRAM_INFO_BINARY_SIZES;
1985 PropName = UR_PROGRAM_INFO_BINARIES;
1989 PropName = UR_PROGRAM_INFO_NUM_KERNELS;
1993 PropName = UR_PROGRAM_INFO_KERNEL_NAMES;
1997 die(
"urProgramGetInfo: not implemented");
2001 HANDLE_ERRORS(urProgramGetInfo(UrProgram, PropName, ParamValueSize,
2002 ParamValue, ParamValueSizeRet));
2009 const pi_device *DeviceList,
const char *Options,
2011 void (*PFnNotify)(
pi_program Program,
void *UserData),
2015 PI_ASSERT(DeviceList, PI_ERROR_INVALID_DEVICE);
2016 PI_ASSERT(!PFnNotify && !UserData, PI_ERROR_INVALID_VALUE);
2017 if (NumInputPrograms == 0 || InputPrograms ==
nullptr)
2018 return PI_ERROR_INVALID_VALUE;
2020 ur_context_handle_t UrContext =
2021 reinterpret_cast<ur_context_handle_t
>(Context);
2022 const ur_program_handle_t *UrInputPrograms =
2023 reinterpret_cast<const ur_program_handle_t *
>(InputPrograms);
2024 ur_program_handle_t *UrProgram =
2025 reinterpret_cast<ur_program_handle_t *
>(RetProgram);
2027 auto UrDevices =
reinterpret_cast<ur_device_handle_t *
>(
2031 urProgramLinkExp(UrContext, NumDevices, UrDevices, NumInputPrograms,
2032 UrInputPrograms, Options, UrProgram);
2033 if (urResult == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
2034 urResult = urProgramLink(UrContext, NumInputPrograms, UrInputPrograms,
2035 Options, UrProgram);
2042 const char *Options,
pi_uint32 NumInputHeaders,
2043 const pi_program *InputHeaders,
const char **HeaderIncludeNames,
2044 void (*PFnNotify)(
pi_program Program,
void *UserData),
void *UserData) {
2046 std::ignore = NumInputHeaders;
2047 std::ignore = InputHeaders;
2048 std::ignore = HeaderIncludeNames;
2050 PI_ASSERT(Program, PI_ERROR_INVALID_PROGRAM);
2052 if ((NumDevices && !DeviceList) || (!NumDevices && DeviceList))
2053 return PI_ERROR_INVALID_VALUE;
2056 PI_ASSERT(!PFnNotify && !UserData, PI_ERROR_INVALID_VALUE);
2058 ur_program_handle_t UrProgram =
2059 reinterpret_cast<ur_program_handle_t
>(Program);
2061 ur_program_info_t PropName = UR_PROGRAM_INFO_CONTEXT;
2062 ur_context_handle_t UrContext{};
2063 HANDLE_ERRORS(urProgramGetInfo(UrProgram, PropName,
sizeof(&UrContext),
2064 &UrContext,
nullptr));
2066 auto UrDevices =
reinterpret_cast<ur_device_handle_t *
>(
2070 urProgramCompileExp(UrProgram, NumDevices, UrDevices, Options);
2071 if (urResult == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
2072 urResult = urProgramCompile(UrContext, UrProgram, Options);
2079 const pi_device *DeviceList,
const char *Options,
2080 void (*PFnNotify)(
pi_program Program,
void *UserData),
2082 PI_ASSERT(Program, PI_ERROR_INVALID_PROGRAM);
2083 if ((NumDevices && !DeviceList) || (!NumDevices && DeviceList)) {
2084 return PI_ERROR_INVALID_VALUE;
2088 PI_ASSERT(!PFnNotify && !UserData, PI_ERROR_INVALID_VALUE);
2090 ur_program_handle_t UrProgram =
2091 reinterpret_cast<ur_program_handle_t
>(Program);
2092 ur_program_info_t PropName = UR_PROGRAM_INFO_CONTEXT;
2093 ur_context_handle_t UrContext{};
2094 HANDLE_ERRORS(urProgramGetInfo(UrProgram, PropName,
sizeof(&UrContext),
2095 &UrContext,
nullptr));
2097 auto UrDevices =
reinterpret_cast<ur_device_handle_t *
>(
2100 auto urResult = urProgramBuildExp(UrProgram, NumDevices, UrDevices, Options);
2101 if (urResult == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
2102 urResult = urProgramBuild(UrContext, UrProgram, Options);
2110 const void *SpecValue) {
2111 ur_program_handle_t UrProgram =
2112 reinterpret_cast<ur_program_handle_t
>(Program);
2114 ur_specialization_constant_info_t SpecConstant{};
2115 SpecConstant.id = SpecID;
2116 SpecConstant.size = Size;
2117 SpecConstant.pValue = SpecValue;
2119 urProgramSetSpecializationConstants(UrProgram, Count, &SpecConstant));
2126 PI_ASSERT(Program, PI_ERROR_INVALID_PROGRAM);
2127 PI_ASSERT(RetKernel, PI_ERROR_INVALID_VALUE);
2128 PI_ASSERT(KernelName, PI_ERROR_INVALID_VALUE);
2130 ur_program_handle_t UrProgram =
2131 reinterpret_cast<ur_program_handle_t
>(Program);
2132 ur_kernel_handle_t *UrKernel =
2133 reinterpret_cast<ur_kernel_handle_t *
>(RetKernel);
2135 HANDLE_ERRORS(urKernelCreate(UrProgram, KernelName, UrKernel));
2142 const size_t *Origin,
const size_t *Region,
2146 std::ignore = Image;
2147 std::ignore = FillColor;
2148 std::ignore = Origin;
2149 std::ignore = Region;
2150 std::ignore = NumEventsInWaitList;
2151 std::ignore = EventsWaitList;
2152 std::ignore = Event;
2154 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
2156 die(
"piEnqueueMemImageFill: not implemented");
2162 const char *FunctionName,
2165 PI_ASSERT(Program, PI_ERROR_INVALID_PROGRAM);
2167 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
2169 ur_program_handle_t UrProgram =
2170 reinterpret_cast<ur_program_handle_t
>(Program);
2172 void **FunctionPointer =
reinterpret_cast<void **
>(FunctionPointerRet);
2174 HANDLE_ERRORS(urProgramGetFunctionPointer(UrDevice, UrProgram, FunctionName,
2181 size_t *GlobalVariableSize,
void **GlobalVariablePointerRet) {
2182 PI_ASSERT(Program, PI_ERROR_INVALID_PROGRAM);
2184 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
2186 ur_program_handle_t UrProgram =
2187 reinterpret_cast<ur_program_handle_t
>(Program);
2190 UrDevice, UrProgram, GlobalVariableName, GlobalVariableSize,
2191 GlobalVariablePointerRet));
2199 const pi_mem *ArgValue) {
2206 PI_ASSERT(Kernel, PI_ERROR_INVALID_KERNEL);
2208 ur_mem_handle_t UrMemory{};
2210 UrMemory =
reinterpret_cast<ur_mem_handle_t
>(*ArgValue);
2217 ur_kernel_handle_t UrKernel =
reinterpret_cast<ur_kernel_handle_t
>(Kernel);
2223 sizeof(ur_kernel_arg_mem_obj_properties_t));
2225 sizeof(ur_kernel_arg_mem_obj_properties_t::stype));
2227 sizeof(ur_kernel_arg_mem_obj_properties_t::pNext));
2229 sizeof(ur_kernel_arg_mem_obj_properties_t::memoryAccess));
2232 uint32_t(UR_MEM_FLAG_READ_WRITE));
2234 uint32_t(UR_MEM_FLAG_READ_ONLY));
2236 uint32_t(UR_MEM_FLAG_WRITE_ONLY));
2238 uint32_t(UR_STRUCTURE_TYPE_KERNEL_ARG_MEM_OBJ_PROPERTIES));
2240 const ur_kernel_arg_mem_obj_properties_t *UrMemProperties =
2241 reinterpret_cast<const ur_kernel_arg_mem_obj_properties_t *
>(
2244 urKernelSetArgMemObj(UrKernel, ArgIndex, UrMemProperties, UrMemory));
2246 HANDLE_ERRORS(urKernelSetArgMemObj(UrKernel, ArgIndex,
nullptr, UrMemory));
2253 size_t ArgSize,
const void *ArgValue) {
2255 PI_ASSERT(Kernel, PI_ERROR_INVALID_KERNEL);
2257 ur_kernel_handle_t UrKernel =
reinterpret_cast<ur_kernel_handle_t
>(Kernel);
2261 urKernelSetArgValue(UrKernel, ArgIndex, ArgSize,
nullptr, ArgValue));
2263 HANDLE_ERRORS(urKernelSetArgLocal(UrKernel, ArgIndex, ArgSize,
nullptr));
2269 size_t ArgSize,
const void *ArgValue) {
2270 std::ignore = ArgSize;
2271 ur_kernel_handle_t UrKernel =
reinterpret_cast<ur_kernel_handle_t
>(Kernel);
2272 HANDLE_ERRORS(urKernelSetArgPointer(UrKernel, ArgIndex,
nullptr, ArgValue));
2280 bool OwnNativeHandle,
pi_kernel *Kernel) {
2281 PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);
2282 PI_ASSERT(Kernel, PI_ERROR_INVALID_KERNEL);
2284 ur_native_handle_t UrNativeKernel =
2285 reinterpret_cast<ur_native_handle_t
>(NativeHandle);
2286 ur_context_handle_t UrContext =
2287 reinterpret_cast<ur_context_handle_t
>(Context);
2288 ur_program_handle_t UrProgram =
2289 reinterpret_cast<ur_program_handle_t
>(Program);
2290 ur_kernel_handle_t *UrKernel =
reinterpret_cast<ur_kernel_handle_t *
>(Kernel);
2291 ur_kernel_native_properties_t Properties{};
2292 Properties.isNativeHandleOwned = OwnNativeHandle;
2294 UrNativeKernel, UrContext, UrProgram, &Properties, UrKernel));
2300 PI_ASSERT(Program, PI_ERROR_INVALID_PROGRAM);
2302 ur_program_handle_t UrProgram =
2303 reinterpret_cast<ur_program_handle_t
>(Program);
2305 urProgramRetain(
reinterpret_cast<ur_program_handle_t
>(UrProgram)));
2312 size_t ParamValueSize,
2313 const void *ParamValue) {
2315 PI_ASSERT(Kernel, PI_ERROR_INVALID_KERNEL);
2316 PI_ASSERT(ParamValue, PI_ERROR_INVALID_VALUE);
2318 ur_kernel_handle_t UrKernel =
reinterpret_cast<ur_kernel_handle_t
>(Kernel);
2319 ur_kernel_exec_info_t PropName{};
2320 uint64_t PropValue{};
2321 switch (ParamName) {
2323 PropName = UR_KERNEL_EXEC_INFO_USM_INDIRECT_ACCESS;
2324 PropValue = *(
static_cast<uint64_t *
>(
const_cast<void *
>(ParamValue)));
2328 PropName = UR_KERNEL_EXEC_INFO_USM_PTRS;
2332 PropName = UR_KERNEL_EXEC_INFO_CACHE_CONFIG;
2335 PropValue =
static_cast<uint64_t
>(UR_KERNEL_CACHE_CONFIG_LARGE_SLM);
2337 PropValue =
static_cast<uint64_t
>(UR_KERNEL_CACHE_CONFIG_LARGE_DATA);
2340 PropValue =
static_cast<uint64_t
>(UR_KERNEL_CACHE_CONFIG_DEFAULT);
2342 die(
"piKernelSetExecInfo: unsupported ParamValue\n");
2347 die(
"piKernelSetExecInfo: unsupported ParamName\n");
2349 HANDLE_ERRORS(urKernelSetExecInfo(UrKernel, PropName, ParamValueSize,
nullptr,
2357 PI_ASSERT(Program, PI_ERROR_INVALID_PROGRAM);
2358 PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);
2360 ur_program_handle_t UrProgram =
2361 reinterpret_cast<ur_program_handle_t
>(Program);
2362 ur_native_handle_t NativeProgram{};
2363 HANDLE_ERRORS(urProgramGetNativeHandle(UrProgram, &NativeProgram));
2374 PI_ASSERT(Program, PI_ERROR_INVALID_PROGRAM);
2375 PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);
2376 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
2378 ur_native_handle_t NativeProgram =
2379 reinterpret_cast<ur_native_handle_t
>(NativeHandle);
2380 ur_context_handle_t UrContext =
2381 reinterpret_cast<ur_context_handle_t
>(Context);
2382 ur_program_handle_t *UrProgram =
2383 reinterpret_cast<ur_program_handle_t *
>(Program);
2384 ur_program_native_properties_t UrProperties{};
2385 UrProperties.isNativeHandleOwned = OwnNativeHandle;
2386 HANDLE_ERRORS(urProgramCreateWithNativeHandle(NativeProgram, UrContext,
2387 &UrProperties, UrProgram));
2392 size_t ParamValueSize,
void *ParamValue,
2393 size_t *ParamValueSizeRet) {
2394 PI_ASSERT(Kernel, PI_ERROR_INVALID_KERNEL);
2396 ur_kernel_handle_t UrKernel =
reinterpret_cast<ur_kernel_handle_t
>(Kernel);
2397 ur_kernel_info_t UrParamName{};
2398 switch (ParamName) {
2400 UrParamName = UR_KERNEL_INFO_FUNCTION_NAME;
2405 HANDLE_ERRORS(urKernelGetInfo(UrKernel, UR_KERNEL_INFO_NUM_ARGS,
2406 sizeof(NumArgs), &NumArgs,
nullptr));
2407 if (ParamValueSizeRet) {
2408 *ParamValueSizeRet =
sizeof(uint32_t);
2411 if (ParamValueSize !=
sizeof(uint32_t))
2412 return PI_ERROR_INVALID_BUFFER_SIZE;
2413 *
static_cast<uint32_t *
>(ParamValue) =
static_cast<uint32_t
>(NumArgs);
2418 UrParamName = UR_KERNEL_INFO_REFERENCE_COUNT;
2422 UrParamName = UR_KERNEL_INFO_CONTEXT;
2426 UrParamName = UR_KERNEL_INFO_PROGRAM;
2430 UrParamName = UR_KERNEL_INFO_ATTRIBUTES;
2434 return PI_ERROR_INVALID_PROPERTY;
2437 HANDLE_ERRORS(urKernelGetInfo(UrKernel, UrParamName, ParamValueSize,
2438 ParamValue, ParamValueSizeRet));
2445 size_t ParamValueSize,
void *ParamValue,
2446 size_t *ParamValueSizeRet) {
2447 PI_ASSERT(Kernel, PI_ERROR_INVALID_KERNEL);
2448 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
2450 ur_kernel_handle_t UrKernel =
reinterpret_cast<ur_kernel_handle_t
>(Kernel);
2451 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
2453 ur_kernel_group_info_t UrParamName{};
2454 switch (ParamName) {
2456 UrParamName = UR_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE;
2460 UrParamName = UR_KERNEL_GROUP_INFO_WORK_GROUP_SIZE;
2464 UrParamName = UR_KERNEL_GROUP_INFO_COMPILE_WORK_GROUP_SIZE;
2468 UrParamName = UR_KERNEL_GROUP_INFO_LOCAL_MEM_SIZE;
2472 UrParamName = UR_KERNEL_GROUP_INFO_PREFERRED_WORK_GROUP_SIZE_MULTIPLE;
2476 UrParamName = UR_KERNEL_GROUP_INFO_PRIVATE_MEM_SIZE;
2481 HANDLE_ERRORS(urKernelGetInfo(UrKernel, UR_KERNEL_INFO_NUM_REGS,
2482 ParamValueSize, ParamValue,
2483 ParamValueSizeRet));
2487 die(
"Unknown ParamName in piKernelGetGroupInfo");
2488 return PI_ERROR_INVALID_VALUE;
2492 HANDLE_ERRORS(urKernelGetGroupInfo(UrKernel, UrDevice, UrParamName,
2493 ParamValueSize, ParamValue,
2494 ParamValueSizeRet));
2501 PI_ASSERT(Kernel, PI_ERROR_INVALID_KERNEL);
2503 ur_kernel_handle_t UrKernel =
reinterpret_cast<ur_kernel_handle_t
>(Kernel);
2512 PI_ASSERT(Kernel, PI_ERROR_INVALID_KERNEL);
2514 ur_kernel_handle_t UrKernel =
reinterpret_cast<ur_kernel_handle_t
>(Kernel);
2523 PI_ASSERT(Program, PI_ERROR_INVALID_PROGRAM);
2525 ur_program_handle_t UrProgram =
2526 reinterpret_cast<ur_program_handle_t
>(Program);
2534 size_t,
const void *ArgValue) {
2535 ur_kernel_handle_t UrKernel =
reinterpret_cast<ur_kernel_handle_t
>(Kernel);
2536 HANDLE_ERRORS(urKernelSetArgPointer(UrKernel, ArgIndex,
nullptr, ArgValue));
2543 size_t InputValueSize,
const void *InputValue,
size_t ParamValueSize,
2544 void *ParamValue,
size_t *ParamValueSizeRet) {
2546 std::ignore = InputValueSize;
2547 std::ignore = InputValue;
2549 ur_kernel_handle_t UrKernel =
reinterpret_cast<ur_kernel_handle_t
>(Kernel);
2550 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
2552 ur_kernel_sub_group_info_t PropName{};
2553 switch (ParamName) {
2555 PropName = UR_KERNEL_SUB_GROUP_INFO_MAX_SUB_GROUP_SIZE;
2559 PropName = UR_KERNEL_SUB_GROUP_INFO_MAX_NUM_SUB_GROUPS;
2563 PropName = UR_KERNEL_SUB_GROUP_INFO_COMPILE_NUM_SUB_GROUPS;
2567 PropName = UR_KERNEL_SUB_GROUP_INFO_SUB_GROUP_SIZE_INTEL;
2571 HANDLE_ERRORS(urKernelGetSubGroupInfo(UrKernel, UrDevice, PropName,
2572 ParamValueSize, ParamValue,
2573 ParamValueSizeRet));
2580 size_t ParamValueSize,
void *ParamValue,
2581 size_t *ParamValueSizeRet) {
2583 ur_program_handle_t UrProgram =
2584 reinterpret_cast<ur_program_handle_t
>(Program);
2585 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
2587 ur_program_build_info_t PropName{};
2588 switch (ParamName) {
2590 PropName = UR_PROGRAM_BUILD_INFO_STATUS;
2594 PropName = UR_PROGRAM_BUILD_INFO_OPTIONS;
2598 PropName = UR_PROGRAM_BUILD_INFO_LOG;
2602 PropName = UR_PROGRAM_BUILD_INFO_BINARY_TYPE;
2606 die(
"piProgramGetBuildInfo: not implemented");
2610 size_t SizeInOut = ParamValueSize;
2611 HANDLE_ERRORS(urProgramGetBuildInfo(UrProgram, UrDevice, PropName,
2612 ParamValueSize, ParamValue,
2613 ParamValueSizeRet));
2620 PI_ASSERT(Kernel, PI_ERROR_INVALID_KERNEL);
2621 PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);
2623 ur_kernel_handle_t UrKernel =
reinterpret_cast<ur_kernel_handle_t
>(Kernel);
2624 ur_native_handle_t NativeKernel{};
2625 HANDLE_ERRORS(urKernelGetNativeHandle(UrKernel, &NativeKernel));
2633 pi_kernel Kernel,
size_t LocalWorkSize,
size_t DynamicSharedMemorySize,
2635 PI_ASSERT(Kernel, PI_ERROR_INVALID_KERNEL);
2636 PI_ASSERT(GroupCountRet, PI_ERROR_INVALID_VALUE);
2638 ur_kernel_handle_t UrKernel =
reinterpret_cast<ur_kernel_handle_t
>(Kernel);
2640 UrKernel, LocalWorkSize, DynamicSharedMemorySize, GroupCountRet));
2660 size_t Count,
size_t Offset,
const void *Src,
pi_uint32 NumEventsInWaitList,
2662 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
2664 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
2665 ur_program_handle_t UrProgram =
2666 reinterpret_cast<ur_program_handle_t
>(Program);
2667 const ur_event_handle_t *UrEventsWaitList =
2668 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
2669 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
2671 UrQueue, UrProgram, Name, BlockingWrite, Count, Offset, Src,
2672 NumEventsInWaitList, UrEventsWaitList, UREvent));
2692 size_t Count,
size_t Offset,
void *Dst,
pi_uint32 NumEventsInWaitList,
2695 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
2697 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
2698 ur_program_handle_t UrProgram =
2699 reinterpret_cast<ur_program_handle_t
>(Program);
2700 const ur_event_handle_t *UrEventsWaitList =
2701 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
2703 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
2706 UrQueue, UrProgram, Name, BlockingRead, Count, Offset, Dst,
2707 NumEventsInWaitList, UrEventsWaitList, UREvent));
2718 size_t Size,
void *HostPtr,
pi_mem *RetMem,
2721 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
2722 PI_ASSERT(RetMem, PI_ERROR_INVALID_VALUE);
2724 ur_context_handle_t UrContext =
2725 reinterpret_cast<ur_context_handle_t
>(Context);
2727 ur_mem_flags_t UrBufferFlags{};
2729 UrBufferFlags |= UR_MEM_FLAG_READ_WRITE;
2732 UrBufferFlags |= UR_MEM_FLAG_READ_ONLY;
2735 UrBufferFlags |= UR_MEM_FLAG_USE_HOST_POINTER;
2738 UrBufferFlags |= UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER;
2741 UrBufferFlags |= UR_MEM_FLAG_ALLOC_HOST_POINTER;
2744 ur_buffer_properties_t UrProps{};
2745 UrProps.stype = UR_STRUCTURE_TYPE_BUFFER_PROPERTIES;
2746 UrProps.pHost = HostPtr;
2748 ur_buffer_channel_properties_t bufferChannelProperties{};
2749 bufferChannelProperties.stype = UR_STRUCTURE_TYPE_BUFFER_CHANNEL_PROPERTIES;
2750 ur_buffer_alloc_location_properties_t bufferLocationProperties{};
2751 bufferLocationProperties.stype =
2752 UR_STRUCTURE_TYPE_BUFFER_ALLOC_LOCATION_PROPERTIES;
2753 if (properties !=
nullptr) {
2754 bool bufferLocationPropertySet =
false;
2755 bool bufferMemChannelPropertySet =
false;
2756 uint64_t allocBufferLocation = 0;
2757 uint32_t allocBufferMemChannel = 0;
2760 while (properties[I] != 0) {
2762 allocBufferLocation = properties[I + 1];
2763 bufferLocationPropertySet =
true;
2765 allocBufferMemChannel = properties[I + 1];
2766 bufferMemChannelPropertySet =
true;
2770 void *extensionProperties =
nullptr;
2771 if (bufferLocationPropertySet) {
2772 bufferLocationProperties.location = allocBufferLocation;
2773 extensionProperties = &bufferLocationProperties;
2775 if (bufferMemChannelPropertySet) {
2776 bufferChannelProperties.channel = allocBufferMemChannel;
2777 extensionProperties = &bufferChannelProperties;
2779 if (bufferLocationPropertySet && bufferMemChannelPropertySet) {
2780 bufferLocationProperties.pNext = &bufferChannelProperties;
2781 extensionProperties = &bufferLocationProperties;
2783 UrProps.pNext = extensionProperties;
2785 ur_mem_handle_t *UrBuffer =
reinterpret_cast<ur_mem_handle_t *
>(RetMem);
2787 urMemBufferCreate(UrContext, UrBufferFlags, Size, &UrProps, UrBuffer));
2795 ur_usm_desc_t USMDesc{};
2798 ur_usm_alloc_location_desc_t UsmLocationDesc{};
2799 UsmLocationDesc.stype = UR_STRUCTURE_TYPE_USM_ALLOC_LOCATION_DESC;
2803 while (Properties[Next]) {
2805 UsmLocationDesc.location =
static_cast<uint32_t
>(Properties[Next + 1]);
2806 USMDesc.pNext = &UsmLocationDesc;
2808 return PI_ERROR_INVALID_VALUE;
2814 ur_context_handle_t UrContext =
2815 reinterpret_cast<ur_context_handle_t
>(Context);
2817 ur_usm_pool_handle_t Pool{};
2818 HANDLE_ERRORS(urUSMHostAlloc(UrContext, &USMDesc, Pool, Size, ResultPtr));
2823 size_t ParamValueSize,
void *ParamValue,
2824 size_t *ParamValueSizeRet) {
2828 ur_mem_handle_t UrMemory =
reinterpret_cast<ur_mem_handle_t
>(Mem);
2829 ur_mem_info_t MemInfoType{};
2830 switch (ParamName) {
2832 MemInfoType = UR_MEM_INFO_CONTEXT;
2836 MemInfoType = UR_MEM_INFO_SIZE;
2840 die(
"piMemGetInfo: unsuppported ParamName.");
2843 HANDLE_ERRORS(urMemGetInfo(UrMemory, MemInfoType, ParamValueSize, ParamValue,
2844 ParamValueSizeRet));
2850 ur_image_format_t *UrFormat,
2851 ur_image_desc_t *UrDesc) {
2854 #define PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE(FROM, TO) \
2856 UrFormat->channelType = TO; \
2860 UR_IMAGE_CHANNEL_TYPE_SNORM_INT8)
2862 UR_IMAGE_CHANNEL_TYPE_SNORM_INT16)
2864 UR_IMAGE_CHANNEL_TYPE_UNORM_INT8)
2866 UR_IMAGE_CHANNEL_TYPE_UNORM_INT16)
2868 UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565)
2870 UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555)
2872 UR_IMAGE_CHANNEL_TYPE_INT_101010)
2874 UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8)
2876 UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16)
2878 UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32)
2880 UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8)
2882 UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16)
2884 UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32)
2886 UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT)
2888 UR_IMAGE_CHANNEL_TYPE_FLOAT)
2889 #undef PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE
2891 die(
"piMemImageCreate: unsuppported image_channel_data_type.");
2895 #define PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER(FROM, TO) \
2897 UrFormat->channelOrder = TO; \
2901 UR_IMAGE_CHANNEL_ORDER_A)
2903 UR_IMAGE_CHANNEL_ORDER_R)
2905 UR_IMAGE_CHANNEL_ORDER_RG)
2907 UR_IMAGE_CHANNEL_ORDER_RA)
2909 UR_IMAGE_CHANNEL_ORDER_RGB)
2911 UR_IMAGE_CHANNEL_ORDER_RGBA)
2913 UR_IMAGE_CHANNEL_ORDER_BGRA)
2915 UR_IMAGE_CHANNEL_ORDER_ARGB)
2917 UR_IMAGE_CHANNEL_ORDER_ABGR)
2919 UR_IMAGE_CHANNEL_ORDER_INTENSITY)
2921 UR_IMAGE_CHANNEL_ORDER_LUMINANCE)
2923 UR_IMAGE_CHANNEL_ORDER_RX)
2925 UR_IMAGE_CHANNEL_ORDER_RGX)
2927 UR_IMAGE_CHANNEL_ORDER_RGBX)
2929 UR_IMAGE_CHANNEL_ORDER_SRGBA)
2930 #undef PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER
2932 die(
"piMemImageCreate: unsuppported image_channel_data_type.");
2936 UrDesc->stype = UR_STRUCTURE_TYPE_IMAGE_DESC;
2945 #define PI_TO_UR_MAP_IMAGE_TYPE(FROM, TO) \
2947 UrDesc->type = TO; \
2954 UR_MEM_TYPE_IMAGE2D_ARRAY)
2957 UR_MEM_TYPE_IMAGE1D_ARRAY)
2959 UR_MEM_TYPE_IMAGE1D_BUFFER)
2961 UR_MEM_TYPE_IMAGE_CUBEMAP_EXP)
2962 #undef PI_TO_UR_MAP_IMAGE_TYPE
2964 die(
"piMemImageCreate: unsuppported image_type.");
2974 switch (UrFormat->channelOrder) {
2975 #define UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER(FROM, TO) \
2977 PiFormat->image_channel_order = TO; \
3010 #undef UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER
3012 die(
"ur2piImageFormat: unsuppported channelOrder.");
3016 switch (UrFormat->channelType) {
3017 #define UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE(FROM, TO) \
3019 PiFormat->image_channel_data_type = TO; \
3052 #undef UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE
3054 die(
"ur2piImageFormat: unsuppported channelType.");
3064 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
3065 PI_ASSERT(RetImage, PI_ERROR_INVALID_VALUE);
3066 PI_ASSERT(ImageFormat, PI_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR);
3068 ur_context_handle_t UrContext =
3069 reinterpret_cast<ur_context_handle_t
>(Context);
3071 ur_mem_flags_t UrFlags{};
3073 UrFlags |= UR_MEM_FLAG_READ_WRITE;
3076 UrFlags |= UR_MEM_FLAG_READ_ONLY;
3079 UrFlags |= UR_MEM_FLAG_USE_HOST_POINTER;
3082 UrFlags |= UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER;
3085 UrFlags |= UR_MEM_FLAG_ALLOC_HOST_POINTER;
3088 ur_image_format_t UrFormat{};
3089 ur_image_desc_t UrDesc{};
3094 ur_mem_handle_t *UrMem =
reinterpret_cast<ur_mem_handle_t *
>(RetImage);
3096 urMemImageCreate(UrContext, UrFlags, &UrFormat, &UrDesc, HostPtr, UrMem));
3106 PI_ASSERT(RetImage, PI_ERROR_INVALID_VALUE);
3107 PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);
3108 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
3110 ur_native_handle_t UrNativeMem =
3111 reinterpret_cast<ur_native_handle_t
>(NativeHandle);
3113 ur_context_handle_t UrContext =
3114 reinterpret_cast<ur_context_handle_t
>(Context);
3116 ur_mem_handle_t *UrMem =
reinterpret_cast<ur_mem_handle_t *
>(RetImage);
3117 ur_mem_native_properties_t Properties{};
3118 Properties.isNativeHandleOwned = OwnNativeHandle;
3120 ur_image_format_t UrFormat{};
3121 ur_image_desc_t UrDesc{};
3125 UrNativeMem, UrContext, &UrFormat, &UrDesc, &Properties, UrMem));
3132 void *BufferCreateInfo,
pi_mem *RetMem) {
3135 BufferCreateInfo && RetMem,
3136 PI_ERROR_INVALID_VALUE);
3139 PI_ASSERT(Region->size != 0u, PI_ERROR_INVALID_BUFFER_SIZE);
3140 PI_ASSERT(Region->origin <= (Region->origin + Region->size),
3141 PI_ERROR_INVALID_VALUE);
3143 ur_mem_handle_t UrBuffer =
reinterpret_cast<ur_mem_handle_t
>(Buffer);
3145 ur_mem_flags_t UrFlags{};
3147 UrFlags |= UR_MEM_FLAG_READ_WRITE;
3150 UrFlags |= UR_MEM_FLAG_READ_ONLY;
3153 UrFlags |= UR_MEM_FLAG_USE_HOST_POINTER;
3156 UrFlags |= UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER;
3159 UrFlags |= UR_MEM_FLAG_ALLOC_HOST_POINTER;
3162 ur_buffer_create_type_t UrBufferCreateType{};
3164 UrBufferCreateType = UR_BUFFER_CREATE_TYPE_REGION;
3167 ur_buffer_region_t UrBufferCreateInfo{};
3168 UrBufferCreateInfo.origin = Region->origin;
3169 UrBufferCreateInfo.size = Region->size;
3170 ur_mem_handle_t *UrMem =
reinterpret_cast<ur_mem_handle_t *
>(RetMem);
3171 HANDLE_ERRORS(urMemBufferPartition(UrBuffer, UrFlags, UrBufferCreateType,
3172 &UrBufferCreateInfo, UrMem));
3179 PI_ASSERT(Mem, PI_ERROR_INVALID_MEM_OBJECT);
3181 ur_mem_handle_t UrMem =
reinterpret_cast<ur_mem_handle_t
>(Mem);
3182 ur_device_handle_t UrDev =
reinterpret_cast<ur_device_handle_t
>(Dev);
3183 ur_native_handle_t NativeMem{};
3184 HANDLE_ERRORS(urMemGetNativeHandle(UrMem, UrDev, &NativeMem));
3197 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
3199 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
3201 ur_mem_handle_t UrImageSrc =
reinterpret_cast<ur_mem_handle_t
>(SrcImage);
3202 ur_mem_handle_t UrImageDst =
reinterpret_cast<ur_mem_handle_t
>(DstImage);
3204 ur_rect_offset_t UrSrcOrigin{SrcOrigin->
x, SrcOrigin->
y, SrcOrigin->
z};
3205 ur_rect_offset_t UrDstOrigin{DstOrigin->
x, DstOrigin->
y, DstOrigin->
z};
3206 ur_rect_region_t UrRegion{};
3207 UrRegion.depth = Region->
depth;
3208 UrRegion.height = Region->
height;
3209 UrRegion.width = Region->
width;
3211 const ur_event_handle_t *UrEventsWaitList =
3212 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
3214 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
3217 UrQueue, UrImageSrc, UrImageDst, UrSrcOrigin, UrDstOrigin, UrRegion,
3218 NumEventsInWaitList, UrEventsWaitList, UREvent));
3225 bool OwnNativeHandle,
3228 PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);
3229 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
3231 ur_native_handle_t UrNativeMem =
3232 reinterpret_cast<ur_native_handle_t
>(NativeHandle);
3233 ur_context_handle_t UrContext =
3234 reinterpret_cast<ur_context_handle_t
>(Context);
3235 ur_mem_handle_t *UrMem =
reinterpret_cast<ur_mem_handle_t *
>(Mem);
3236 ur_mem_native_properties_t Properties{};
3237 Properties.isNativeHandleOwned = OwnNativeHandle;
3238 HANDLE_ERRORS(urMemBufferCreateWithNativeHandle(UrNativeMem, UrContext,
3239 &Properties, UrMem));
3248 ur_context_handle_t UrContext =
3249 reinterpret_cast<ur_context_handle_t
>(Context);
3250 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
3252 ur_usm_desc_t USMDesc{};
3255 ur_usm_alloc_location_desc_t UsmLocDesc{};
3256 UsmLocDesc.stype = UR_STRUCTURE_TYPE_USM_ALLOC_LOCATION_DESC;
3260 while (Properties[Next]) {
3262 UsmLocDesc.location =
static_cast<uint32_t
>(Properties[Next + 1]);
3263 USMDesc.pNext = &UsmLocDesc;
3265 return PI_ERROR_INVALID_VALUE;
3271 ur_usm_pool_handle_t Pool{};
3273 urUSMDeviceAlloc(UrContext, UrDevice, &USMDesc, Pool, Size, ResultPtr));
3281 size_t WidthInBytes,
size_t Height,
3282 unsigned int ElementSizeBytes) {
3283 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
3284 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
3286 auto UrContext =
reinterpret_cast<ur_context_handle_t
>(Context);
3287 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
3288 std::ignore = Properties;
3289 ur_usm_desc_t USMDesc{};
3290 ur_usm_pool_handle_t Pool{};
3292 HANDLE_ERRORS(urUSMPitchedAllocExp(UrContext, UrDevice, &USMDesc, Pool,
3293 WidthInBytes, Height, ElementSizeBytes,
3294 ResultPtr, ResultPitch));
3303 ur_context_handle_t UrContext =
3304 reinterpret_cast<ur_context_handle_t
>(Context);
3305 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
3307 ur_usm_desc_t USMDesc{};
3309 ur_usm_device_desc_t UsmDeviceDesc{};
3310 UsmDeviceDesc.stype = UR_STRUCTURE_TYPE_USM_DEVICE_DESC;
3311 ur_usm_host_desc_t UsmHostDesc{};
3312 UsmHostDesc.stype = UR_STRUCTURE_TYPE_USM_HOST_DESC;
3313 ur_usm_alloc_location_desc_t UsmLocationDesc{};
3314 UsmLocationDesc.stype = UR_STRUCTURE_TYPE_USM_ALLOC_LOCATION_DESC;
3319 USMDesc.pNext = &UsmDeviceDesc;
3320 UsmDeviceDesc.pNext = &UsmHostDesc;
3324 while (Properties[Next]) {
3325 switch (Properties[Next]) {
3328 UsmDeviceDesc.flags |= UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED;
3331 UsmDeviceDesc.flags |= UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT;
3334 UsmHostDesc.flags |= UR_USM_HOST_MEM_FLAG_INITIAL_PLACEMENT;
3337 UsmDeviceDesc.flags |= UR_USM_DEVICE_MEM_FLAG_DEVICE_READ_ONLY;
3342 UsmLocationDesc.location =
static_cast<uint32_t
>(Properties[Next + 1]);
3346 UsmHostDesc.pNext = &UsmLocationDesc;
3350 return PI_ERROR_INVALID_VALUE;
3356 ur_usm_pool_handle_t Pool{};
3358 urUSMSharedAlloc(UrContext, UrDevice, &USMDesc, Pool, Size, ResultPtr));
3364 ur_context_handle_t UrContext =
3365 reinterpret_cast<ur_context_handle_t
>(Context);
3371 PI_ASSERT(Mem, PI_ERROR_INVALID_MEM_OBJECT);
3373 ur_mem_handle_t UrMem =
reinterpret_cast<ur_mem_handle_t
>(Mem);
3381 PI_ASSERT(Mem, PI_ERROR_INVALID_MEM_OBJECT);
3383 ur_mem_handle_t UrMem =
reinterpret_cast<ur_mem_handle_t
>(Mem);
3407 PI_ASSERT(Flags == 0, PI_ERROR_INVALID_VALUE);
3408 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
3410 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
3412 const ur_event_handle_t *UrEventsWaitList =
3413 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
3415 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
3420 ur_usm_migration_flags_t UrFlags{};
3421 HANDLE_ERRORS(urEnqueueUSMPrefetch(UrQueue, Ptr, Size, UrFlags,
3422 NumEventsInWaitList, UrEventsWaitList,
3440 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
3442 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
3444 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
3446 ur_usm_advice_flags_t UrAdvice{};
3448 UrAdvice |= UR_USM_ADVICE_FLAG_SET_READ_MOSTLY;
3451 UrAdvice |= UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY;
3454 UrAdvice |= UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION;
3457 UrAdvice |= UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION;
3460 UrAdvice |= UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE;
3463 UrAdvice |= UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE;
3466 UrAdvice |= UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST;
3469 UrAdvice |= UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_HOST;
3472 UrAdvice |= UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY;
3475 UrAdvice |= UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY;
3478 UrAdvice |= UR_USM_ADVICE_FLAG_DEFAULT;
3481 HANDLE_ERRORS(urEnqueueUSMAdvise(UrQueue, Ptr, Length, UrAdvice, UREvent));
3499 size_t PatternSize,
const void *Pattern,
3500 size_t Width,
size_t Height,
3505 auto hQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
3506 auto phEventWaitList =
3507 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
3508 auto phEvent =
reinterpret_cast<ur_event_handle_t *
>(Event);
3510 HANDLE_ERRORS(urEnqueueUSMFill2D(hQueue, Ptr, Pitch, PatternSize, Pattern,
3511 Width, Height, NumEventsWaitList,
3512 phEventWaitList, phEvent));
3518 size_t Pitch,
int Value,
size_t Width,
3523 std::ignore = Queue;
3525 std::ignore = Pitch;
3526 std::ignore = Value;
3527 std::ignore = Width;
3528 std::ignore = Height;
3529 std::ignore = NumEventsWaitList;
3530 std::ignore = EventsWaitList;
3531 std::ignore = Event;
3532 die(
"piextUSMEnqueueMemset2D: not implemented");
3538 size_t ParamValueSize,
3540 size_t *ParamValueSizeRet) {
3542 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
3544 ur_context_handle_t UrContext =
3545 reinterpret_cast<ur_context_handle_t
>(Context);
3547 ur_usm_alloc_info_t UrParamName{};
3548 switch (ParamName) {
3550 UrParamName = UR_USM_ALLOC_INFO_TYPE;
3554 UrParamName = UR_USM_ALLOC_INFO_BASE_PTR;
3558 UrParamName = UR_USM_ALLOC_INFO_SIZE;
3562 UrParamName = UR_USM_ALLOC_INFO_DEVICE;
3566 die(
"piextUSMGetMemAllocInfo: unsuppported ParamName.");
3570 size_t SizeInOut = ParamValueSize;
3571 HANDLE_ERRORS(urUSMGetMemAllocInfo(UrContext, Ptr, UrParamName,
3572 ParamValueSize, ParamValue,
3581 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
3583 ur_context_handle_t UrContext =
3584 reinterpret_cast<ur_context_handle_t
>(Context);
3586 HANDLE_ERRORS(urUSMImportExp(UrContext,
const_cast<void *
>(HostPtr), Size));
3592 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
3594 ur_context_handle_t UrContext =
3595 reinterpret_cast<ur_context_handle_t
>(Context);
3597 HANDLE_ERRORS(urUSMReleaseExp(UrContext,
const_cast<void *
>(HostPtr)));
3602 size_t ParamValueSize,
void *ParamValue,
3603 size_t *ParamValueSizeRet) {
3605 auto hMem =
reinterpret_cast<ur_mem_handle_t
>(Image);
3607 ur_image_info_t UrParamName{};
3608 switch (ParamName) {
3610 UrParamName = UR_IMAGE_INFO_FORMAT;
3614 UrParamName = UR_IMAGE_INFO_ELEMENT_SIZE;
3618 UrParamName = UR_IMAGE_INFO_ROW_PITCH;
3622 UrParamName = UR_IMAGE_INFO_SLICE_PITCH;
3626 UrParamName = UR_IMAGE_INFO_WIDTH;
3630 UrParamName = UR_IMAGE_INFO_HEIGHT;
3634 UrParamName = UR_IMAGE_INFO_DEPTH;
3638 return PI_ERROR_UNKNOWN;
3641 HANDLE_ERRORS(urMemImageGetInfo(hMem, UrParamName, ParamValueSize, ParamValue,
3642 ParamValueSizeRet));
3661 void *DstPtr,
size_t DstPitch,
3662 const void *SrcPtr,
size_t SrcPitch,
3663 size_t Width,
size_t Height,
3668 if (!DstPtr || !SrcPtr)
3669 return PI_ERROR_INVALID_VALUE;
3671 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
3673 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
3674 const ur_event_handle_t *UrEventsWaitList =
3675 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
3677 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
3680 UrQueue, Blocking, DstPtr, DstPitch, SrcPtr, SrcPitch, Width, Height,
3681 NumEventsInWaitList, UrEventsWaitList, UREvent));
3694 const size_t *GlobalWorkOffset,
3695 const size_t *GlobalWorkSize,
const size_t *LocalWorkSize,
3699 PI_ASSERT(Kernel, PI_ERROR_INVALID_KERNEL);
3700 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
3701 PI_ASSERT((WorkDim > 0) && (WorkDim < 4), PI_ERROR_INVALID_WORK_DIMENSION);
3703 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
3704 ur_kernel_handle_t UrKernel =
reinterpret_cast<ur_kernel_handle_t
>(Kernel);
3705 const ur_event_handle_t *UrEventsWaitList =
3706 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
3708 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
3711 UrQueue, UrKernel, WorkDim, GlobalWorkOffset, GlobalWorkSize,
3712 LocalWorkSize, NumEventsInWaitList, UrEventsWaitList, UREvent));
3719 const size_t *GlobalWorkOffset,
const size_t *GlobalWorkSize,
3720 const size_t *LocalWorkSize,
pi_uint32 NumEventsInWaitList,
3723 PI_ASSERT(Kernel, PI_ERROR_INVALID_KERNEL);
3724 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
3725 PI_ASSERT((WorkDim > 0) && (WorkDim < 4), PI_ERROR_INVALID_WORK_DIMENSION);
3727 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
3728 ur_kernel_handle_t UrKernel =
reinterpret_cast<ur_kernel_handle_t
>(Kernel);
3729 const ur_event_handle_t *UrEventsWaitList =
3730 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
3732 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
3735 UrQueue, UrKernel, WorkDim, GlobalWorkOffset, GlobalWorkSize,
3736 LocalWorkSize, NumEventsInWaitList, UrEventsWaitList, UREvent));
3744 size_t InputRowPitch,
size_t InputSlicePitch,
3745 const void *Ptr,
pi_uint32 NumEventsInWaitList,
3748 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
3750 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
3751 ur_mem_handle_t UrImage =
reinterpret_cast<ur_mem_handle_t
>(Image);
3752 ur_rect_offset_t UrOrigin{Origin->
x, Origin->
y, Origin->
z};
3753 ur_rect_region_t UrRegion{};
3754 UrRegion.depth = Region->
depth;
3755 UrRegion.height = Region->
height;
3756 UrRegion.width = Region->
width;
3757 const ur_event_handle_t *UrEventsWaitList =
3758 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
3760 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
3763 UrQueue, UrImage, BlockingWrite, UrOrigin, UrRegion, InputRowPitch,
3764 InputSlicePitch,
const_cast<void *
>(Ptr), NumEventsInWaitList,
3765 UrEventsWaitList, UREvent));
3773 size_t RowPitch,
size_t SlicePitch,
void *Ptr,
3776 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
3778 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
3779 ur_mem_handle_t UrImage =
reinterpret_cast<ur_mem_handle_t
>(Image);
3780 ur_rect_offset_t UrOrigin{Origin->
x, Origin->
y, Origin->
z};
3781 ur_rect_region_t UrRegion{};
3782 UrRegion.depth = Region->
depth;
3783 UrRegion.height = Region->
height;
3784 UrRegion.width = Region->
width;
3785 const ur_event_handle_t *UrEventsWaitList =
3786 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
3788 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
3791 UrQueue, UrImage, BlockingRead, UrOrigin, UrRegion, RowPitch, SlicePitch,
3792 Ptr, NumEventsInWaitList, UrEventsWaitList, UREvent));
3799 size_t Offset,
size_t Size,
pi_uint32 NumEventsInWaitList,
3804 PI_ASSERT(Mem, PI_ERROR_INVALID_MEM_OBJECT);
3805 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
3807 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
3808 ur_mem_handle_t UrMem =
reinterpret_cast<ur_mem_handle_t
>(Mem);
3810 ur_map_flags_t UrMapFlags{};
3812 UrMapFlags |= UR_MAP_FLAG_READ;
3814 UrMapFlags |= UR_MAP_FLAG_WRITE;
3816 UrMapFlags |= UR_MAP_FLAG_WRITE_INVALIDATE_REGION;
3818 const ur_event_handle_t *UrEventsWaitList =
3819 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
3821 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
3823 HANDLE_ERRORS(urEnqueueMemBufferMap(UrQueue, UrMem, BlockingMap, UrMapFlags,
3824 Offset, Size, NumEventsInWaitList,
3825 UrEventsWaitList, UREvent, RetMap));
3835 PI_ASSERT(Mem, PI_ERROR_INVALID_MEM_OBJECT);
3836 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
3838 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
3839 ur_mem_handle_t UrMem =
reinterpret_cast<ur_mem_handle_t
>(Mem);
3840 const ur_event_handle_t *UrEventsWaitList =
3841 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
3843 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
3846 NumEventsInWaitList, UrEventsWaitList,
3853 const void *Pattern,
size_t PatternSize,
3854 size_t Offset,
size_t Size,
3858 PI_ASSERT(Buffer, PI_ERROR_INVALID_MEM_OBJECT);
3859 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
3861 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
3862 ur_mem_handle_t UrBuffer =
reinterpret_cast<ur_mem_handle_t
>(Buffer);
3863 const ur_event_handle_t *UrEventsWaitList =
3864 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
3866 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
3868 HANDLE_ERRORS(urEnqueueMemBufferFill(UrQueue, UrBuffer, Pattern, PatternSize,
3869 Offset, Size, NumEventsInWaitList,
3870 UrEventsWaitList, UREvent));
3879 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
3881 return PI_ERROR_INVALID_VALUE;
3884 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
3885 const ur_event_handle_t *UrEventsWaitList =
3886 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
3888 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
3890 size_t PatternSize = 1;
3891 HANDLE_ERRORS(urEnqueueUSMFill(UrQueue, Ptr, PatternSize, &Value, Count,
3892 NumEventsInWaitList, UrEventsWaitList,
3901 size_t SrcRowPitch,
size_t SrcSlicePitch,
size_t DstRowPitch,
3902 size_t DstSlicePitch,
pi_uint32 NumEventsInWaitList,
3905 PI_ASSERT(SrcMem && DstMem, PI_ERROR_INVALID_MEM_OBJECT);
3906 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
3908 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
3909 ur_mem_handle_t UrBufferSrc =
reinterpret_cast<ur_mem_handle_t
>(SrcMem);
3910 ur_mem_handle_t UrBufferDst =
reinterpret_cast<ur_mem_handle_t
>(DstMem);
3915 ur_rect_region_t UrRegion{};
3919 const ur_event_handle_t *UrEventsWaitList =
3920 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
3922 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
3925 UrQueue, UrBufferSrc, UrBufferDst, UrSrcOrigin, UrDstOrigin, UrRegion,
3926 SrcRowPitch, SrcSlicePitch, DstRowPitch, DstSlicePitch,
3927 NumEventsInWaitList, UrEventsWaitList, UREvent));
3933 pi_mem DstMem,
size_t SrcOffset,
3934 size_t DstOffset,
size_t Size,
3939 PI_ASSERT(SrcMem && DstMem, PI_ERROR_INVALID_MEM_OBJECT);
3940 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
3942 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
3943 ur_mem_handle_t UrBufferSrc =
reinterpret_cast<ur_mem_handle_t
>(SrcMem);
3944 ur_mem_handle_t UrBufferDst =
reinterpret_cast<ur_mem_handle_t
>(DstMem);
3945 const ur_event_handle_t *UrEventsWaitList =
3946 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
3948 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
3951 UrQueue, UrBufferSrc, UrBufferDst, SrcOffset, DstOffset, Size,
3952 NumEventsInWaitList, UrEventsWaitList, UREvent));
3958 void *DstPtr,
const void *SrcPtr,
3964 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
3965 const ur_event_handle_t *UrEventsWaitList =
3966 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
3968 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
3970 HANDLE_ERRORS(urEnqueueUSMMemcpy(UrQueue, Blocking, DstPtr, SrcPtr, Size,
3971 NumEventsInWaitList, UrEventsWaitList,
3981 size_t HostRowPitch,
size_t HostSlicePitch,
const void *Ptr,
3985 PI_ASSERT(Buffer, PI_ERROR_INVALID_MEM_OBJECT);
3986 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
3988 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
3989 ur_mem_handle_t UrBuffer =
reinterpret_cast<ur_mem_handle_t
>(Buffer);
3990 ur_rect_offset_t UrBufferOffset{BufferOffset->
x_bytes, BufferOffset->
y_scalar,
3992 ur_rect_offset_t UrHostOffset{HostOffset->
x_bytes, HostOffset->
y_scalar,
3994 ur_rect_region_t UrRegion{};
3998 const ur_event_handle_t *UrEventsWaitList =
3999 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
4001 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
4004 UrQueue, UrBuffer, BlockingWrite, UrBufferOffset, UrHostOffset, UrRegion,
4005 BufferRowPitch, BufferSlicePitch, HostRowPitch, HostSlicePitch,
4006 const_cast<void *
>(Ptr), NumEventsInWaitList, UrEventsWaitList, UREvent));
4012 pi_bool BlockingWrite,
size_t Offset,
4013 size_t Size,
const void *Ptr,
4018 PI_ASSERT(Buffer, PI_ERROR_INVALID_MEM_OBJECT);
4019 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
4021 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
4022 ur_mem_handle_t UrBuffer =
reinterpret_cast<ur_mem_handle_t
>(Buffer);
4023 const ur_event_handle_t *UrEventsWaitList =
4024 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
4026 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
4029 UrQueue, UrBuffer, BlockingWrite, Offset, Size,
const_cast<void *
>(Ptr),
4030 NumEventsInWaitList, UrEventsWaitList, UREvent));
4039 size_t HostRowPitch,
size_t HostSlicePitch,
void *Ptr,
4043 PI_ASSERT(Buffer, PI_ERROR_INVALID_MEM_OBJECT);
4044 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
4046 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
4047 ur_mem_handle_t UrBuffer =
reinterpret_cast<ur_mem_handle_t
>(Buffer);
4048 ur_rect_offset_t UrBufferOffset{BufferOffset->
x_bytes, BufferOffset->
y_scalar,
4050 ur_rect_offset_t UrHostOffset{HostOffset->
x_bytes, HostOffset->
y_scalar,
4052 ur_rect_region_t UrRegion{};
4057 const ur_event_handle_t *UrEventsWaitList =
4058 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
4060 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
4063 UrQueue, UrBuffer, BlockingRead, UrBufferOffset, UrHostOffset, UrRegion,
4064 BufferRowPitch, BufferSlicePitch, HostRowPitch, HostSlicePitch, Ptr,
4065 NumEventsInWaitList, UrEventsWaitList, UREvent));
4071 pi_bool BlockingRead,
size_t Offset,
4072 size_t Size,
void *Dst,
4076 PI_ASSERT(Src, PI_ERROR_INVALID_MEM_OBJECT);
4077 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
4079 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
4080 ur_mem_handle_t UrBuffer =
reinterpret_cast<ur_mem_handle_t
>(Src);
4081 const ur_event_handle_t *UrEventsWaitList =
4082 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
4084 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
4086 HANDLE_ERRORS(urEnqueueMemBufferRead(UrQueue, UrBuffer, BlockingRead, Offset,
4087 Size, Dst, NumEventsInWaitList,
4088 UrEventsWaitList, UREvent));
4098 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
4100 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
4101 const ur_event_handle_t *UrEventsWaitList =
4102 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
4104 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
4106 HANDLE_ERRORS(urEnqueueEventsWaitWithBarrier(UrQueue, NumEventsInWaitList,
4107 UrEventsWaitList, UREvent));
4117 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
4118 if (EventsWaitList) {
4119 PI_ASSERT(NumEventsInWaitList > 0, PI_ERROR_INVALID_VALUE);
4122 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
4123 const ur_event_handle_t *UrEventsWaitList =
4124 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
4126 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(OutEvent);
4128 HANDLE_ERRORS(urEnqueueEventsWait(UrQueue, NumEventsInWaitList,
4129 UrEventsWaitList, UREvent));
4136 const char *pipe_symbol,
pi_bool blocking,
void *ptr,
4137 size_t size,
pi_uint32 num_events_in_waitlist,
4139 auto hQueue =
reinterpret_cast<ur_queue_handle_t
>(queue);
4140 auto hProgram =
reinterpret_cast<ur_program_handle_t
>(program);
4141 auto phEventWaitList =
4142 reinterpret_cast<const ur_event_handle_t *
>(events_waitlist);
4143 auto phEvent =
reinterpret_cast<ur_event_handle_t *
>(event);
4145 HANDLE_ERRORS(urEnqueueReadHostPipe(hQueue, hProgram, pipe_symbol, blocking,
4146 ptr, size, num_events_in_waitlist,
4147 phEventWaitList, phEvent));
4154 const char *pipe_symbol,
pi_bool blocking,
void *ptr,
4155 size_t size,
pi_uint32 num_events_in_waitlist,
4157 auto hQueue =
reinterpret_cast<ur_queue_handle_t
>(queue);
4158 auto hProgram =
reinterpret_cast<ur_program_handle_t
>(program);
4159 auto phEventWaitList =
4160 reinterpret_cast<const ur_event_handle_t *
>(events_waitlist);
4161 auto phEvent =
reinterpret_cast<ur_event_handle_t *
>(event);
4163 HANDLE_ERRORS(urEnqueueWriteHostPipe(hQueue, hProgram, pipe_symbol, blocking,
4164 ptr, size, num_events_in_waitlist,
4165 phEventWaitList, phEvent));
4176 if (NumEvents && !EventsWaitList) {
4177 return PI_ERROR_INVALID_EVENT;
4180 const ur_event_handle_t *UrEventsWaitList =
4181 reinterpret_cast<const ur_event_handle_t *
>(EventsWaitList);
4189 size_t ParamValueSize,
void *ParamValue,
4190 size_t *ParamValueSizeRet) {
4192 PI_ASSERT(Event, PI_ERROR_INVALID_EVENT);
4194 ur_event_handle_t UREvent =
reinterpret_cast<ur_event_handle_t
>(Event);
4196 ur_event_info_t PropName{};
4198 PropName = UR_EVENT_INFO_COMMAND_QUEUE;
4200 PropName = UR_EVENT_INFO_CONTEXT;
4202 PropName = UR_EVENT_INFO_COMMAND_TYPE;
4204 PropName = UR_EVENT_INFO_COMMAND_EXECUTION_STATUS;
4206 PropName = UR_EVENT_INFO_REFERENCE_COUNT;
4208 return PI_ERROR_INVALID_VALUE;
4211 HANDLE_ERRORS(urEventGetInfo(UREvent, PropName, ParamValueSize, ParamValue,
4212 ParamValueSizeRet));
4220 PI_ASSERT(Event, PI_ERROR_INVALID_EVENT);
4221 PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);
4223 ur_event_handle_t UREvent =
reinterpret_cast<ur_event_handle_t
>(Event);
4225 ur_native_handle_t *UrNativeEvent =
4226 reinterpret_cast<ur_native_handle_t *
>(NativeHandle);
4227 HANDLE_ERRORS(urEventGetNativeHandle(UREvent, UrNativeEvent));
4234 size_t ParamValueSize,
4236 size_t *ParamValueSizeRet) {
4238 PI_ASSERT(Event, PI_ERROR_INVALID_EVENT);
4240 ur_event_handle_t UREvent =
reinterpret_cast<ur_event_handle_t
>(Event);
4242 ur_profiling_info_t PropName{};
4243 switch (ParamName) {
4245 PropName = UR_PROFILING_INFO_COMMAND_QUEUED;
4249 PropName = UR_PROFILING_INFO_COMMAND_SUBMIT;
4253 PropName = UR_PROFILING_INFO_COMMAND_START;
4257 PropName = UR_PROFILING_INFO_COMMAND_END;
4261 return PI_ERROR_INVALID_PROPERTY;
4264 HANDLE_ERRORS(urEventGetProfilingInfo(UREvent, PropName, ParamValueSize,
4265 ParamValue, ParamValueSizeRet));
4272 ur_context_handle_t UrContext =
4273 reinterpret_cast<ur_context_handle_t
>(Context);
4275 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(RetEvent);
4278 ur_event_native_properties_t Properties{};
4280 urEventCreateWithNativeHandle(
nullptr, UrContext, &Properties, UREvent));
4287 bool OwnNativeHandle,
4290 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
4291 PI_ASSERT(Event, PI_ERROR_INVALID_EVENT);
4292 PI_ASSERT(NativeHandle, PI_ERROR_INVALID_VALUE);
4294 ur_native_handle_t UrNativeKernel =
4295 reinterpret_cast<ur_native_handle_t
>(NativeHandle);
4297 ur_context_handle_t UrContext =
4298 reinterpret_cast<ur_context_handle_t
>(Context);
4300 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(Event);
4301 ur_event_native_properties_t Properties{};
4302 Properties.isNativeHandleOwned = OwnNativeHandle;
4303 HANDLE_ERRORS(urEventCreateWithNativeHandle(UrNativeKernel, UrContext,
4304 &Properties, UREvent));
4314 std::ignore = Event;
4315 std::ignore = CommandExecCallbackType;
4316 std::ignore = PFnNotify;
4317 std::ignore = UserData;
4318 die(
"piEventSetCallback: deprecated, to be removed");
4323 std::ignore = Event;
4324 std::ignore = ExecutionStatus;
4325 die(
"piEventSetStatus: deprecated, to be removed");
4330 PI_ASSERT(Event, PI_ERROR_INVALID_EVENT);
4332 ur_event_handle_t UREvent =
reinterpret_cast<ur_event_handle_t
>(Event);
4339 PI_ASSERT(Event, PI_ERROR_INVALID_EVENT);
4341 ur_event_handle_t UREvent =
reinterpret_cast<ur_event_handle_t
>(Event);
4356 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
4357 PI_ASSERT(RetSampler, PI_ERROR_INVALID_VALUE);
4359 ur_context_handle_t UrContext =
4360 reinterpret_cast<ur_context_handle_t
>(Context);
4361 ur_sampler_desc_t UrProps{};
4362 UrProps.stype = UR_STRUCTURE_TYPE_SAMPLER_DESC;
4365 while (*CurProperty != 0) {
4366 switch (*CurProperty) {
4368 UrProps.normalizedCoords = ur_cast<pi_bool>(*(++CurProperty));
4373 ur_cast<pi_sampler_addressing_mode>(
4374 ur_cast<pi_uint32>(*(++CurProperty)));
4377 UrProps.addressingMode = UR_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT;
4379 UrProps.addressingMode = UR_SAMPLER_ADDRESSING_MODE_REPEAT;
4380 else if (CurValueAddressingMode ==
4382 UrProps.addressingMode = UR_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE;
4384 UrProps.addressingMode = UR_SAMPLER_ADDRESSING_MODE_CLAMP;
4386 UrProps.addressingMode = UR_SAMPLER_ADDRESSING_MODE_NONE;
4391 ur_cast<pi_sampler_filter_mode>(ur_cast<pi_uint32>(*(++CurProperty)));
4394 UrProps.filterMode = UR_SAMPLER_FILTER_MODE_NEAREST;
4396 UrProps.filterMode = UR_SAMPLER_FILTER_MODE_LINEAR;
4405 ur_sampler_handle_t *UrSampler =
4406 reinterpret_cast<ur_sampler_handle_t *
>(RetSampler);
4408 HANDLE_ERRORS(urSamplerCreate(UrContext, &UrProps, UrSampler));
4414 size_t ParamValueSize,
void *ParamValue,
4415 size_t *ParamValueSizeRet) {
4416 ur_sampler_info_t InfoType{};
4417 switch (ParamName) {
4419 InfoType = UR_SAMPLER_INFO_REFERENCE_COUNT;
4422 InfoType = UR_SAMPLER_INFO_CONTEXT;
4425 InfoType = UR_SAMPLER_INFO_NORMALIZED_COORDS;
4428 InfoType = UR_SAMPLER_INFO_ADDRESSING_MODE;
4431 InfoType = UR_SAMPLER_INFO_FILTER_MODE;
4434 return PI_ERROR_UNKNOWN;
4437 size_t UrParamValueSizeRet;
4438 auto hSampler =
reinterpret_cast<ur_sampler_handle_t
>(Sampler);
4439 HANDLE_ERRORS(urSamplerGetInfo(hSampler, InfoType, ParamValueSize, ParamValue,
4440 &UrParamValueSizeRet));
4441 if (ParamValueSizeRet) {
4442 *ParamValueSizeRet = UrParamValueSizeRet;
4453 ur_kernel_handle_t UrKernel =
reinterpret_cast<ur_kernel_handle_t
>(Kernel);
4454 ur_sampler_handle_t UrSampler =
4455 reinterpret_cast<ur_sampler_handle_t
>(*ArgValue);
4457 HANDLE_ERRORS(urKernelSetArgSampler(UrKernel, ArgIndex,
nullptr, UrSampler));
4463 PI_ASSERT(Sampler, PI_ERROR_INVALID_SAMPLER);
4465 ur_sampler_handle_t UrSampler =
4466 reinterpret_cast<ur_sampler_handle_t
>(Sampler);
4474 PI_ASSERT(Sampler, PI_ERROR_INVALID_SAMPLER);
4476 ur_sampler_handle_t UrSampler =
4477 reinterpret_cast<ur_sampler_handle_t
>(Sampler);
4494 ur_context_handle_t UrContext =
4495 reinterpret_cast<ur_context_handle_t
>(Context);
4496 ur_device_handle_t UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
4497 ur_exp_command_buffer_desc_t UrDesc;
4498 UrDesc.stype = UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC;
4500 ur_exp_command_buffer_handle_t *UrCommandBuffer =
4501 reinterpret_cast<ur_exp_command_buffer_handle_t *
>(RetCommandBuffer);
4504 urCommandBufferCreateExp(UrContext, UrDevice, &UrDesc, UrCommandBuffer));
4510 ur_exp_command_buffer_handle_t UrCommandBuffer =
4511 reinterpret_cast<ur_exp_command_buffer_handle_t
>(CommandBuffer);
4520 ur_exp_command_buffer_handle_t UrCommandBuffer =
4521 reinterpret_cast<ur_exp_command_buffer_handle_t
>(CommandBuffer);
4530 ur_exp_command_buffer_handle_t UrCommandBuffer =
4531 reinterpret_cast<ur_exp_command_buffer_handle_t
>(CommandBuffer);
4540 const size_t *GlobalWorkOffset,
const size_t *GlobalWorkSize,
4541 const size_t *LocalWorkSize,
pi_uint32 NumSyncPointsInWaitList,
4544 ur_exp_command_buffer_handle_t UrCommandBuffer =
4545 reinterpret_cast<ur_exp_command_buffer_handle_t
>(CommandBuffer);
4547 ur_kernel_handle_t UrKernel =
reinterpret_cast<ur_kernel_handle_t
>(Kernel);
4548 ur_exp_command_buffer_command_handle_t *UrCommandHandle =
4549 reinterpret_cast<ur_exp_command_buffer_command_handle_t *
>(Command);
4551 UrCommandBuffer, UrKernel, WorkDim, GlobalWorkOffset, GlobalWorkSize,
4552 LocalWorkSize, NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint,
4560 size_t Size,
pi_uint32 NumSyncPointsInWaitList,
4562 ur_exp_command_buffer_handle_t UrCommandBuffer =
4563 reinterpret_cast<ur_exp_command_buffer_handle_t
>(CommandBuffer);
4566 UrCommandBuffer, DstPtr, SrcPtr, Size, NumSyncPointsInWaitList,
4567 SyncPointWaitList, SyncPoint));
4574 size_t SrcOffset,
size_t DstOffset,
size_t Size,
4577 ur_exp_command_buffer_handle_t UrCommandBuffer =
4578 reinterpret_cast<ur_exp_command_buffer_handle_t
>(CommandBuffer);
4580 ur_mem_handle_t UrSrcMem =
reinterpret_cast<ur_mem_handle_t
>(SrcMem);
4581 ur_mem_handle_t UrDstMem =
reinterpret_cast<ur_mem_handle_t
>(DstMem);
4584 UrCommandBuffer, UrSrcMem, UrDstMem, SrcOffset, DstOffset, Size,
4585 NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint));
4594 size_t DstRowPitch,
size_t DstSlicePitch,
pi_uint32 NumSyncPointsInWaitList,
4596 ur_exp_command_buffer_handle_t UrCommandBuffer =
4597 reinterpret_cast<ur_exp_command_buffer_handle_t
>(CommandBuffer);
4599 ur_mem_handle_t UrSrcMem =
reinterpret_cast<ur_mem_handle_t
>(SrcMem);
4600 ur_mem_handle_t UrDstMem =
reinterpret_cast<ur_mem_handle_t
>(DstMem);
4606 ur_rect_region_t UrRegion{};
4612 UrCommandBuffer, UrSrcMem, UrDstMem, UrSrcOrigin, UrDstOrigin, UrRegion,
4613 SrcRowPitch, SrcSlicePitch, DstRowPitch, DstSlicePitch,
4614 NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint));
4623 size_t HostRowPitch,
size_t HostSlicePitch,
void *Ptr,
4627 PI_ASSERT(Buffer, PI_ERROR_INVALID_MEM_OBJECT);
4629 ur_exp_command_buffer_handle_t UrCommandBuffer =
4630 reinterpret_cast<ur_exp_command_buffer_handle_t
>(CommandBuffer);
4631 ur_mem_handle_t UrBuffer =
reinterpret_cast<ur_mem_handle_t
>(Buffer);
4632 ur_rect_offset_t UrBufferOffset{BufferOffset->
x_bytes, BufferOffset->
y_scalar,
4634 ur_rect_offset_t UrHostOffset{HostOffset->
x_bytes, HostOffset->
y_scalar,
4636 ur_rect_region_t UrRegion{};
4642 UrCommandBuffer, UrBuffer, UrBufferOffset, UrHostOffset, UrRegion,
4643 BufferRowPitch, BufferSlicePitch, HostRowPitch, HostSlicePitch, Ptr,
4644 NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint));
4651 void *Dst,
pi_uint32 NumSyncPointsInWaitList,
4653 PI_ASSERT(Src, PI_ERROR_INVALID_MEM_OBJECT);
4655 ur_exp_command_buffer_handle_t UrCommandBuffer =
4656 reinterpret_cast<ur_exp_command_buffer_handle_t
>(CommandBuffer);
4657 ur_mem_handle_t UrBuffer =
reinterpret_cast<ur_mem_handle_t
>(Src);
4660 UrCommandBuffer, UrBuffer, Offset, Size, Dst, NumSyncPointsInWaitList,
4661 SyncPointWaitList, SyncPoint));
4670 size_t HostRowPitch,
size_t HostSlicePitch,
const void *Ptr,
4674 PI_ASSERT(Buffer, PI_ERROR_INVALID_MEM_OBJECT);
4676 ur_exp_command_buffer_handle_t UrCommandBuffer =
4677 reinterpret_cast<ur_exp_command_buffer_handle_t
>(CommandBuffer);
4678 ur_mem_handle_t UrBuffer =
reinterpret_cast<ur_mem_handle_t
>(Buffer);
4679 ur_rect_offset_t UrBufferOffset{BufferOffset->
x_bytes, BufferOffset->
y_scalar,
4681 ur_rect_offset_t UrHostOffset{HostOffset->
x_bytes, HostOffset->
y_scalar,
4683 ur_rect_region_t UrRegion{};
4689 UrCommandBuffer, UrBuffer, UrBufferOffset, UrHostOffset, UrRegion,
4690 BufferRowPitch, BufferSlicePitch, HostRowPitch, HostSlicePitch,
4691 const_cast<void *
>(Ptr), NumSyncPointsInWaitList, SyncPointWaitList,
4699 size_t Size,
const void *Ptr,
pi_uint32 NumSyncPointsInWaitList,
4702 PI_ASSERT(Buffer, PI_ERROR_INVALID_MEM_OBJECT);
4704 ur_exp_command_buffer_handle_t UrCommandBuffer =
4705 reinterpret_cast<ur_exp_command_buffer_handle_t
>(CommandBuffer);
4706 ur_mem_handle_t UrBuffer =
reinterpret_cast<ur_mem_handle_t
>(Buffer);
4709 UrCommandBuffer, UrBuffer, Offset, Size,
const_cast<void *
>(Ptr),
4710 NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint));
4717 size_t PatternSize,
size_t Offset,
size_t Size,
4720 PI_ASSERT(Buffer, PI_ERROR_INVALID_MEM_OBJECT);
4722 ur_exp_command_buffer_handle_t UrCommandBuffer =
4723 reinterpret_cast<ur_exp_command_buffer_handle_t
>(CommandBuffer);
4724 ur_mem_handle_t UrBuffer =
reinterpret_cast<ur_mem_handle_t
>(Buffer);
4727 UrCommandBuffer, UrBuffer, Pattern, PatternSize, Offset, Size,
4728 NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint));
4734 size_t PatternSize,
size_t Size,
pi_uint32 NumSyncPointsInWaitList,
4737 ur_exp_command_buffer_handle_t UrCommandBuffer =
4738 reinterpret_cast<ur_exp_command_buffer_handle_t
>(CommandBuffer);
4741 UrCommandBuffer, Ptr, Pattern, PatternSize, Size, NumSyncPointsInWaitList,
4742 SyncPointWaitList, SyncPoint));
4752 PI_ASSERT(Flags == 0, PI_ERROR_INVALID_VALUE);
4754 ur_exp_command_buffer_handle_t UrCommandBuffer =
4755 reinterpret_cast<ur_exp_command_buffer_handle_t
>(CommandBuffer);
4760 ur_usm_migration_flags_t UrFlags{};
4762 UrCommandBuffer, Ptr, Size, UrFlags, NumSyncPointsInWaitList,
4763 SyncPointWaitList, SyncPoint));
4772 ur_exp_command_buffer_handle_t UrCommandBuffer =
4773 reinterpret_cast<ur_exp_command_buffer_handle_t
>(CommandBuffer);
4775 ur_usm_advice_flags_t UrAdvice{};
4777 UrAdvice |= UR_USM_ADVICE_FLAG_SET_READ_MOSTLY;
4780 UrAdvice |= UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY;
4783 UrAdvice |= UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION;
4786 UrAdvice |= UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION;
4789 UrAdvice |= UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE;
4792 UrAdvice |= UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE;
4795 UrAdvice |= UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST;
4798 UrAdvice |= UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_HOST;
4801 UrAdvice |= UR_USM_ADVICE_FLAG_DEFAULT;
4805 UrCommandBuffer, Ptr, Length, UrAdvice, NumSyncPointsInWaitList,
4806 SyncPointWaitList, SyncPoint));
4816 ur_exp_command_buffer_handle_t UrCommandBuffer =
4817 reinterpret_cast<ur_exp_command_buffer_handle_t
>(CommandBuffer);
4819 ur_queue_handle_t UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
4820 const ur_event_handle_t *UrEventWaitList =
4821 reinterpret_cast<const ur_event_handle_t *
>(EventWaitList);
4822 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(Event);
4825 UrCommandBuffer, UrQueue, NumEventsInWaitList, UrEventWaitList, UREvent));
4833 ur_exp_command_buffer_command_handle_t UrCommand =
4834 reinterpret_cast<ur_exp_command_buffer_command_handle_t
>(command);
4835 ur_exp_command_buffer_update_kernel_launch_desc_t UrDesc;
4837 UrDesc.stype = ur_structure_type_t::
4838 UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_EXEC_INFO_DESC;
4845 UrDesc.numNewExecInfos = 0;
4846 UrDesc.pNewExecInfoList =
nullptr;
4849 std::vector<ur_exp_command_buffer_update_memobj_arg_desc_t> UrMemObjDescs;
4850 std::vector<ur_exp_command_buffer_update_pointer_arg_desc_t> UrPointerDescs;
4851 std::vector<ur_exp_command_buffer_update_value_arg_desc_t> UrValueDescs;
4853 for (
size_t i = 0; i < UrDesc.numNewMemObjArgs; i++) {
4855 UrMemObjDescs.push_back(
4856 {ur_structure_type_t::
4857 UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_MEMOBJ_ARG_DESC,
4858 nullptr, PiDesc.arg_index,
nullptr,
4859 reinterpret_cast<ur_mem_handle_t
>(PiDesc.new_mem_obj)});
4861 UrDesc.pNewMemObjArgList = UrMemObjDescs.data();
4863 for (
size_t i = 0; i < UrDesc.numNewPointerArgs; i++) {
4865 UrPointerDescs.push_back(
4866 {ur_structure_type_t::
4867 UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_POINTER_ARG_DESC,
4868 nullptr, PiDesc.arg_index,
nullptr, PiDesc.new_ptr});
4870 UrDesc.pNewPointerArgList = UrPointerDescs.data();
4872 for (
size_t i = 0; i < UrDesc.numNewValueArgs; i++) {
4874 UrValueDescs.push_back(
4875 {ur_structure_type_t::
4876 UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_UPDATE_VALUE_ARG_DESC,
4877 nullptr, PiDesc.arg_index, PiDesc.arg_size,
nullptr,
4880 UrDesc.pNewValueArgList = UrValueDescs.data();
4886 HANDLE_ERRORS(urCommandBufferUpdateKernelLaunchExp(UrCommand, &UrDesc));
4893 ur_exp_command_buffer_command_handle_t UrCommand =
4894 reinterpret_cast<ur_exp_command_buffer_command_handle_t
>(command);
4901 ur_exp_command_buffer_command_handle_t UrCommand =
4902 reinterpret_cast<ur_exp_command_buffer_command_handle_t
>(command);
4915 auto commandDevice =
reinterpret_cast<ur_device_handle_t
>(command_device);
4916 auto peerDevice =
reinterpret_cast<ur_device_handle_t
>(peer_device);
4918 HANDLE_ERRORS(urUsmP2PEnablePeerAccessExp(commandDevice, peerDevice));
4925 auto commandDevice =
reinterpret_cast<ur_device_handle_t
>(command_device);
4926 auto peerDevice =
reinterpret_cast<ur_device_handle_t
>(peer_device);
4928 HANDLE_ERRORS(urUsmP2PDisablePeerAccessExp(commandDevice, peerDevice));
4936 void *param_value,
size_t *param_value_size_ret) {
4937 auto commandDevice =
reinterpret_cast<ur_device_handle_t
>(command_device);
4938 auto peerDevice =
reinterpret_cast<ur_device_handle_t
>(peer_device);
4940 ur_exp_peer_info_t propName;
4943 propName = UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED;
4947 propName = UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORTED;
4951 return PI_ERROR_INVALID_VALUE;
4956 commandDevice, peerDevice, propName, param_value_size, param_value,
4957 param_value_size_ret));
4972 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
4973 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
4975 auto UrContext =
reinterpret_cast<ur_context_handle_t
>(Context);
4976 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
4978 ur_image_format_t UrFormat{};
4979 ur_image_desc_t UrDesc{};
4982 ur_exp_image_mem_handle_t *UrRetMem =
4983 reinterpret_cast<ur_exp_image_mem_handle_t *
>(RetMem);
4985 HANDLE_ERRORS(urBindlessImagesImageAllocateExp(UrContext, UrDevice, &UrFormat,
4986 &UrDesc, UrRetMem));
4995 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
4996 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
4997 PI_ASSERT(RetMem, PI_ERROR_INVALID_MEM_OBJECT);
4999 auto UrContext =
reinterpret_cast<ur_context_handle_t
>(Context);
5000 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
5001 auto UrImgMem =
reinterpret_cast<ur_exp_image_mem_handle_t
>(ImgMem);
5003 ur_image_format_t UrFormat{};
5004 ur_image_desc_t UrDesc{};
5007 ur_mem_handle_t *UrRetMem =
reinterpret_cast<ur_mem_handle_t *
>(RetMem);
5008 ur_exp_image_handle_t *UrRetHandle =
5009 reinterpret_cast<ur_exp_image_handle_t *
>(RetHandle);
5012 UrContext, UrDevice, UrImgMem, &UrFormat, &UrDesc, UrRetMem,
5022 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
5023 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
5024 PI_ASSERT(RetMem, PI_ERROR_INVALID_MEM_OBJECT);
5025 PI_ASSERT(Sampler, PI_ERROR_INVALID_SAMPLER);
5027 auto UrContext =
reinterpret_cast<ur_context_handle_t
>(Context);
5028 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
5029 auto UrImgMem =
reinterpret_cast<ur_exp_image_mem_handle_t
>(ImgMem);
5031 ur_image_format_t UrFormat{};
5032 ur_image_desc_t UrDesc{};
5035 auto UrSampler =
reinterpret_cast<ur_sampler_handle_t
>(Sampler);
5036 ur_mem_handle_t *UrRetMem =
reinterpret_cast<ur_mem_handle_t *
>(RetMem);
5037 ur_exp_image_handle_t *UrRetHandle =
5038 reinterpret_cast<ur_exp_image_handle_t *
>(RetHandle);
5041 UrContext, UrDevice, UrImgMem, &UrFormat, &UrDesc, UrSampler, UrRetMem,
5049 float MinMipmapLevelClamp,
float MaxMipmapLevelClamp,
float MaxAnisotropy,
5052 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
5053 PI_ASSERT(RetSampler, PI_ERROR_INVALID_VALUE);
5055 auto UrContext =
reinterpret_cast<ur_context_handle_t
>(Context);
5056 ur_sampler_desc_t UrProps{};
5057 UrProps.stype = UR_STRUCTURE_TYPE_SAMPLER_DESC;
5059 ur_exp_sampler_mip_properties_t UrMipProps{};
5060 UrMipProps.stype = UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES;
5061 UrMipProps.minMipmapLevelClamp = MinMipmapLevelClamp;
5062 UrMipProps.maxMipmapLevelClamp = MaxMipmapLevelClamp;
5063 UrMipProps.maxAnisotropy = MaxAnisotropy;
5064 UrProps.pNext = &UrMipProps;
5066 ur_exp_sampler_addr_modes_t UrAddrModes{};
5067 UrAddrModes.stype = UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES;
5068 UrMipProps.pNext = &UrAddrModes;
5071 ur_exp_sampler_cubemap_properties_t UrCubemapProps{};
5072 UrCubemapProps.stype = UR_STRUCTURE_TYPE_EXP_SAMPLER_CUBEMAP_PROPERTIES;
5073 UrAddrModes.pNext = &UrCubemapProps;
5076 while (*CurProperty != 0) {
5077 switch (*CurProperty) {
5079 UrProps.normalizedCoords = ur_cast<pi_bool>(*(++CurProperty));
5084 ur_cast<pi_sampler_addressing_mode>(
5085 ur_cast<pi_uint32>(*(++CurProperty)));
5087 if (CurValueAddressingMode ==
5089 UrAddrModes.addrModes[addrIndex] =
5090 UR_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT;
5092 UrAddrModes.addrModes[addrIndex] = UR_SAMPLER_ADDRESSING_MODE_REPEAT;
5093 }
else if (CurValueAddressingMode ==
5095 UrAddrModes.addrModes[addrIndex] =
5096 UR_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE;
5098 UrAddrModes.addrModes[addrIndex] = UR_SAMPLER_ADDRESSING_MODE_CLAMP;
5100 UrAddrModes.addrModes[addrIndex] = UR_SAMPLER_ADDRESSING_MODE_NONE;
5107 ur_cast<pi_sampler_filter_mode>(ur_cast<pi_uint32>(*(++CurProperty)));
5110 UrProps.filterMode = UR_SAMPLER_FILTER_MODE_NEAREST;
5112 UrProps.filterMode = UR_SAMPLER_FILTER_MODE_LINEAR;
5117 ur_cast<pi_sampler_filter_mode>(ur_cast<pi_uint32>(*(++CurProperty)));
5120 UrMipProps.mipFilterMode = UR_SAMPLER_FILTER_MODE_NEAREST;
5122 UrMipProps.mipFilterMode = UR_SAMPLER_FILTER_MODE_LINEAR;
5127 ur_cast<pi_sampler_cubemap_filter_mode>(
5128 ur_cast<pi_uint32>(*(++CurProperty)));
5131 UrCubemapProps.cubemapFilterMode =
5132 UR_EXP_SAMPLER_CUBEMAP_FILTER_MODE_SEAMLESS;
5134 UrCubemapProps.cubemapFilterMode =
5135 UR_EXP_SAMPLER_CUBEMAP_FILTER_MODE_DISJOINTED;
5144 UrProps.addressingMode = UrAddrModes.addrModes[0];
5146 ur_sampler_handle_t *UrSampler =
5147 reinterpret_cast<ur_sampler_handle_t *
>(RetSampler);
5149 HANDLE_ERRORS(urSamplerCreate(UrContext, &UrProps, UrSampler));
5158 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
5159 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
5161 auto UrContext =
reinterpret_cast<ur_context_handle_t
>(Context);
5162 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
5163 auto UrMipMem =
reinterpret_cast<ur_exp_image_mem_handle_t
>(MipMem);
5164 ur_exp_image_mem_handle_t *UrRetMem =
5165 reinterpret_cast<ur_exp_image_mem_handle_t *
>(RetMem);
5167 HANDLE_ERRORS(urBindlessImagesMipmapGetLevelExp(UrContext, UrDevice, UrMipMem,
5175 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
5176 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
5178 auto UrContext =
reinterpret_cast<ur_context_handle_t
>(Context);
5179 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
5180 auto UrMemoryHandle =
5181 reinterpret_cast<ur_exp_image_mem_handle_t
>(MemoryHandle);
5184 urBindlessImagesImageFreeExp(UrContext, UrDevice, UrMemoryHandle));
5191 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
5192 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
5194 auto UrContext =
reinterpret_cast<ur_context_handle_t
>(Context);
5195 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
5196 auto UrMemoryHandle =
5197 reinterpret_cast<ur_exp_image_mem_handle_t
>(MemoryHandle);
5200 urBindlessImagesMipmapFreeExp(UrContext, UrDevice, UrMemoryHandle));
5206 ur_exp_image_copy_flags_t *UrFlags) {
5209 *UrFlags = UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE;
5212 *UrFlags = UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST;
5215 *UrFlags = UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE;
5218 die(
"pi2urImageCopyFlags: Unsupported use case");
5230 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
5232 auto UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
5234 ur_image_format_t UrFormat{};
5235 ur_image_desc_t UrDesc{};
5238 ur_exp_image_copy_flags_t UrFlags;
5241 ur_rect_offset_t UrSrcOffset{SrcOffset->
x, SrcOffset->
y, SrcOffset->
z};
5242 ur_rect_offset_t UrDstOffset{DstOffset->
x, DstOffset->
y, DstOffset->
z};
5243 ur_rect_region_t UrCopyExtent{};
5244 UrCopyExtent.depth = CopyExtent->
depth;
5245 UrCopyExtent.height = CopyExtent->
height;
5246 UrCopyExtent.width = CopyExtent->
width;
5247 ur_rect_region_t UrHostExtent{};
5248 UrHostExtent.depth = HostExtent->
depth;
5249 UrHostExtent.height = HostExtent->
height;
5250 UrHostExtent.width = HostExtent->
width;
5252 const ur_event_handle_t *UrEventWaitList =
5253 reinterpret_cast<const ur_event_handle_t *
>(EventWaitList);
5254 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(Event);
5257 UrQueue, DstPtr, SrcPtr, &UrFormat, &UrDesc, UrFlags, UrSrcOffset,
5258 UrDstOffset, UrCopyExtent, UrHostExtent, NumEventsInWaitList,
5259 UrEventWaitList, UREvent));
5267 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
5268 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
5270 auto UrContext =
reinterpret_cast<ur_context_handle_t
>(Context);
5271 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
5272 auto UrHandle =
reinterpret_cast<ur_exp_image_handle_t
>(Handle);
5274 HANDLE_ERRORS(urBindlessImagesUnsampledImageHandleDestroyExp(
5275 UrContext, UrDevice, UrHandle));
5283 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
5284 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
5286 auto UrContext =
reinterpret_cast<ur_context_handle_t
>(Context);
5287 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
5288 auto UrHandle =
reinterpret_cast<ur_exp_image_handle_t
>(Handle);
5291 UrContext, UrDevice, UrHandle));
5297 ur_image_info_t *UrFlags) {
5299 #define PI_TO_UR_IMAGE_INFO(FROM, TO) \
5311 #undef PI_TO_UR_IMAGE_INFO
5313 die(
"pi2urImageInfoFlags: Unsupported use case");
5319 size_t *ParamValueSizeRet) {
5320 auto UrMemHandle =
reinterpret_cast<ur_exp_image_mem_handle_t
>(MemHandle);
5322 ur_image_info_t UrParamName{};
5325 HANDLE_ERRORS(urBindlessImagesImageGetInfoExp(UrMemHandle, UrParamName,
5326 ParamValue, ParamValueSizeRet));
5332 reinterpret_cast<pi_image_format *
>(ParamValue)->image_channel_data_type =
5336 if (ParamValueSizeRet) {
5345 size_t Size,
int FileDescriptor,
5347 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
5348 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
5350 auto UrContext =
reinterpret_cast<ur_context_handle_t
>(Context);
5351 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
5352 ur_exp_interop_mem_handle_t *UrRetHandle =
5353 reinterpret_cast<ur_exp_interop_mem_handle_t *
>(RetHandle);
5355 ur_exp_file_descriptor_t PosixFD{};
5356 PosixFD.stype = UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR;
5357 PosixFD.fd = FileDescriptor;
5359 ur_exp_interop_mem_desc_t InteropMemDesc{};
5360 InteropMemDesc.stype = UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC;
5361 InteropMemDesc.pNext = &PosixFD;
5364 UrContext, UrDevice, Size, &InteropMemDesc, UrRetHandle));
5374 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
5375 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
5377 auto UrContext =
reinterpret_cast<ur_context_handle_t
>(Context);
5378 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
5380 ur_image_format_t UrFormat{};
5381 ur_image_desc_t UrDesc{};
5384 auto UrMemHandle =
reinterpret_cast<ur_exp_interop_mem_handle_t
>(MemHandle);
5385 ur_exp_image_mem_handle_t *UrRetMem =
5386 reinterpret_cast<ur_exp_image_mem_handle_t *
>(RetMem);
5389 UrContext, UrDevice, &UrFormat, &UrDesc, UrMemHandle, UrRetMem));
5396 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
5397 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
5399 auto UrContext =
reinterpret_cast<ur_context_handle_t
>(Context);
5400 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
5401 auto UrExtMem =
reinterpret_cast<ur_exp_interop_mem_handle_t
>(ExtMem);
5404 urBindlessImagesReleaseInteropExp(UrContext, UrDevice, UrExtMem));
5413 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
5414 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
5416 auto UrContext =
reinterpret_cast<ur_context_handle_t
>(Context);
5417 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
5418 ur_exp_interop_semaphore_handle_t *UrRetHandle =
5419 reinterpret_cast<ur_exp_interop_semaphore_handle_t *
>(RetHandle);
5421 ur_exp_file_descriptor_t PosixFD{};
5422 PosixFD.stype = UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR;
5423 PosixFD.fd = FileDescriptor;
5425 ur_exp_interop_semaphore_desc_t InteropSemDesc{};
5426 InteropSemDesc.stype = UR_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC;
5427 InteropSemDesc.pNext = &PosixFD;
5429 HANDLE_ERRORS(urBindlessImagesImportExternalSemaphoreOpaqueFDExp(
5430 UrContext, UrDevice, &InteropSemDesc, UrRetHandle));
5438 PI_ASSERT(Context, PI_ERROR_INVALID_CONTEXT);
5439 PI_ASSERT(Device, PI_ERROR_INVALID_DEVICE);
5441 auto UrContext =
reinterpret_cast<ur_context_handle_t
>(Context);
5442 auto UrDevice =
reinterpret_cast<ur_device_handle_t
>(Device);
5444 reinterpret_cast<ur_exp_interop_semaphore_handle_t
>(SemHandle);
5446 HANDLE_ERRORS(urBindlessImagesDestroyExternalSemaphoreExp(UrContext, UrDevice,
5457 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
5459 auto UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
5461 reinterpret_cast<ur_exp_interop_semaphore_handle_t
>(SemHandle);
5462 const ur_event_handle_t *UrEventWaitList =
5463 reinterpret_cast<const ur_event_handle_t *
>(EventWaitList);
5464 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(Event);
5467 UrQueue, UrSemHandle, NumEventsInWaitList, UrEventWaitList, UREvent));
5477 PI_ASSERT(Queue, PI_ERROR_INVALID_QUEUE);
5479 auto UrQueue =
reinterpret_cast<ur_queue_handle_t
>(Queue);
5481 reinterpret_cast<ur_exp_interop_semaphore_handle_t
>(SemHandle);
5482 const ur_event_handle_t *UrEventWaitList =
5483 reinterpret_cast<const ur_event_handle_t *
>(EventWaitList);
5484 ur_event_handle_t *UREvent =
reinterpret_cast<ur_event_handle_t *
>(Event);
5487 UrQueue, UrSemHandle, NumEventsInWaitList, UrEventWaitList, UREvent));
pi_result convert(std::function< TypePI(TypeUR)> Func)
pi_result convertBitSet(std::function< TypePI(TypeUR)> Func)
pi_result convertArray(std::function< TypePI(TypeUR)> Func)
pi_result operator()(const T *t, size_t s)
pi_result operator()(const T &t)
pi_result operator()(const T *t, size_t s)
#define __SYCL_PI_CUDA_SYNC_WITH_DEFAULT
#define __SYCL_PI_CUDA_USE_DEFAULT_STREAM
pi_result piextUSMEnqueueMemset(pi_queue Queue, void *Ptr, pi_int32 Value, size_t Count, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
pi_result piEnqueueMemImageFill(pi_queue Queue, pi_mem Image, const void *FillColor, const size_t *Origin, const size_t *Region, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *Event)
pi_result piextCommandBufferMemBufferWriteRect(pi_ext_command_buffer CommandBuffer, pi_mem Buffer, pi_buff_rect_offset BufferOffset, pi_buff_rect_offset HostOffset, pi_buff_rect_region Region, size_t BufferRowPitch, size_t BufferSlicePitch, size_t HostRowPitch, size_t HostSlicePitch, const void *Ptr, pi_uint32 NumSyncPointsInWaitList, const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint)
pi_result piProgramGetInfo(pi_program Program, pi_program_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
pi_result piextUSMEnqueueFill2D(pi_queue Queue, void *Ptr, size_t Pitch, size_t PatternSize, const void *Pattern, size_t Width, size_t Height, pi_uint32 NumEventsWaitList, const pi_event *EventsWaitList, pi_event *Event)
USM 2D Fill API.
pi_result piKernelSetExecInfo(pi_kernel Kernel, pi_kernel_exec_info ParamName, size_t ParamValueSize, const void *ParamValue)
pi_result piPlatformGetInfo(pi_platform Platform, pi_platform_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
pi_result piQueueCreate(pi_context Context, pi_device Device, pi_queue_properties Flags, pi_queue *Queue)
pi_result piextUSMEnqueuePrefetch(pi_queue Queue, const void *Ptr, size_t Size, pi_usm_migration_flags Flags, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
Hint to migrate memory to the device.
pi_result piextUSMGetMemAllocInfo(pi_context Context, const void *Ptr, pi_mem_alloc_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
pi_result piextSignalExternalSemaphore(pi_queue Queue, pi_interop_semaphore_handle SemHandle, pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList, pi_event *Event)
pi_result piKernelGetGroupInfo(pi_kernel Kernel, pi_device Device, pi_kernel_group_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
pi_result piQueueGetInfo(pi_queue Queue, pi_queue_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
pi_result piMemRetain(pi_mem Mem)
pi_result piPlatformsGet(pi_uint32 NumEntries, pi_platform *Platforms, pi_uint32 *NumPlatforms)
pi_result piEnqueueEventsWait(pi_queue Queue, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
pi_result piextEnqueueWriteHostPipe(pi_queue queue, pi_program program, const char *pipe_symbol, pi_bool blocking, void *ptr, size_t size, pi_uint32 num_events_in_waitlist, const pi_event *events_waitlist, pi_event *event)
pi_result piextKernelSuggestMaxCooperativeGroupCount(pi_kernel Kernel, size_t LocalWorkSize, size_t DynamicSharedMemorySize, pi_uint32 *GroupCountRet)
pi_result piextDestroyExternalSemaphore(pi_context Context, pi_device Device, pi_interop_semaphore_handle SemHandle)
pi_result piEnqueueMemUnmap(pi_queue Queue, pi_mem Mem, void *MappedPtr, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
pi_result piextDeviceGetNativeHandle(pi_device Device, pi_native_handle *NativeHandle)
pi_result piextCommandBufferUpdateKernelLaunch(pi_ext_command_buffer_command command, pi_ext_command_buffer_update_kernel_launch_desc *desc)
pi_result piProgramRelease(pi_program Program)
pi_result piextCommandBufferPrefetchUSM(pi_ext_command_buffer CommandBuffer, const void *Ptr, size_t Size, pi_usm_migration_flags Flags, pi_uint32 NumSyncPointsInWaitList, const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint)
pi_result piEnqueueMemImageWrite(pi_queue Queue, pi_mem Image, pi_bool BlockingWrite, pi_image_offset Origin, pi_image_region Region, size_t InputRowPitch, size_t InputSlicePitch, const void *Ptr, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
pi_result piPluginGetBackendOption(pi_platform Platform, const char *FrontendOption, const char **PlatformOption)
pi_result piextCommandBufferNDRangeKernel(pi_ext_command_buffer CommandBuffer, pi_kernel Kernel, pi_uint32 WorkDim, const size_t *GlobalWorkOffset, const size_t *GlobalWorkSize, const size_t *LocalWorkSize, pi_uint32 NumSyncPointsInWaitList, const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint, pi_ext_command_buffer_command *Command)
pi_result piextPluginGetOpaqueData(void *opaque_data_param, void **opaque_data_return)
pi_result piKernelCreate(pi_program Program, const char *KernelName, pi_kernel *RetKernel)
pi_result piextUSMImport(const void *HostPtr, size_t Size, pi_context Context)
pi_result piEnqueueKernelLaunch(pi_queue Queue, pi_kernel Kernel, pi_uint32 WorkDim, const size_t *GlobalWorkOffset, const size_t *GlobalWorkSize, const size_t *LocalWorkSize, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
pi_result piEventSetStatus(pi_event Event, pi_int32 ExecutionStatus)
pi_result piEventSetCallback(pi_event Event, pi_int32 CommandExecCallbackType, void(*PFnNotify)(pi_event Event, pi_int32 EventCommandStatus, void *UserData), void *UserData)
pi_result piSamplerCreate(pi_context Context, const pi_sampler_properties *SamplerProperties, pi_sampler *RetSampler)
pi_result piSamplerGetInfo(pi_sampler Sampler, pi_sampler_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
pi_result piextMemSampledImageCreate(pi_context Context, pi_device Device, pi_image_mem_handle ImgMem, pi_image_format *ImageFormat, pi_image_desc *ImageDesc, pi_sampler Sampler, pi_mem *RetMem, pi_image_handle *RetHandle)
pi_result piextMemUnsampledImageHandleDestroy(pi_context Context, pi_device Device, pi_image_handle Handle)
pi_result piextKernelSetArgSampler(pi_kernel Kernel, pi_uint32 ArgIndex, const pi_sampler *ArgValue)
pi_result piextQueueCreateWithNativeHandle(pi_native_handle NativeHandle, int32_t NativeHandleDesc, pi_context Context, pi_device Device, bool OwnNativeHandle, pi_queue_properties *Properties, pi_queue *Queue)
pi_result piMemImageGetInfo(pi_mem Image, pi_image_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
pi_result piextCommandBufferMemBufferWrite(pi_ext_command_buffer CommandBuffer, pi_mem Buffer, size_t Offset, size_t Size, const void *Ptr, pi_uint32 NumSyncPointsInWaitList, const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint)
pi_result piextMemMapExternalArray(pi_context Context, pi_device Device, pi_image_format *ImageFormat, pi_image_desc *ImageDesc, pi_interop_mem_handle MemHandle, pi_image_mem_handle *RetMem)
pi_result piProgramCreateWithBinary(pi_context Context, pi_uint32 NumDevices, const pi_device *DeviceList, const size_t *Lengths, const unsigned char **Binaries, size_t NumMetadataEntries, const pi_device_binary_property *Metadata, pi_int32 *BinaryStatus, pi_program *Program)
pi_result piextProgramGetNativeHandle(pi_program Program, pi_native_handle *NativeHandle)
pi_result piKernelGetInfo(pi_kernel Kernel, pi_kernel_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
pi_result piextEventGetNativeHandle(pi_event Event, pi_native_handle *NativeHandle)
pi_result piEnqueueEventsWaitWithBarrier(pi_queue Queue, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
pi_result piextMemMipmapFree(pi_context Context, pi_device Device, pi_image_mem_handle MemoryHandle)
pi_result piextPlatformGetNativeHandle(pi_platform Platform, pi_native_handle *NativeHandle)
pi_result piSamplerRelease(pi_sampler Sampler)
pi_result piMemBufferCreate(pi_context Context, pi_mem_flags Flags, size_t Size, void *HostPtr, pi_mem *RetMem, const pi_mem_properties *properties)
pi_result piEnqueueMemBufferWrite(pi_queue Queue, pi_mem Buffer, pi_bool BlockingWrite, size_t Offset, size_t Size, const void *Ptr, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
pi_result piextCommandBufferMemBufferReadRect(pi_ext_command_buffer CommandBuffer, pi_mem Buffer, pi_buff_rect_offset BufferOffset, pi_buff_rect_offset HostOffset, pi_buff_rect_region Region, size_t BufferRowPitch, size_t BufferSlicePitch, size_t HostRowPitch, size_t HostSlicePitch, void *Ptr, pi_uint32 NumSyncPointsInWaitList, const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint)
pi_result piDevicesGet(pi_platform Platform, pi_device_type DeviceType, pi_uint32 NumEntries, pi_device *Devices, pi_uint32 *NumDevices)
pi_result piextEnqueueDeviceGlobalVariableWrite(pi_queue Queue, pi_program Program, const char *Name, pi_bool BlockingWrite, size_t Count, size_t Offset, const void *Src, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
API for writing data from host to a device global variable.
pi_result piextEventCreateWithNativeHandle(pi_native_handle NativeHandle, pi_context Context, bool OwnNativeHandle, pi_event *Event)
pi_result piEventGetProfilingInfo(pi_event Event, pi_profiling_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
pi_result piKernelRetain(pi_kernel Kernel)
pi_result piextKernelSetArgMemObj(pi_kernel Kernel, pi_uint32 ArgIndex, const pi_mem_obj_property *ArgProperties, const pi_mem *ArgValue)
pi_result piextQueueGetNativeHandle(pi_queue Queue, pi_native_handle *NativeHandle, int32_t *NativeHandleDesc)
static void pi2urImageDesc(const pi_image_format *ImageFormat, const pi_image_desc *ImageDesc, ur_image_format_t *UrFormat, ur_image_desc_t *UrDesc)
pi_result piextBindlessImageSamplerCreate(pi_context Context, const pi_sampler_properties *SamplerProperties, float MinMipmapLevelClamp, float MaxMipmapLevelClamp, float MaxAnisotropy, pi_sampler *RetSampler)
pi_result piextUSMDeviceAlloc(void **ResultPtr, pi_context Context, pi_device Device, pi_usm_mem_properties *Properties, size_t Size, pi_uint32 Alignment)
pi_result piKernelSetArgPointer(pi_kernel Kernel, pi_uint32 ArgIndex, size_t ArgSize, const void *ArgValue)
pi_result piProgramGetBuildInfo(pi_program Program, pi_device Device, pi_program_build_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
pi_result piQueueFlush(pi_queue Queue)
pi_result piextKernelSetArgPointer(pi_kernel Kernel, pi_uint32 ArgIndex, size_t, const void *ArgValue)
static void ur2piImageFormat(const ur_image_format_t *UrFormat, pi_image_format *PiFormat)
pi_result piProgramLink(pi_context Context, pi_uint32 NumDevices, const pi_device *DeviceList, const char *Options, pi_uint32 NumInputPrograms, const pi_program *InputPrograms, void(*PFnNotify)(pi_program Program, void *UserData), void *UserData, pi_program *RetProgram)
pi_result piSamplerRetain(pi_sampler Sampler)
pi_result piextDeviceSelectBinary(pi_device Device, pi_device_binary *Binaries, pi_uint32 NumBinaries, pi_uint32 *SelectedBinaryInd)
pi_result piextContextSetExtendedDeleter(pi_context Context, pi_context_extended_deleter Function, void *UserData)
pi_result piextCommandBufferMemBufferRead(pi_ext_command_buffer CommandBuffer, pi_mem Src, size_t Offset, size_t Size, void *Dst, pi_uint32 NumSyncPointsInWaitList, const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint)
pi_result piextGetDeviceFunctionPointer(pi_device Device, pi_program Program, const char *FunctionName, pi_uint64 *FunctionPointerRet)
pi_result piEnqueueMemBufferCopyRect(pi_queue Queue, pi_mem SrcMem, pi_mem DstMem, pi_buff_rect_offset SrcOrigin, pi_buff_rect_offset DstOrigin, pi_buff_rect_region Region, size_t SrcRowPitch, size_t SrcSlicePitch, size_t DstRowPitch, size_t DstSlicePitch, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
pi_result piextMemMipmapGetLevel(pi_context Context, pi_device Device, pi_image_mem_handle MipMem, unsigned int Level, pi_image_mem_handle *RetMem)
pi_result piGetDeviceAndHostTimer(pi_device Device, uint64_t *DeviceTime, uint64_t *HostTime)
pi_result piEventGetInfo(pi_event Event, pi_event_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
pi_result piMemBufferPartition(pi_mem Buffer, pi_mem_flags Flags, pi_buffer_create_type BufferCreateType, void *BufferCreateInfo, pi_mem *RetMem)
pi_result piEnqueueMemBufferCopy(pi_queue Queue, pi_mem SrcMem, pi_mem DstMem, size_t SrcOffset, size_t DstOffset, size_t Size, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
pi_result piContextCreate(const pi_context_properties *Properties, pi_uint32 NumDevices, const pi_device *Devices, void(*PFnNotify)(const char *ErrInfo, const void *PrivateInfo, size_t CB, void *UserData), void *UserData, pi_context *RetContext)
pi_result piextUSMPitchedAlloc(void **ResultPtr, size_t *ResultPitch, pi_context Context, pi_device Device, pi_usm_mem_properties *Properties, size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes)
pi_result piextUSMRelease(const void *HostPtr, pi_context Context)
pi_result piEventRelease(pi_event Event)
pi_result piKernelGetSubGroupInfo(pi_kernel Kernel, pi_device Device, pi_kernel_sub_group_info ParamName, size_t InputValueSize, const void *InputValue, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
pi_result piQueueRetain(pi_queue Queue)
pi_result piextCommandBufferReleaseCommand(pi_ext_command_buffer_command command)
pi_result piDeviceRelease(pi_device Device)
pi_result piContextRetain(pi_context Context)
pi_result piextMemImageAllocate(pi_context Context, pi_device Device, pi_image_format *ImageFormat, pi_image_desc *ImageDesc, pi_image_mem_handle *RetMem)
pi_result piextUSMHostAlloc(void **ResultPtr, pi_context Context, pi_usm_mem_properties *Properties, size_t Size, pi_uint32 Alignment)
pi_result piextCommandBufferRetain(pi_ext_command_buffer CommandBuffer)
pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
pi_result piextCommandBufferAdviseUSM(pi_ext_command_buffer CommandBuffer, const void *Ptr, size_t Length, pi_mem_advice Advice, pi_uint32 NumSyncPointsInWaitList, const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint)
pi_result piextKernelCreateWithNativeHandle(pi_native_handle NativeHandle, pi_context Context, pi_program Program, bool OwnNativeHandle, pi_kernel *Kernel)
pi_result piextMemSampledImageHandleDestroy(pi_context Context, pi_device Device, pi_image_handle Handle)
pi_result piEnqueueMemBufferFill(pi_queue Queue, pi_mem Buffer, const void *Pattern, size_t PatternSize, size_t Offset, size_t Size, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
pi_result piextDeviceCreateWithNativeHandle(pi_native_handle NativeHandle, pi_platform Platform, pi_device *Device)
pi_result piextUSMEnqueueMemcpy2D(pi_queue Queue, pi_bool Blocking, void *DstPtr, size_t DstPitch, const void *SrcPtr, size_t SrcPitch, size_t Width, size_t Height, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
USM 2D Memcpy API.
static void pi2urImageInfoFlags(const pi_image_info PiFlags, ur_image_info_t *UrFlags)
pi_result piEnqueueMemBufferMap(pi_queue Queue, pi_mem Mem, pi_bool BlockingMap, pi_map_flags MapFlags, size_t Offset, size_t Size, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent, void **RetMap)
pi_result piextCommandBufferRetainCommand(pi_ext_command_buffer_command command)
pi_result piextEnqueueCommandBuffer(pi_ext_command_buffer CommandBuffer, pi_queue Queue, pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList, pi_event *Event)
pi_result piextCommandBufferCreate(pi_context Context, pi_device Device, const pi_ext_command_buffer_desc *Desc, pi_ext_command_buffer *RetCommandBuffer)
pi_result piextEnqueueCooperativeKernelLaunch(pi_queue Queue, pi_kernel Kernel, pi_uint32 WorkDim, const size_t *GlobalWorkOffset, const size_t *GlobalWorkSize, const size_t *LocalWorkSize, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
pi_result piextUSMEnqueueMemset2D(pi_queue Queue, void *Ptr, size_t Pitch, int Value, size_t Width, size_t Height, pi_uint32 NumEventsWaitList, const pi_event *EventsWaitList, pi_event *Event)
pi_result piEnqueueMemImageCopy(pi_queue Queue, pi_mem SrcImage, pi_mem DstImage, pi_image_offset SrcOrigin, pi_image_offset DstOrigin, pi_image_region Region, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
pi_result piextMemImageCreateWithNativeHandle(pi_native_handle NativeHandle, pi_context Context, bool OwnNativeHandle, const pi_image_format *ImageFormat, const pi_image_desc *ImageDesc, pi_mem *RetImage)
pi_result piextQueueCreate(pi_context Context, pi_device Device, pi_queue_properties *Properties, pi_queue *Queue)
pi_result piextProgramCreateWithNativeHandle(pi_native_handle NativeHandle, pi_context Context, bool OwnNativeHandle, pi_program *Program)
pi_result piextMemUnsampledImageCreate(pi_context Context, pi_device Device, pi_image_mem_handle ImgMem, pi_image_format *ImageFormat, pi_image_desc *ImageDesc, pi_mem *RetMem, pi_image_handle *RetHandle)
pi_result piextUSMFree(pi_context Context, void *Ptr)
pi_result piextEnqueueDeviceGlobalVariableRead(pi_queue Queue, pi_program Program, const char *Name, pi_bool BlockingRead, size_t Count, size_t Offset, void *Dst, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
API reading data from a device global variable to host.
pi_result piEventCreate(pi_context Context, pi_event *RetEvent)
pi_result piextKernelGetNativeHandle(pi_kernel Kernel, pi_native_handle *NativeHandle)
pi_result piextMemImageGetInfo(pi_image_mem_handle MemHandle, pi_image_info ParamName, void *ParamValue, size_t *ParamValueSizeRet)
pi_result piQueueFinish(pi_queue Queue)
pi_result piextCommandBufferMemBufferFill(pi_ext_command_buffer CommandBuffer, pi_mem Buffer, const void *Pattern, size_t PatternSize, size_t Offset, size_t Size, pi_uint32 NumSyncPointsInWaitList, const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint)
pi_result piContextRelease(pi_context Context)
pi_result piextPlatformCreateWithNativeHandle(pi_native_handle NativeHandle, pi_platform *Platform)
pi_result piextMemReleaseInterop(pi_context Context, pi_device Device, pi_interop_mem_handle ExtMem)
pi_result piKernelSetArg(pi_kernel Kernel, pi_uint32 ArgIndex, size_t ArgSize, const void *ArgValue)
pi_result piEventRetain(pi_event Event)
pi_result piextContextGetNativeHandle(pi_context Context, pi_native_handle *NativeHandle)
pi_result piMemRelease(pi_mem Mem)
pi_result piextUSMEnqueueMemcpy(pi_queue Queue, pi_bool Blocking, void *DstPtr, const void *SrcPtr, size_t Size, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
pi_result piextCommandBufferFinalize(pi_ext_command_buffer CommandBuffer)
static void pi2urImageCopyFlags(const pi_image_copy_flags PiFlags, ur_exp_image_copy_flags_t *UrFlags)
pi_result piPluginGetLastError(char **Message)
pi_result piEnqueueMemImageRead(pi_queue Queue, pi_mem Image, pi_bool BlockingRead, pi_image_offset Origin, pi_image_region Region, size_t RowPitch, size_t SlicePitch, void *Ptr, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
pi_result piKernelRelease(pi_kernel Kernel)
pi_result piextMemImageFree(pi_context Context, pi_device Device, pi_image_mem_handle MemoryHandle)
pi_result piextContextCreateWithNativeHandle(pi_native_handle NativeHandle, pi_uint32 NumDevices, const pi_device *Devices, bool OwnNativeHandle, pi_context *RetContext)
pi_result piextPeerAccessGetInfo(pi_device command_device, pi_device peer_device, pi_peer_attr attr, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
pi_result piQueueRelease(pi_queue Queue)
pi_result piextWaitExternalSemaphore(pi_queue Queue, pi_interop_semaphore_handle SemHandle, pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList, pi_event *Event)
pi_result piextCommandBufferRelease(pi_ext_command_buffer CommandBuffer)
pi_result piContextGetInfo(pi_context Context, pi_context_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
pi_result piextCommandBufferMemBufferCopy(pi_ext_command_buffer CommandBuffer, pi_mem SrcMem, pi_mem DstMem, size_t SrcOffset, size_t DstOffset, size_t Size, pi_uint32 NumSyncPointsInWaitList, const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint)
pi_result piextCommandBufferFillUSM(pi_ext_command_buffer CommandBuffer, void *Ptr, const void *Pattern, size_t PatternSize, size_t Size, pi_uint32 NumSyncPointsInWaitList, const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint)
pi_result piextMemGetNativeHandle(pi_mem Mem, pi_device Dev, pi_native_handle *NativeHandle)
pi_result piextGetGlobalVariablePointer(pi_device Device, pi_program Program, const char *GlobalVariableName, size_t *GlobalVariableSize, void **GlobalVariablePointerRet)
pi_result piTearDown(void *PluginParameter)
pi_result piextMemImportOpaqueFD(pi_context Context, pi_device Device, size_t Size, int FileDescriptor, pi_interop_mem_handle *RetHandle)
pi_result piextDisablePeerAccess(pi_device command_device, pi_device peer_device)
pi_result piextCommandBufferMemBufferCopyRect(pi_ext_command_buffer CommandBuffer, pi_mem SrcMem, pi_mem DstMem, pi_buff_rect_offset SrcOrigin, pi_buff_rect_offset DstOrigin, pi_buff_rect_region Region, size_t SrcRowPitch, size_t SrcSlicePitch, size_t DstRowPitch, size_t DstSlicePitch, pi_uint32 NumSyncPointsInWaitList, const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint)
pi_result piextEnablePeerAccess(pi_device command_device, pi_device peer_device)
pi_result piDevicePartition(pi_device Device, const pi_device_partition_property *Properties, pi_uint32 NumEntries, pi_device *SubDevices, pi_uint32 *NumSubDevices)
pi_result piEnqueueMemBufferReadRect(pi_queue Queue, pi_mem Buffer, pi_bool BlockingRead, pi_buff_rect_offset BufferOffset, pi_buff_rect_offset HostOffset, pi_buff_rect_region Region, size_t BufferRowPitch, size_t BufferSlicePitch, size_t HostRowPitch, size_t HostSlicePitch, void *Ptr, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
pi_result piMemImageCreate(pi_context Context, pi_mem_flags Flags, const pi_image_format *ImageFormat, const pi_image_desc *ImageDesc, void *HostPtr, pi_mem *RetImage)
pi_result piProgramBuild(pi_program Program, pi_uint32 NumDevices, const pi_device *DeviceList, const char *Options, void(*PFnNotify)(pi_program Program, void *UserData), void *UserData)
pi_result piEnqueueMemBufferWriteRect(pi_queue Queue, pi_mem Buffer, pi_bool BlockingWrite, pi_buff_rect_offset BufferOffset, pi_buff_rect_offset HostOffset, pi_buff_rect_region Region, size_t BufferRowPitch, size_t BufferSlicePitch, size_t HostRowPitch, size_t HostSlicePitch, const void *Ptr, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
pi_result piextEnqueueReadHostPipe(pi_queue queue, pi_program program, const char *pipe_symbol, pi_bool blocking, void *ptr, size_t size, pi_uint32 num_events_in_waitlist, const pi_event *events_waitlist, pi_event *event)
pi_result piProgramRetain(pi_program Program)
pi_result piextUSMEnqueueMemAdvise(pi_queue Queue, const void *Ptr, size_t Length, pi_mem_advice Advice, pi_event *OutEvent)
USM memadvise API to govern behavior of automatic migration mechanisms.
pi_result piextProgramSetSpecializationConstant(pi_program Program, pi_uint32 SpecID, size_t Size, const void *SpecValue)
pi_result piextUSMSharedAlloc(void **ResultPtr, pi_context Context, pi_device Device, pi_usm_mem_properties *Properties, size_t Size, pi_uint32 Alignment)
pi_result piEnqueueMemBufferRead(pi_queue Queue, pi_mem Src, pi_bool BlockingRead, size_t Offset, size_t Size, void *Dst, pi_uint32 NumEventsInWaitList, const pi_event *EventsWaitList, pi_event *OutEvent)
pi_result piProgramCreate(pi_context Context, const void *ILBytes, size_t Length, pi_program *Program)
pi_result piEventsWait(pi_uint32 NumEvents, const pi_event *EventsWaitList)
pi_result piDeviceRetain(pi_device Device)
pi_result piextImportExternalSemaphoreOpaqueFD(pi_context Context, pi_device Device, int FileDescriptor, pi_interop_semaphore_handle *RetHandle)
pi_result piextCommandBufferMemcpyUSM(pi_ext_command_buffer CommandBuffer, void *DstPtr, const void *SrcPtr, size_t Size, pi_uint32 NumSyncPointsInWaitList, const pi_ext_sync_point *SyncPointWaitList, pi_ext_sync_point *SyncPoint)
pi_result piextMemCreateWithNativeHandle(pi_native_handle NativeHandle, pi_context Context, bool OwnNativeHandle, pi_mem *Mem)
pi_result piMemGetInfo(pi_mem Mem, pi_mem_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
pi_result piProgramCompile(pi_program Program, pi_uint32 NumDevices, const pi_device *DeviceList, const char *Options, pi_uint32 NumInputHeaders, const pi_program *InputHeaders, const char **HeaderIncludeNames, void(*PFnNotify)(pi_program Program, void *UserData), void *UserData)
pi_result piextMemImageCopy(pi_queue Queue, void *DstPtr, void *SrcPtr, const pi_image_format *ImageFormat, const pi_image_desc *ImageDesc, const pi_image_copy_flags Flags, pi_image_offset SrcOffset, pi_image_offset DstOffset, pi_image_region CopyExtent, pi_image_region HostExtent, pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList, pi_event *Event)
pi_result PiGetAdapter(ur_adapter_handle_t &adapter)
void die(const char *Message)
void memcpy(void *Dst, const void *Src, size_t Size)
pi_result ur2piProgramBuildInfoValue(ur_program_build_info_t ParamName, size_t ParamValueSizePI, size_t *ParamValueSizeUR, void *ParamValue)
#define PI_TO_UR_MAP_IMAGE_TYPE(FROM, TO)
#define PI_TO_UR_MAP_IMAGE_CHANNEL_TYPE(FROM, TO)
#define PI_ASSERT(condition, error)
static pi_result ur2piResult(ur_result_t urResult)
#define UR_TO_PI_MAP_IMAGE_CHANNEL_ORDER(FROM, TO)
#define HANDLE_ERRORS(urCall)
#define UR_TO_PI_MAP_IMAGE_CHANNEL_TYPE(FROM, TO)
pi_result ur2piDeviceInfoValue(ur_device_info_t ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
Translate UR device info values to PI info values.
pi_result ur2piSamplerInfoValue(ur_sampler_info_t ParamName, size_t ParamValueSizePI, size_t *ParamValueSizeUR, void *ParamValue)
pi_result ur2piPlatformInfoValue(ur_platform_info_t ParamName, size_t ParamValueSizePI, size_t *ParamValueSizeUR, void *ParamValue)
#define PI_TO_UR_MAP_IMAGE_CHANNEL_ORDER(FROM, TO)
void fixupInfoValueTypes(size_t ParamValueSizeRetUR, size_t *ParamValueSizeRetPI, size_t ParamValueSize, void *ParamValue)
ur_result_t mapPIMetadataToUR(const pi_device_binary_property *pi_metadata, ur_program_metadata_t *ur_metadata)
#define PI_TO_UR_MAP_DEVICE_INFO(FROM, TO)
pi_result ur2piUSMAllocInfoValue(ur_usm_alloc_info_t ParamName, size_t ParamValueSizePI, size_t *ParamValueSizeUR, void *ParamValue)
#define PI_TO_UR_IMAGE_INFO(FROM, TO)
constexpr pi_queue_properties PI_QUEUE_COMPUTE_INDEX
@ PI_EXT_KERNEL_EXEC_INFO_CACHE_LARGE_DATA
@ PI_EXT_KERNEL_EXEC_INFO_CACHE_DEFAULT
@ PI_EXT_KERNEL_EXEC_INFO_CACHE_LARGE_SLM
constexpr pi_mem_flags PI_MEM_ACCESS_READ_ONLY
constexpr pi_memory_scope_capabilities PI_MEMORY_SCOPE_WORK_GROUP
constexpr pi_sampler_properties PI_SAMPLER_PROPERTIES_NORMALIZED_COORDS
constexpr pi_memory_scope_capabilities PI_MEMORY_SCOPE_WORK_ITEM
constexpr pi_usm_mem_properties PI_MEM_ALLOC_INITIAL_PLACEMENT_DEVICE
uintptr_t pi_native_handle
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE
constexpr pi_sampler_properties PI_SAMPLER_PROPERTIES_ADDRESSING_MODE
static constexpr pi_device_partition_property PI_EXT_INTEL_DEVICE_PARTITION_BY_CSLICE
constexpr pi_usm_mem_properties PI_MEM_USM_ALLOC_BUFFER_LOCATION
constexpr pi_queue_properties PI_EXT_QUEUE_FLAG_SUBMISSION_IMMEDIATE
pi_bitfield pi_usm_mem_properties
@ PI_DEVICE_INFO_PRINTF_BUFFER_SIZE
@ PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR
@ PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH
@ PI_DEVICE_INFO_MAX_MEM_BANDWIDTH
@ PI_DEVICE_INFO_GPU_SLICES
@ PI_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC
@ PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT
@ PI_DEVICE_INFO_BUILD_ON_SUBDEVICE
@ PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT
@ PI_DEVICE_INFO_MAX_WORK_GROUP_SIZE
@ PI_DEVICE_INFO_IMAGE_SRGB
@ PI_EXT_ONEAPI_DEVICE_INFO_CUBEMAP_SUPPORT
@ PI_DEVICE_INFO_IMAGE3D_MAX_WIDTH
@ PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT
@ PI_DEVICE_INFO_IMAGE3D_MAX_HEIGHT
@ PI_DEVICE_INFO_MAX_CLOCK_FREQUENCY
@ PI_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT
@ PI_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS
@ PI_DEVICE_INFO_EXECUTION_CAPABILITIES
@ PI_EXT_ONEAPI_DEVICE_INFO_COMMAND_BUFFER_UPDATE_SUPPORT
@ PI_EXT_INTEL_DEVICE_INFO_ESIMD_SUPPORT
@ PI_DEVICE_INFO_QUEUE_PROPERTIES
@ PI_DEVICE_INFO_GPU_EU_COUNT
@ PI_DEVICE_INFO_COMPILER_AVAILABLE
@ PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH
@ PI_DEVICE_INFO_IMAGE_SUPPORT
@ PI_DEVICE_INFO_ERROR_CORRECTION_SUPPORT
@ PI_EXT_INTEL_DEVICE_INFO_FREE_MEMORY
@ PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT
@ PI_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES
@ PI_DEVICE_INFO_BUILT_IN_KERNELS
@ PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT
@ PI_EXT_ONEAPI_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT
@ PI_DEVICE_INFO_MAX_NUM_SUB_GROUPS
@ PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_SUPPORT
@ PI_DEVICE_INFO_AVAILABLE
@ PI_DEVICE_INFO_HALF_FP_CONFIG
@ PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT
@ PI_DEVICE_INFO_PARENT_DEVICE
@ PI_DEVICE_INFO_SUB_GROUP_SIZES_INTEL
@ PI_DEVICE_INFO_GPU_EU_SIMD_WIDTH
@ PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT
@ PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE
@ PI_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE
@ PI_DEVICE_INFO_DRIVER_VERSION
@ PI_DEVICE_INFO_MAX_PARAMETER_SIZE
@ PI_DEVICE_INFO_PARTITION_PROPERTIES
@ PI_EXT_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES
@ PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT
@ PI_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT
@ PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF
@ PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT
@ PI_EXT_INTEL_DEVICE_INFO_MEM_CHANNEL_SUPPORT
@ PI_DEVICE_INFO_IMAGE3D_MAX_DEPTH
@ PI_DEVICE_INFO_MAX_COMPUTE_UNITS
@ PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR
@ PI_DEVICE_INFO_IMAGE2D_MAX_HEIGHT
@ PI_DEVICE_INFO_VENDOR_ID
@ PI_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE
@ PI_EXT_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES
@ PI_DEVICE_INFO_GPU_HW_THREADS_PER_EU
@ PI_DEVICE_INFO_BACKEND_VERSION
@ PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG
@ PI_DEVICE_INFO_PLATFORM
@ PI_EXT_ONEAPI_DEVICE_INFO_CUBEMAP_SEAMLESS_FILTERING_SUPPORT
@ PI_DEVICE_INFO_LOCAL_MEM_SIZE
@ PI_DEVICE_INFO_REFERENCE_COUNT
@ PI_DEVICE_INFO_MAX_SAMPLERS
@ PI_DEVICE_INFO_DEVICE_ID
@ PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT
@ PI_DEVICE_INFO_MAX_WORK_ITEM_SIZES
@ PI_DEVICE_INFO_EXTENSIONS
@ PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT
@ PI_DEVICE_INFO_HOST_UNIFIED_MEMORY
@ PI_DEVICE_INFO_PCI_ADDRESS
@ PI_DEVICE_INFO_MAX_MEM_ALLOC_SIZE
@ PI_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE
@ PI_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE
@ PI_DEVICE_INFO_LINKER_AVAILABLE
@ PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_3D
@ PI_DEVICE_INFO_ADDRESS_BITS
@ PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE
@ PI_DEVICE_INFO_ATOMIC_64
@ PI_DEVICE_INFO_USM_HOST_SUPPORT
@ PI_DEVICE_INFO_USM_DEVICE_SUPPORT
@ PI_EXT_INTEL_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES
@ PI_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS
@ PI_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE
@ PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT
@ PI_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS
@ PI_EXT_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES
@ PI_EXT_CODEPLAY_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP
@ PI_DEVICE_INFO_IL_VERSION
@ PI_DEVICE_INFO_PROFILING_TIMER_RESOLUTION
@ PI_DEVICE_INFO_MEM_BASE_ADDR_ALIGN
@ PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG
@ PI_DEVICE_INFO_MAX_READ_IMAGE_ARGS
@ PI_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN
@ PI_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT
@ PI_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE
@ PI_EXT_INTEL_DEVICE_INFO_MEMORY_CLOCK_RATE
@ PI_DEVICE_INFO_DOUBLE_FP_CONFIG
@ PI_EXT_ONEAPI_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT
@ PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT
@ PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT
@ PI_EXT_INTEL_DEVICE_INFO_MEMORY_BUS_WIDTH
@ PI_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE
@ PI_DEVICE_INFO_PARTITION_TYPE
@ PI_EXT_ONEAPI_DEVICE_INFO_COMPONENT_DEVICES
@ PI_DEVICE_INFO_SINGLE_FP_CONFIG
@ PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF
@ PI_DEVICE_INFO_GLOBAL_MEM_SIZE
@ PI_EXT_ONEAPI_DEVICE_INFO_COMPOSITE_DEVICE
@ PI_DEVICE_INFO_LOCAL_MEM_TYPE
@ PI_DEVICE_INFO_MAX_CONSTANT_ARGS
@ PI_EXT_ONEAPI_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY
@ PI_EXT_ONEAPI_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT
@ PI_EXT_ONEAPI_DEVICE_INFO_COMMAND_BUFFER_SUPPORT
@ PI_EXT_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES
@ PI_EXT_ONEAPI_DEVICE_INFO_IMAGE_PITCH_ALIGN
@ PI_DEVICE_INFO_OPENCL_C_VERSION
@ PI_DEVICE_INFO_ENDIAN_LITTLE
@ PI_DEVICE_INFO_IMAGE2D_MAX_WIDTH
@ PI_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE
@ PI_EXT_ONEAPI_DEVICE_INFO_IP_VERSION
@ PI_EXT_ONEAPI_DEVICE_INFO_BFLOAT16_MATH_FUNCTIONS
constexpr pi_mem_flags PI_MEM_FLAGS_HOST_PTR_ALLOC
@ PI_PROGRAM_BUILD_STATUS_SUCCESS
@ PI_PROGRAM_BUILD_STATUS_ERROR
@ PI_PROGRAM_BUILD_STATUS_IN_PROGRESS
@ PI_PROGRAM_BUILD_STATUS_NONE
constexpr pi_usm_mem_properties PI_MEM_ALLOC_FLAGS
@ PI_QUEUE_INFO_DEVICE_DEFAULT
@ PI_QUEUE_INFO_PROPERTIES
@ PI_QUEUE_INFO_REFERENCE_COUNT
@ PI_EXT_ONEAPI_QUEUE_INFO_EMPTY
@ PI_MEM_ADVICE_CUDA_UNSET_ACCESSED_BY_HOST
@ PI_MEM_ADVICE_CUDA_UNSET_READ_MOSTLY
@ PI_MEM_ADVICE_CUDA_UNSET_PREFERRED_LOCATION
@ PI_MEM_ADVICE_CUDA_SET_READ_MOSTLY
@ PI_MEM_ADVICE_HIP_SET_COARSE_GRAINED
@ PI_MEM_ADVICE_HIP_UNSET_COARSE_GRAINED
@ PI_MEM_ADVICE_CUDA_UNSET_ACCESSED_BY
@ PI_MEM_ADVICE_CUDA_SET_ACCESSED_BY_HOST
@ PI_MEM_ADVICE_CUDA_SET_PREFERRED_LOCATION
@ PI_MEM_ADVICE_CUDA_SET_ACCESSED_BY
@ PI_IMAGE_CHANNEL_TYPE_FLOAT
@ PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565
@ PI_IMAGE_CHANNEL_TYPE_UNORM_INT8
@ PI_IMAGE_CHANNEL_TYPE_SIGNED_INT16
@ PI_IMAGE_CHANNEL_TYPE_SNORM_INT16
@ PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8
@ PI_IMAGE_CHANNEL_TYPE_SIGNED_INT8
@ PI_IMAGE_CHANNEL_TYPE_UNORM_INT_101010
@ PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32
@ PI_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16
@ PI_IMAGE_CHANNEL_TYPE_SNORM_INT8
@ PI_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555
@ PI_IMAGE_CHANNEL_TYPE_SIGNED_INT32
@ PI_IMAGE_CHANNEL_TYPE_HALF_FLOAT
@ PI_IMAGE_CHANNEL_TYPE_UNORM_INT16
_pi_kernel_sub_group_info
@ PI_KERNEL_COMPILE_NUM_SUB_GROUPS
@ PI_KERNEL_MAX_NUM_SUB_GROUPS
@ PI_KERNEL_COMPILE_SUB_GROUP_SIZE_INTEL
@ PI_KERNEL_MAX_SUB_GROUP_SIZE
pi_bitfield pi_mem_properties
_pi_image_format pi_image_format
@ PI_KERNEL_GROUP_INFO_WORK_GROUP_SIZE
@ PI_KERNEL_GROUP_INFO_COMPILE_WORK_GROUP_SIZE
@ PI_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE
@ PI_KERNEL_GROUP_INFO_PRIVATE_MEM_SIZE
@ PI_KERNEL_GROUP_INFO_LOCAL_MEM_SIZE
@ PI_KERNEL_GROUP_INFO_PREFERRED_WORK_GROUP_SIZE_MULTIPLE
@ PI_KERNEL_GROUP_INFO_NUM_REGS
constexpr pi_queue_properties PI_EXT_QUEUE_FLAG_SUBMISSION_NO_IMMEDIATE
constexpr pi_memory_order_capabilities PI_MEMORY_ORDER_ACQUIRE
pi_uint64 pi_image_handle
_pi_ext_command_buffer_command * pi_ext_command_buffer_command
@ PI_PROPERTY_TYPE_UINT32
@ PI_PROPERTY_TYPE_BYTE_ARRAY
@ PI_PROPERTY_TYPE_STRING
@ PI_USM_INDIRECT_ACCESS
indicates that the kernel might access data through USM ptrs
@ PI_EXT_KERNEL_EXEC_INFO_CACHE_CONFIG
provides the preferred cache configuration (large slm or large data)
@ PI_USM_PTRS
provides an explicit list of pointers that the kernel will access
@ PI_PLATFORM_INFO_VENDOR
@ PI_PLATFORM_INFO_EXTENSIONS
@ PI_PLATFORM_INFO_PROFILE
@ PI_EXT_PLATFORM_INFO_BACKEND
@ PI_PLATFORM_INFO_VERSION
pi_buffer_region_struct * pi_buffer_region
static constexpr pi_device_partition_property PI_DEVICE_PARTITION_BY_COUNTS
constexpr pi_queue_properties PI_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE
#define __SYCL_PI_DEVICE_BINARY_TARGET_NATIVE_CPU
@ PI_IMAGE_INFO_SLICE_PITCH
@ PI_IMAGE_INFO_ROW_PITCH
@ PI_IMAGE_INFO_ELEMENT_SIZE
pi_uint32 pi_ext_sync_point
@ PI_IMAGE_CHANNEL_ORDER_RGB
@ PI_IMAGE_CHANNEL_ORDER_RA
@ PI_IMAGE_CHANNEL_ORDER_RGBA
@ PI_IMAGE_CHANNEL_ORDER_INTENSITY
@ PI_IMAGE_CHANNEL_ORDER_R
@ PI_IMAGE_CHANNEL_ORDER_ABGR
@ PI_IMAGE_CHANNEL_ORDER_RGBx
@ PI_IMAGE_CHANNEL_ORDER_RG
@ PI_IMAGE_CHANNEL_ORDER_BGRA
@ PI_IMAGE_CHANNEL_ORDER_Rx
@ PI_IMAGE_CHANNEL_ORDER_A
@ PI_IMAGE_CHANNEL_ORDER_sRGBA
@ PI_IMAGE_CHANNEL_ORDER_LUMINANCE
@ PI_IMAGE_CHANNEL_ORDER_RGx
@ PI_IMAGE_CHANNEL_ORDER_ARGB
constexpr pi_memory_order_capabilities PI_MEMORY_ORDER_ACQ_REL
@ PI_PROFILING_INFO_COMMAND_END
@ PI_PROFILING_INFO_COMMAND_START
@ PI_PROFILING_INFO_COMMAND_SUBMIT
@ PI_PROFILING_INFO_COMMAND_QUEUED
_pi_sampler_cubemap_filter_mode
@ PI_SAMPLER_CUBEMAP_FILTER_MODE_SEAMLESS
@ PI_SAMPLER_CUBEMAP_FILTER_MODE_DISJOINTED
@ PI_DEVICE_TYPE_ACC
A PI device that is a dedicated accelerator.
@ PI_DEVICE_TYPE_ALL
All devices available in the PI plugin.
@ PI_DEVICE_TYPE_GPU
A PI device that is a GPU.
@ PI_DEVICE_TYPE_CPU
A PI device that is the host processor.
static constexpr pi_device_partition_property PI_DEVICE_PARTITION_EQUALLY
pi_bitfield pi_queue_properties
@ PI_IMAGE_COPY_DEVICE_TO_DEVICE
@ PI_IMAGE_COPY_DEVICE_TO_HOST
@ PI_IMAGE_COPY_HOST_TO_DEVICE
#define __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64_X86_64
Device-specific binary images produced from SPIR-V 64-bit <-> various "spir64_*" triples for specific...
#define __SYCL_PI_DEVICE_BINARY_TARGET_NVPTX64
PTX 64-bit image <-> "nvptx64", 64-bit NVIDIA PTX device.
constexpr pi_queue_properties PI_EXT_ONEAPI_QUEUE_FLAG_PRIORITY_LOW
constexpr pi_memory_order_capabilities PI_MEMORY_ORDER_RELEASE
pi_bitfield pi_sampler_properties
constexpr pi_queue_properties PI_QUEUE_FLAG_ON_DEVICE_DEFAULT
constexpr pi_queue_properties PI_EXT_ONEAPI_QUEUE_FLAG_DISCARD_EVENTS
constexpr pi_queue_properties PI_QUEUE_FLAG_ON_DEVICE
constexpr pi_mem_flags PI_MEM_FLAGS_HOST_PTR_COPY
@ PI_BUFFER_CREATE_TYPE_REGION
static constexpr pi_device_partition_property PI_DEVICE_PARTITION_BY_AFFINITY_DOMAIN
constexpr pi_memory_order_capabilities PI_MEMORY_ORDER_RELAXED
@ PI_EVENT_INFO_COMMAND_EXECUTION_STATUS
@ PI_EVENT_INFO_REFERENCE_COUNT
@ PI_EVENT_INFO_COMMAND_TYPE
@ PI_EVENT_INFO_COMMAND_QUEUE
constexpr pi_queue_properties PI_EXT_ONEAPI_QUEUE_FLAG_PRIORITY_HIGH
#define __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64
SPIR-V 64-bit image <-> "spir64", 64-bit OpenCL device.
constexpr pi_usm_mem_properties PI_MEM_ALLOC_INITIAL_PLACEMENT_HOST
#define __SYCL_PI_DEVICE_BINARY_TARGET_AMDGCN
intptr_t pi_context_properties
constexpr pi_usm_mem_properties PI_MEM_ALLOC_WRTITE_COMBINED
constexpr pi_queue_properties PI_QUEUE_FLAGS
constexpr pi_queue_properties PI_QUEUE_FLAG_PROFILING_ENABLE
constexpr pi_mem_flags PI_MEM_FLAGS_HOST_PTR_USE
void(* pi_context_extended_deleter)(void *user_data)
constexpr pi_map_flags PI_MAP_WRITE
constexpr pi_map_flags PI_MAP_WRITE_INVALIDATE_REGION
@ PI_MEM_TYPE_IMAGE_CUBEMAP
@ PI_MEM_TYPE_IMAGE1D_BUFFER
@ PI_MEM_TYPE_IMAGE1D_ARRAY
@ PI_MEM_TYPE_IMAGE2D_ARRAY
constexpr pi_usm_mem_properties PI_MEM_ALLOC_DEVICE_READ_ONLY
@ PI_SAMPLER_INFO_CONTEXT
@ PI_SAMPLER_INFO_NORMALIZED_COORDS
@ PI_SAMPLER_INFO_FILTER_MODE
@ PI_SAMPLER_INFO_REFERENCE_COUNT
@ PI_SAMPLER_INFO_ADDRESSING_MODE
constexpr pi_map_flags PI_MAP_READ
static constexpr pi_device_affinity_domain PI_DEVICE_AFFINITY_DOMAIN_NUMA
pi_bitfield pi_memory_scope_capabilities
#define __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64_GEN
pi_bitfield pi_device_fp_config
constexpr pi_sampler_properties PI_SAMPLER_PROPERTIES_FILTER_MODE
constexpr pi_mem_flags PI_MEM_FLAGS_ACCESS_RW
@ PI_KERNEL_INFO_FUNCTION_NAME
@ PI_KERNEL_INFO_REFERENCE_COUNT
@ PI_KERNEL_INFO_ATTRIBUTES
@ PI_KERNEL_INFO_NUM_ARGS
#define __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV32
SPIR-V 32-bit image <-> "spir", 32-bit OpenCL device.
constexpr pi_device_exec_capabilities PI_DEVICE_EXEC_CAPABILITIES_NATIVE_KERNEL
constexpr pi_memory_scope_capabilities PI_MEMORY_SCOPE_DEVICE
constexpr pi_sampler_properties PI_SAMPLER_PROPERTIES_CUBEMAP_FILTER_MODE
#define __SYCL_PI_DEVICE_BINARY_TARGET_UNKNOWN
Target identification strings for pi_device_binary_struct.DeviceTargetSpec.
_pi_device_local_mem_type
@ PI_DEVICE_LOCAL_MEM_TYPE_GLOBAL
@ PI_DEVICE_LOCAL_MEM_TYPE_LOCAL
constexpr pi_memory_scope_capabilities PI_MEMORY_SCOPE_SYSTEM
constexpr pi_memory_scope_capabilities PI_MEMORY_SCOPE_SUB_GROUP
@ PI_EXT_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES
@ PI_CONTEXT_INFO_NUM_DEVICES
@ PI_EXT_ONEAPI_CONTEXT_INFO_USM_MEMSET2D_SUPPORT
@ PI_EXT_ONEAPI_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT
@ PI_EXT_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES
@ PI_CONTEXT_INFO_DEVICES
@ PI_CONTEXT_INFO_REFERENCE_COUNT
@ PI_EXT_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES
@ PI_EXT_ONEAPI_CONTEXT_INFO_USM_FILL2D_SUPPORT
@ PI_EXT_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES
@ PI_SAMPLER_FILTER_MODE_NEAREST
@ PI_SAMPLER_FILTER_MODE_LINEAR
constexpr pi_mem_properties PI_MEM_PROPERTIES_ALLOC_BUFFER_LOCATION
void * pi_image_mem_handle
_pi_sampler_addressing_mode
@ PI_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT
@ PI_SAMPLER_ADDRESSING_MODE_CLAMP
@ PI_SAMPLER_ADDRESSING_MODE_NONE
@ PI_SAMPLER_ADDRESSING_MODE_REPEAT
@ PI_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE
@ PI_EXT_PLATFORM_BACKEND_OPENCL
The backend is OpenCL.
@ PI_EXT_PLATFORM_BACKEND_NATIVE_CPU
The backend is NATIVE_CPU.
@ PI_EXT_PLATFORM_BACKEND_UNKNOWN
The backend is not a recognized one.
@ PI_EXT_PLATFORM_BACKEND_LEVEL_ZERO
The backend is Level Zero.
@ PI_EXT_PLATFORM_BACKEND_HIP
The backend is HIP.
@ PI_EXT_PLATFORM_BACKEND_CUDA
The backend is CUDA.
@ PI_PROGRAM_INFO_NUM_DEVICES
@ PI_PROGRAM_INFO_BINARY_SIZES
@ PI_PROGRAM_INFO_KERNEL_NAMES
@ PI_PROGRAM_INFO_CONTEXT
@ PI_PROGRAM_INFO_REFERENCE_COUNT
@ PI_PROGRAM_INFO_BINARIES
@ PI_PROGRAM_INFO_NUM_KERNELS
@ PI_PROGRAM_INFO_DEVICES
intptr_t pi_device_partition_property
constexpr pi_sampler_properties PI_SAMPLER_PROPERTIES_MIP_FILTER_MODE
constexpr pi_device_exec_capabilities PI_DEVICE_EXEC_CAPABILITIES_KERNEL
constexpr pi_memory_order_capabilities PI_MEMORY_ORDER_SEQ_CST
@ PI_PROGRAM_BINARY_TYPE_LIBRARY
@ PI_PROGRAM_BINARY_TYPE_EXECUTABLE
@ PI_PROGRAM_BINARY_TYPE_COMPILED_OBJECT
@ PI_PROGRAM_BINARY_TYPE_NONE
pi_uint64 pi_interop_semaphore_handle
@ PI_PEER_ACCESS_SUPPORTED
returns a uint32_t: 1 if P2P Access is supported otherwise P2P Access is not supported.
@ PI_PEER_ATOMICS_SUPPORTED
returns a uint32_t: 1 if Atomic operations are supported over the P2P link, otherwise such operations...
pi_bitfield pi_device_affinity_domain
pi_uint64 pi_interop_mem_handle
pi_bitfield pi_memory_order_capabilities
#define __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64_FPGA
@ PI_KERNEL_ARG_MEM_OBJ_ACCESS
constexpr pi_mem_properties PI_MEM_PROPERTIES_CHANNEL
@ PI_PROGRAM_BUILD_INFO_LOG
@ PI_PROGRAM_BUILD_INFO_OPTIONS
@ PI_PROGRAM_BUILD_INFO_BINARY_TYPE
@ PI_PROGRAM_BUILD_INFO_STATUS
pi_mem_obj_property_type type
pi_mem_access_flag mem_access
This struct is a record of the device binary information.
pi_ext_command_buffer_update_pointer_arg_desc_t * ptr_arg_list
size_t * global_work_size
uint32_t num_mem_obj_args
size_t * global_work_offset
pi_ext_command_buffer_update_memobj_arg_desc_t * mem_obj_arg_list
pi_ext_command_buffer_update_value_arg_desc_t * value_arg_list