Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 33 additions & 8 deletions sycl/plugins/level_zero/pi_level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,12 @@ pi_result _pi_device::initialize(int SubSubDeviceOrdinal,
(ZeDevice, &Count, Properties.data()));
};

ZeDeviceMemoryAccessProperties.Compute =
[ZeDevice](ze_device_memory_access_properties_t &Properties) {
ZE_CALL_NOCHECK(zeDeviceGetMemoryAccessProperties,
(ZeDevice, &Properties));
};

ZeDeviceCacheProperties.Compute =
[ZeDevice](ze_device_cache_properties_t &Properties) {
// TODO: Since v1.0 there can be multiple cache properties.
Expand Down Expand Up @@ -2672,14 +2678,33 @@ pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName,
case PI_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT:
case PI_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT:
case PI_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT: {
pi_uint64 Supported = 0;
// TODO[1.0]: how to query for USM support now?
if (true) {
// TODO: Use ze_memory_access_capabilities_t
Supported = PI_USM_ACCESS | PI_USM_ATOMIC_ACCESS |
PI_USM_CONCURRENT_ACCESS | PI_USM_CONCURRENT_ATOMIC_ACCESS;
}
return ReturnValue(Supported);
auto MapCaps = [](const ze_memory_access_cap_flags_t &ZeCapabilities) {
pi_uint64 Capabilities = 0;
if (ZeCapabilities & ZE_MEMORY_ACCESS_CAP_FLAG_RW)
Capabilities |= PI_USM_ACCESS;
if (ZeCapabilities & ZE_MEMORY_ACCESS_CAP_FLAG_ATOMIC)
Capabilities |= PI_USM_ATOMIC_ACCESS;
if (ZeCapabilities & ZE_MEMORY_ACCESS_CAP_FLAG_CONCURRENT)
Capabilities |= PI_USM_CONCURRENT_ACCESS;
if (ZeCapabilities & ZE_MEMORY_ACCESS_CAP_FLAG_CONCURRENT_ATOMIC)
Capabilities |= PI_USM_CONCURRENT_ATOMIC_ACCESS;
return Capabilities;
};
auto &Props = Device->ZeDeviceMemoryAccessProperties;
switch (ParamName) {
case PI_DEVICE_INFO_USM_HOST_SUPPORT:
return ReturnValue(MapCaps(Props->hostAllocCapabilities));
case PI_DEVICE_INFO_USM_DEVICE_SUPPORT:
return ReturnValue(MapCaps(Props->deviceAllocCapabilities));
case PI_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT:
return ReturnValue(MapCaps(Props->sharedSingleDeviceAllocCapabilities));
case PI_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT:
return ReturnValue(MapCaps(Props->sharedCrossDeviceAllocCapabilities));
case PI_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT:
return ReturnValue(MapCaps(Props->sharedSystemAllocCapabilities));
default:
die("piDeviceGetInfo: enexpected ParamName.");
}
}

// intel extensions for GPU information
Expand Down
6 changes: 6 additions & 0 deletions sycl/plugins/level_zero/pi_level_zero.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ template <>
ze_structure_type_t getZeStructureType<ze_device_memory_properties_t>() {
return ZE_STRUCTURE_TYPE_DEVICE_MEMORY_PROPERTIES;
}
template <>
ze_structure_type_t getZeStructureType<ze_device_memory_access_properties_t>() {
return ZE_STRUCTURE_TYPE_DEVICE_MEMORY_ACCESS_PROPERTIES;
}
template <> ze_structure_type_t getZeStructureType<ze_module_properties_t>() {
return ZE_STRUCTURE_TYPE_MODULE_PROPERTIES;
}
Expand Down Expand Up @@ -384,6 +388,8 @@ struct _pi_device : _pi_object {
ZeCache<ZeStruct<ze_device_module_properties_t>> ZeDeviceModuleProperties;
ZeCache<std::vector<ZeStruct<ze_device_memory_properties_t>>>
ZeDeviceMemoryProperties;
ZeCache<ZeStruct<ze_device_memory_access_properties_t>>
ZeDeviceMemoryAccessProperties;
ZeCache<ZeStruct<ze_device_cache_properties_t>> ZeDeviceCacheProperties;
};

Expand Down
4 changes: 2 additions & 2 deletions sycl/source/detail/device_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ bool device_impl::has(aspect Aspect) const {
(get_device_info<
pi_usm_capabilities,
info::device::usm_host_allocations>::get(MDevice, getPlugin()) &
PI_USM_ATOMIC_ACCESS);
PI_USM_CONCURRENT_ATOMIC_ACCESS);
case aspect::usm_shared_allocations:
return get_info<info::device::usm_shared_allocations>();
case aspect::usm_atomic_shared_allocations:
Expand All @@ -271,7 +271,7 @@ bool device_impl::has(aspect Aspect) const {
pi_usm_capabilities,
info::device::usm_shared_allocations>::get(MDevice,
getPlugin()) &
PI_USM_ATOMIC_ACCESS);
PI_USM_CONCURRENT_ATOMIC_ACCESS);
case aspect::usm_restricted_shared_allocations:
return get_info<info::device::usm_restricted_shared_allocations>();
case aspect::usm_system_allocations:
Expand Down