File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
unified-runtime/source/adapters/level_zero Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -273,6 +273,22 @@ ur_result_t urDeviceGetInfo(
273273 const auto &UUID = Device->ZeDeviceProperties ->uuid .id ;
274274 return ReturnValue (UUID, sizeof (UUID));
275275 }
276+ case UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH: {
277+ // ZeDeviceMemoryProperties should be set already by initialization
278+ if (Device->ZeDeviceMemoryProperties ->second .empty ())
279+ return ReturnValue (uint64_t {0 });
280+
281+ uint32_t maxBandwidth = 0 ;
282+ for (const auto &extProp : Device->ZeDeviceMemoryProperties ->second ) {
283+ // Only consider bandwidth if the unit is BYTES_PER_NANOSEC
284+ if (extProp.bandwidthUnit == ZE_BANDWIDTH_UNIT_BYTES_PER_NANOSEC) {
285+ maxBandwidth = std::max (
286+ {maxBandwidth, extProp.readBandwidth , extProp.writeBandwidth });
287+ }
288+ }
289+ // Convert to Bytes/sec from Bytes/nanosec
290+ return ReturnValue (static_cast <uint64_t >(maxBandwidth * 1e9 ));
291+ }
276292 case UR_DEVICE_INFO_ATOMIC_64:
277293 return ReturnValue (
278294 static_cast <ur_bool_t >(Device->ZeDeviceModuleProperties ->flags &
You can’t perform that action at this time.
0 commit comments