File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -340,8 +340,15 @@ Error olGetDeviceInfoImplDetail(ol_device_handle_t Device,
340340 // None of the existing plugins specify a limit on a single allocation,
341341 // so return the global memory size instead
342342 case OL_DEVICE_INFO_MAX_MEM_ALLOC_SIZE:
343- PropName = OL_DEVICE_INFO_GLOBAL_MEM_SIZE;
344- break ;
343+ [[fallthrough]];
344+ // AMD doesn't provide the global memory size (trivially) with the device info
345+ // struct, so use the plugin interface
346+ case OL_DEVICE_INFO_GLOBAL_MEM_SIZE: {
347+ uint64_t Mem;
348+ if (auto Err = Device->Device ->getDeviceMemorySize (Mem))
349+ return Err;
350+ return Info.write <uint64_t >(Mem);
351+ } break ;
345352
346353 default :
347354 break ;
@@ -369,14 +376,6 @@ Error olGetDeviceInfoImplDetail(ol_device_handle_t Device,
369376 return Info.writeString (std::get<std::string>(Entry->Value ).c_str ());
370377 }
371378
372- case OL_DEVICE_INFO_GLOBAL_MEM_SIZE: {
373- // Uint64 values
374- if (!std::holds_alternative<uint64_t >(Entry->Value ))
375- return makeError (ErrorCode::BACKEND_FAILURE,
376- " plugin returned incorrect type" );
377- return Info.write (std::get<uint64_t >(Entry->Value ));
378- }
379-
380379 case OL_DEVICE_INFO_MAX_WORK_GROUP_SIZE:
381380 case OL_DEVICE_INFO_VENDOR_ID:
382381 case OL_DEVICE_INFO_NUM_COMPUTE_UNITS:
You can’t perform that action at this time.
0 commit comments