18 inline namespace _V1 {
23 :
device_impl(InteropDeviceHandle, nullptr, nullptr, Plugin) {}
38 : MDevice(Device), MDeviceHostBaseTime(
std::make_pair(0, 0)) {
39 bool InteroperabilityConstructor =
false;
40 if (Device ==
nullptr) {
41 assert(InteropDeviceHandle);
45 Plugin->call(urDeviceCreateWithNativeHandle, InteropDeviceHandle,
nullptr,
47 InteroperabilityConstructor =
true;
51 Plugin->call(urDeviceGetInfo, MDevice, UR_DEVICE_INFO_TYPE,
52 sizeof(ur_device_type_t), &MType,
nullptr);
55 if ((Platform ==
nullptr) || !Platform->MAlwaysRootDevice) {
57 Plugin->call(urDeviceGetInfo, MDevice, UR_DEVICE_INFO_PARENT_DEVICE,
58 sizeof(ur_device_handle_t), &MRootDevice,
nullptr);
61 if (!InteroperabilityConstructor) {
65 Plugin->call(urDeviceRetain, MDevice);
74 MIsAssertFailSupported =
81 ur_result_t Err = Plugin->call_nocheck(urDeviceRelease, MDevice);
87 auto SupportedDomains = get_info<info::device::partition_affinity_domains>();
88 return std::find(SupportedDomains.begin(), SupportedDomains.end(),
89 AffinityDomain) != SupportedDomains.end();
94 getPlugin()->call(urDeviceRetain, MDevice);
95 return ur::cast<cl_device_id>(
getNative());
99 return createSyclObjFromImpl<platform>(MPlatform);
102 template <
typename Param>
104 return get_device_info<Param>(
105 MPlatform->getOrMakeDeviceImpl(MDevice, MPlatform));
108 #define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, PiCode) \
109 template ReturnT device_impl::get_info<info::device::Desc>() const;
111 #define __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED(DescType, Desc, ReturnT, PiCode) \
112 template ReturnT device_impl::get_info<info::device::Desc>() const;
114 #include <sycl/info/device_traits.def>
115 #undef __SYCL_PARAM_TRAITS_SPEC_SPECIALIZED
116 #undef __SYCL_PARAM_TRAITS_SPEC
118 #define __SYCL_PARAM_TRAITS_SPEC(Namespace, DescType, Desc, ReturnT, PiCode) \
119 template __SYCL_EXPORT ReturnT \
120 device_impl::get_info<Namespace::info::DescType::Desc>() const;
122 #include <sycl/info/ext_codeplay_device_traits.def>
123 #include <sycl/info/ext_intel_device_traits.def>
124 #include <sycl/info/ext_oneapi_device_traits.def>
125 #undef __SYCL_PARAM_TRAITS_SPEC
128 typename info::platform::version::return_type
129 device_impl::get_backend_info<info::platform::version>()
const {
132 "the info::platform::version info descriptor can "
133 "only be queried with an OpenCL backend");
135 return get_platform().get_info<info::platform::version>();
139 typename info::device::version::return_type
140 device_impl::get_backend_info<info::device::version>()
const {
143 "the info::device::version info descriptor can only "
144 "be queried with an OpenCL backend");
146 return get_info<info::device::version>();
150 typename info::device::backend_version::return_type
151 device_impl::get_backend_info<info::device::backend_version>()
const {
154 "the info::device::backend_version info descriptor "
155 "can only be queried with a Level Zero backend");
164 std::string AllExtensionNames =
166 return (AllExtensionNames.find(ExtensionName) != std::string::npos);
170 auto SupportedProperties = get_info<info::device::partition_properties>();
171 return std::find(SupportedProperties.begin(), SupportedProperties.end(),
172 Prop) != SupportedProperties.end();
176 const ur_device_partition_properties_t *Properties,
177 size_t SubDevicesCount)
const {
178 std::vector<ur_device_handle_t> SubDevices(SubDevicesCount);
179 uint32_t ReturnedSubDevices = 0;
181 Plugin->call<sycl::errc::invalid>(urDevicePartition, MDevice, Properties,
182 SubDevicesCount, SubDevices.data(),
183 &ReturnedSubDevices);
184 if (ReturnedSubDevices != SubDevicesCount) {
187 "Could not partition to the specified number of sub-devices");
193 std::vector<device> res;
195 [&res,
this](
const ur_device_handle_t &a_ur_device) {
196 device sycl_device = detail::createSyclObjFromImpl<device>(
197 MPlatform->getOrMakeDeviceImpl(a_ur_device, MPlatform));
198 res.push_back(sycl_device);
206 "Device does not support "
207 "sycl::info::partition_property::partition_equally.");
211 auto MaxComputeUnits = get_info<info::device::max_compute_units>();
212 if (ComputeUnits > MaxComputeUnits)
214 "Total counts exceed max compute units");
216 size_t SubDevicesCount = MaxComputeUnits / ComputeUnits;
218 ur_device_partition_property_t Prop{};
219 Prop.type = UR_DEVICE_PARTITION_EQUALLY;
220 Prop.value.count =
static_cast<uint32_t
>(ComputeUnits);
222 ur_device_partition_properties_t Properties{};
223 Properties.stype = UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES;
224 Properties.PropCount = 1;
225 Properties.pProperties = &Prop;
235 "Device does not support "
236 "sycl::info::partition_property::partition_by_counts.");
239 std::vector<ur_device_partition_property_t> Props{};
242 size_t TotalCounts = 0;
243 size_t NonZeroCounts = 0;
244 for (
auto Count : Counts) {
245 TotalCounts += Count;
246 NonZeroCounts += (Count != 0) ? 1 : 0;
247 Props.push_back(ur_device_partition_property_t{
248 UR_DEVICE_PARTITION_BY_COUNTS, {
static_cast<uint32_t
>(Count)}});
251 ur_device_partition_properties_t Properties{};
252 Properties.stype = UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES;
253 Properties.pProperties = Props.data();
254 Properties.PropCount = Props.size();
260 if (NonZeroCounts > get_info<info::device::partition_max_sub_devices>())
262 "Total non-zero counts exceed max sub-devices");
268 if (TotalCounts > get_info<info::device::max_compute_units>())
270 "Total counts exceed max compute units");
281 "Device does not support "
282 "sycl::info::partition_property::partition_by_affinity_domain.");
286 "Device does not support " +
290 ur_device_partition_property_t Prop;
291 Prop.type = UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN;
292 Prop.value.affinity_domain =
293 static_cast<ur_device_affinity_domain_flags_t
>(AffinityDomain);
295 ur_device_partition_properties_t Properties{};
296 Properties.stype = UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES;
297 Properties.PropCount = 1;
298 Properties.pProperties = &Prop;
300 uint32_t SubDevicesCount = 0;
302 Plugin->call<sycl::errc::invalid>(urDevicePartition, MDevice, &Properties, 0,
303 nullptr, &SubDevicesCount);
313 "Device does not support "
314 "sycl::info::partition_property::ext_intel_partition_by_cslice.");
317 ur_device_partition_property_t Prop;
318 Prop.type = UR_DEVICE_PARTITION_BY_CSLICE;
320 ur_device_partition_properties_t Properties{};
321 Properties.stype = UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES;
322 Properties.pProperties = &Prop;
323 Properties.PropCount = 1;
325 uint32_t SubDevicesCount = 0;
327 Plugin->call(urDevicePartition, MDevice, &Properties, 0,
nullptr,
337 ur_native_handle_t Handle;
338 Plugin->call(urDeviceGetNativeHandle,
getHandleRef(), &Handle);
343 size_t return_size = 0;
353 case aspect::accelerator:
358 case aspect::emulated:
360 case aspect::host_debuggable:
366 case aspect::int64_base_atomics:
368 case aspect::int64_extended_atomics:
370 case aspect::atomic64:
371 return get_info<info::device::atomic64>();
373 return get_info<info::device::image_support>();
374 case aspect::online_compiler:
375 return get_info<info::device::is_compiler_available>();
376 case aspect::online_linker:
377 return get_info<info::device::is_linker_available>();
378 case aspect::queue_profiling:
379 return get_info<info::device::queue_profiling>();
380 case aspect::usm_device_allocations:
381 return get_info<info::device::usm_device_allocations>();
382 case aspect::usm_host_allocations:
383 return get_info<info::device::usm_host_allocations>();
384 case aspect::ext_intel_mem_channel:
385 return get_info<info::device::ext_intel_mem_channel>();
386 case aspect::ext_oneapi_cuda_cluster_group:
387 return get_info<info::device::ext_oneapi_cuda_cluster_group>();
388 case aspect::usm_atomic_host_allocations:
390 info::device::usm_host_allocations>::
391 get(MPlatform->getDeviceImpl(MDevice)) &
392 UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_CONCURRENT_ACCESS);
393 case aspect::usm_shared_allocations:
394 return get_info<info::device::usm_shared_allocations>();
395 case aspect::usm_atomic_shared_allocations:
397 info::device::usm_shared_allocations>::
398 get(MPlatform->getDeviceImpl(MDevice)) &
399 UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_CONCURRENT_ACCESS);
400 case aspect::usm_restricted_shared_allocations:
401 return get_info<info::device::usm_restricted_shared_allocations>();
402 case aspect::usm_system_allocations:
403 return get_info<info::device::usm_system_allocations>();
404 case aspect::ext_intel_device_id:
405 return getPlugin()->call_nocheck(urDeviceGetInfo, MDevice,
406 UR_DEVICE_INFO_DEVICE_ID, 0,
nullptr,
407 &return_size) == UR_RESULT_SUCCESS;
408 case aspect::ext_intel_pci_address:
409 return getPlugin()->call_nocheck(urDeviceGetInfo, MDevice,
410 UR_DEVICE_INFO_PCI_ADDRESS, 0,
nullptr,
411 &return_size) == UR_RESULT_SUCCESS;
412 case aspect::ext_intel_gpu_eu_count:
413 return getPlugin()->call_nocheck(urDeviceGetInfo, MDevice,
414 UR_DEVICE_INFO_GPU_EU_COUNT, 0,
nullptr,
415 &return_size) == UR_RESULT_SUCCESS;
416 case aspect::ext_intel_gpu_eu_simd_width:
418 urDeviceGetInfo, MDevice, UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH, 0,
419 nullptr, &return_size) == UR_RESULT_SUCCESS;
420 case aspect::ext_intel_gpu_slices:
421 return getPlugin()->call_nocheck(urDeviceGetInfo, MDevice,
422 UR_DEVICE_INFO_GPU_EU_SLICES, 0,
nullptr,
423 &return_size) == UR_RESULT_SUCCESS;
424 case aspect::ext_intel_gpu_subslices_per_slice:
426 urDeviceGetInfo, MDevice, UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE,
427 0,
nullptr, &return_size) == UR_RESULT_SUCCESS;
428 case aspect::ext_intel_gpu_eu_count_per_subslice:
429 return getPlugin()->call_nocheck(urDeviceGetInfo, MDevice,
430 UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE,
432 &return_size) == UR_RESULT_SUCCESS;
433 case aspect::ext_intel_gpu_hw_threads_per_eu:
435 urDeviceGetInfo, MDevice, UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU,
436 0,
nullptr, &return_size) == UR_RESULT_SUCCESS;
437 case aspect::ext_intel_free_memory:
438 return getPlugin()->call_nocheck(urDeviceGetInfo, MDevice,
439 UR_DEVICE_INFO_GLOBAL_MEM_FREE, 0,
nullptr,
440 &return_size) == UR_RESULT_SUCCESS;
441 case aspect::ext_intel_memory_clock_rate:
443 urDeviceGetInfo, MDevice, UR_DEVICE_INFO_MEMORY_CLOCK_RATE, 0,
444 nullptr, &return_size) == UR_RESULT_SUCCESS;
445 case aspect::ext_intel_memory_bus_width:
447 urDeviceGetInfo, MDevice, UR_DEVICE_INFO_MEMORY_BUS_WIDTH, 0,
448 nullptr, &return_size) == UR_RESULT_SUCCESS;
449 case aspect::ext_intel_device_info_uuid: {
451 getPlugin()->call_nocheck(urDeviceGetInfo, MDevice, UR_DEVICE_INFO_UUID,
452 0,
nullptr, &return_size);
453 if (Result != UR_RESULT_SUCCESS) {
457 assert(return_size <= 16);
458 unsigned char UUID[16];
461 urDeviceGetInfo, MDevice, UR_DEVICE_INFO_UUID,
462 16 *
sizeof(
unsigned char), UUID,
nullptr) == UR_RESULT_SUCCESS;
464 case aspect::ext_intel_max_mem_bandwidth:
467 case aspect::ext_oneapi_srgb:
468 return get_info<info::device::ext_oneapi_srgb>();
469 case aspect::ext_oneapi_native_assert:
471 case aspect::ext_oneapi_cuda_async_barrier: {
472 int async_barrier_supported;
473 bool call_successful =
475 urDeviceGetInfo, MDevice, UR_DEVICE_INFO_ASYNC_BARRIER,
sizeof(
int),
476 &async_barrier_supported,
nullptr) == UR_RESULT_SUCCESS;
477 return call_successful && async_barrier_supported;
479 case aspect::ext_intel_legacy_image: {
480 ur_bool_t legacy_image_support =
false;
481 bool call_successful =
482 getPlugin()->call_nocheck(urDeviceGetInfo, MDevice,
483 UR_DEVICE_INFO_IMAGE_SUPPORTED,
484 sizeof(ur_bool_t), &legacy_image_support,
485 nullptr) == UR_RESULT_SUCCESS;
486 return call_successful && legacy_image_support;
488 case aspect::ext_oneapi_bindless_images: {
489 ur_bool_t support =
false;
490 bool call_successful =
491 getPlugin()->call_nocheck(urDeviceGetInfo, MDevice,
492 UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP,
493 sizeof(ur_bool_t), &support,
494 nullptr) == UR_RESULT_SUCCESS;
495 return call_successful && support;
497 case aspect::ext_oneapi_bindless_images_shared_usm: {
498 ur_bool_t support =
false;
499 bool call_successful =
501 urDeviceGetInfo, MDevice,
502 UR_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP,
503 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
504 return call_successful && support;
506 case aspect::ext_oneapi_bindless_images_1d_usm: {
507 ur_bool_t support =
false;
508 bool call_successful =
510 urDeviceGetInfo, MDevice,
511 UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP,
512 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
513 return call_successful && support;
515 case aspect::ext_oneapi_bindless_images_2d_usm: {
516 ur_bool_t support =
false;
517 bool call_successful =
519 urDeviceGetInfo, MDevice,
520 UR_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT_EXP,
521 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
522 return call_successful && support;
524 case aspect::ext_oneapi_interop_memory_import: {
525 ur_bool_t support =
false;
526 bool call_successful =
528 urDeviceGetInfo, MDevice,
529 UR_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT_EXP,
sizeof(ur_bool_t),
530 &support,
nullptr) == UR_RESULT_SUCCESS;
531 return call_successful && support;
533 case aspect::ext_oneapi_interop_semaphore_import: {
534 ur_bool_t support =
false;
535 bool call_successful =
537 urDeviceGetInfo, MDevice,
538 UR_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT_EXP,
539 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
540 return call_successful && support;
542 case aspect::ext_oneapi_mipmap: {
543 ur_bool_t support =
false;
544 bool call_successful =
546 urDeviceGetInfo, MDevice, UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP,
547 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
548 return call_successful && support;
550 case aspect::ext_oneapi_mipmap_anisotropy: {
551 ur_bool_t support =
false;
552 bool call_successful =
553 getPlugin()->call_nocheck(urDeviceGetInfo, MDevice,
554 UR_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT_EXP,
555 sizeof(ur_bool_t), &support,
556 nullptr) == UR_RESULT_SUCCESS;
557 return call_successful && support;
559 case aspect::ext_oneapi_mipmap_level_reference: {
560 ur_bool_t support =
false;
561 bool call_successful =
563 urDeviceGetInfo, MDevice,
564 UR_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT_EXP,
565 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
566 return call_successful && support;
568 case aspect::ext_oneapi_bindless_sampled_image_fetch_1d_usm: {
569 ur_bool_t support =
false;
570 bool call_successful =
572 urDeviceGetInfo, MDevice,
573 UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_USM_EXP,
574 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
575 return call_successful && support;
577 case aspect::ext_oneapi_bindless_sampled_image_fetch_1d: {
578 ur_bool_t support =
false;
579 bool call_successful =
581 urDeviceGetInfo, MDevice,
582 UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_EXP,
583 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
584 return call_successful && support;
586 case aspect::ext_oneapi_bindless_sampled_image_fetch_2d_usm: {
587 ur_bool_t support =
false;
588 bool call_successful =
590 urDeviceGetInfo, MDevice,
591 UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_USM_EXP,
592 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
593 return call_successful && support;
595 case aspect::ext_oneapi_bindless_sampled_image_fetch_2d: {
596 ur_bool_t support =
false;
597 bool call_successful =
599 urDeviceGetInfo, MDevice,
600 UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_EXP,
601 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
602 return call_successful && support;
604 case aspect::ext_oneapi_bindless_sampled_image_fetch_3d: {
605 ur_bool_t support =
false;
606 bool call_successful =
608 urDeviceGetInfo, MDevice,
609 UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_3D_EXP,
610 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
611 return call_successful && support;
613 case aspect::ext_oneapi_cubemap: {
614 ur_bool_t support =
false;
615 bool call_successful =
617 urDeviceGetInfo, MDevice, UR_DEVICE_INFO_CUBEMAP_SUPPORT_EXP,
618 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
619 return call_successful && support;
621 case aspect::ext_oneapi_cubemap_seamless_filtering: {
622 ur_bool_t support =
false;
623 bool call_successful =
625 urDeviceGetInfo, MDevice,
626 UR_DEVICE_INFO_CUBEMAP_SEAMLESS_FILTERING_SUPPORT_EXP,
627 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
628 return call_successful && support;
630 case aspect::ext_oneapi_image_array: {
631 ur_bool_t support =
false;
632 bool call_successful =
634 urDeviceGetInfo, MDevice, UR_DEVICE_INFO_IMAGE_ARRAY_SUPPORT_EXP,
635 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
636 return call_successful && support;
638 case aspect::ext_oneapi_unique_addressing_per_dim: {
639 ur_bool_t support =
false;
640 bool call_successful =
642 urDeviceGetInfo, MDevice,
643 UR_DEVICE_INFO_BINDLESS_UNIQUE_ADDRESSING_PER_DIM_EXP,
644 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
645 return call_successful && support;
647 case aspect::ext_oneapi_bindless_images_sample_1d_usm: {
648 ur_bool_t support =
false;
649 bool call_successful =
651 urDeviceGetInfo, MDevice,
652 UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_1D_USM_EXP,
653 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
654 return call_successful && support;
656 case aspect::ext_oneapi_bindless_images_sample_2d_usm: {
657 ur_bool_t support =
false;
658 bool call_successful =
660 urDeviceGetInfo, MDevice,
661 UR_DEVICE_INFO_BINDLESS_SAMPLED_IMAGE_FETCH_2D_USM_EXP,
662 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
663 return call_successful && support;
665 case aspect::ext_intel_esimd: {
666 ur_bool_t support =
false;
667 bool call_successful =
669 urDeviceGetInfo, MDevice, UR_DEVICE_INFO_ESIMD_SUPPORT,
670 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
671 return call_successful && support;
673 case aspect::ext_oneapi_ballot_group:
674 case aspect::ext_oneapi_fixed_size_group:
675 case aspect::ext_oneapi_opportunistic_group: {
680 case aspect::ext_oneapi_tangle_group: {
686 case aspect::ext_intel_matrix: {
688 const std::vector<arch> supported_archs = {
689 arch::intel_cpu_spr, arch::intel_cpu_gnr,
690 arch::intel_gpu_pvc, arch::intel_gpu_dg2_g10,
691 arch::intel_gpu_dg2_g11, arch::intel_gpu_dg2_g12};
694 supported_archs.begin(), supported_archs.end(),
695 [=](
const arch
a) { return this->extOneapiArchitectureIs(a); });
702 case aspect::ext_oneapi_is_composite: {
704 sycl::ext::oneapi::experimental::info::device::component_devices>();
707 return components.size() >= 2;
709 case aspect::ext_oneapi_is_component: {
711 bool CallSuccessful =
714 UrInfoCode<ext::oneapi::experimental::info::device::
715 composite_device>::value,
716 sizeof(Result), &Result,
nullptr) == UR_RESULT_SUCCESS;
718 return CallSuccessful && Result !=
nullptr;
720 case aspect::ext_oneapi_graph: {
721 bool SupportsCommandBufferUpdate =
false;
722 bool CallSuccessful =
724 urDeviceGetInfo, MDevice,
725 UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_SUPPORT_EXP,
726 sizeof(SupportsCommandBufferUpdate), &SupportsCommandBufferUpdate,
727 nullptr) == UR_RESULT_SUCCESS;
728 if (!CallSuccessful) {
732 return has(aspect::ext_oneapi_limited_graph) && SupportsCommandBufferUpdate;
734 case aspect::ext_oneapi_limited_graph: {
735 bool SupportsCommandBuffers =
false;
736 bool CallSuccessful =
738 urDeviceGetInfo, MDevice, UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP,
739 sizeof(SupportsCommandBuffers), &SupportsCommandBuffers,
740 nullptr) == UR_RESULT_SUCCESS;
741 if (!CallSuccessful) {
745 return SupportsCommandBuffers;
747 case aspect::ext_oneapi_private_alloca: {
750 return be == sycl::backend::ext_oneapi_level_zero ||
751 be == sycl::backend::opencl;
753 case aspect::ext_oneapi_queue_profiling_tag: {
754 ur_bool_t support =
false;
755 bool call_successful =
757 urDeviceGetInfo, MDevice,
758 UR_DEVICE_INFO_TIMESTAMP_RECORDING_SUPPORT_EXP,
sizeof(ur_bool_t),
759 &support,
nullptr) == UR_RESULT_SUCCESS;
760 return call_successful && support;
762 case aspect::ext_oneapi_virtual_mem: {
763 ur_bool_t support =
false;
764 bool call_successful =
766 urDeviceGetInfo, MDevice, UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT,
767 sizeof(ur_bool_t), &support,
nullptr) == UR_RESULT_SUCCESS;
768 return call_successful && support;
770 case aspect::ext_intel_fpga_task_sequence: {
779 return MIsAssertFailSupported;
783 std::call_once(MDeviceNameFlag,
784 [
this]() { MDeviceName = get_info<info::device::name>(); });
790 std::call_once(MDeviceArchFlag, [
this]() {
792 get_info<ext::oneapi::experimental::info::device::architecture>();
810 using namespace std::chrono;
812 duration_cast<nanoseconds>(steady_clock::now().time_since_epoch())
817 constexpr uint64_t TimeTillRefresh = 200e9;
818 assert(HostTime >= MDeviceHostBaseTime.second);
819 uint64_t Diff = HostTime - MDeviceHostBaseTime.second;
822 if (!MDeviceHostBaseTime.second || Diff > TimeTillRefresh) {
824 auto Result = Plugin->call_nocheck(urDeviceGetGlobalTimestamps, MDevice,
825 &MDeviceHostBaseTime.first,
826 &MDeviceHostBaseTime.second);
838 duration_cast<nanoseconds>(steady_clock::now().time_since_epoch())
840 if (Result == UR_RESULT_ERROR_INVALID_OPERATION) {
847 "Device and/or backend does not support querying timestamp."),
848 UR_RESULT_ERROR_INVALID_OPERATION);
854 MDeviceHostBaseTime.second = HostTime;
857 return MDeviceHostBaseTime.first + Diff;
862 uint64_t DeviceTime = 0, HostTime = 0;
863 auto Result = Plugin->call_nocheck(urDeviceGetGlobalTimestamps, MDevice,
864 &DeviceTime, &HostTime);
865 return Result != UR_RESULT_ERROR_INVALID_OPERATION;
885 return sycl::ext::oneapi::experimental::forward_progress_guarantee::
899 const int executionScopeSize = 4;
900 (void)coordinationScope;
901 int threadScopeNum =
static_cast<int>(threadScope);
906 int guaranteeNum =
static_cast<int>(
908 for (
int currentScope = executionScopeSize - 2; currentScope > threadScopeNum;
910 guaranteeNum = std::max(guaranteeNum,
922 std::vector<ext::oneapi::experimental::forward_progress_guarantee>;
923 auto guarantees = getProgressGuaranteesUpTo<ReturnT>(
925 return std::find(guarantees.begin(), guarantees.end(), guarantee) !=
941 switch (coordination_scope) {
942 case execution_scope::root_group:
943 return forward_progress_guarantee::parallel;
944 case execution_scope::work_group:
945 case execution_scope::sub_group:
946 return forward_progress_guarantee::weakly_parallel;
949 "Work item is not a valid coordination scope!");
952 switch (coordination_scope) {
953 case execution_scope::root_group:
954 case execution_scope::work_group:
955 return forward_progress_guarantee::concurrent;
956 case execution_scope::sub_group:
957 return forward_progress_guarantee::weakly_parallel;
960 "Work item is not a valid coordination scope!");
963 return forward_progress_guarantee::weakly_parallel;
ur_native_handle_t getNative() const
Gets the native handle of the SYCL device.
std::vector< device > create_sub_devices() const
Partition device into sub devices.
bool has(aspect Aspect) const
Indicates if the SYCL device has the given feature.
Param::return_type get_info() const
Queries this SYCL device for information requested by the template parameter param.
platform get_platform() const
Get associated SYCL platform.
bool isGetDeviceAndHostTimerSupported()
Check clGetDeviceAndHostTimer is available for fallback profiling.
std::string get_device_info_string(ur_device_info_t InfoCode) const
Get device info string.
device_impl()
Constructs a SYCL device instance as a host device.
bool is_cpu() const
Check if device is a CPU device.
backend getBackend() const
Get the backend of this device.
const PluginPtr & getPlugin() const
bool is_gpu() const
Check if device is a GPU device.
uint64_t getCurrentDeviceTime()
Gets the current device timestamp.
std::string getDeviceName() const
bool has_extension(const std::string &ExtensionName) const
Check SYCL extension support by device.
ur_device_handle_t & getHandleRef()
Get reference to UR device.
static sycl::ext::oneapi::experimental::forward_progress_guarantee getHostProgressGuarantee(sycl::ext::oneapi::experimental::execution_scope threadScope, sycl::ext::oneapi::experimental::execution_scope coordinationScope)
sycl::ext::oneapi::experimental::forward_progress_guarantee getProgressGuarantee(ext::oneapi::experimental::execution_scope threadScope, ext::oneapi::experimental::execution_scope coordinationScope) const
bool is_affinity_supported(info::partition_affinity_domain AffinityDomain) const
Check if affinity partitioning by specified domain is supported by device.
bool isAssertFailSupported() const
cl_device_id get() const
Get instance of OpenCL device.
ext::oneapi::experimental::architecture getDeviceArch() const
Get device architecture.
bool supportsForwardProgress(ext::oneapi::experimental::forward_progress_guarantee guarantee, ext::oneapi::experimental::execution_scope threadScope, ext::oneapi::experimental::execution_scope coordinationScope) const
ext::oneapi::experimental::forward_progress_guarantee getImmediateProgressGuarantee(ext::oneapi::experimental::execution_scope coordination_scope) const
bool extOneapiCanCompile(ext::oneapi::experimental::source_language Language)
bool is_partition_supported(info::partition_property Prop) const
Check if desired partition property supported by device.
bool is_accelerator() const
Check if device is an accelerator device.
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
std::string affinityDomainToString(info::partition_affinity_domain AffinityDomain)
static const PluginPtr & getPlugin(backend Backend)
std::shared_ptr< plugin > PluginPtr
std::shared_ptr< detail::platform_impl > PlatformImplPtr
exception set_ur_error(exception &&e, int32_t ur_err)
Function for_each(Group g, Ptr first, Ptr last, Function f)
bool is_source_kernel_bundle_supported(backend BE, source_language Language)
forward_progress_guarantee
@ partition_by_affinity_domain
@ ext_intel_partition_by_cslice
partition_affinity_domain
std::error_code make_error_code(sycl::errc E) noexcept
Constructs an error code using e and sycl_category()
#define __SYCL_CHECK_OCL_CODE_NO_EXC(X)
bool any_of(const simd_mask< _Tp, _Abi > &) noexcept
C++ utilities for Unified Runtime integration.
#define UR_DEVICE_INFO_EXTENSION_DEVICELIB_ASSERT
Extension to denote native support of assert feature by an arbitrary device urDeviceGetInfo call shou...