Skip to content

Commit bb4f997

Browse files
committed
[HIP] Add a workaround for crashes on gfx1031
When calling hipMemGetInfo, an internal problem querying the amount of available global memory causes the function to return hipErrorInvalidValue. This is indistinguishable from us doing something wrong, and it (rightly) causes an assertion failure. This is a particularly egregious issue because we query this property and crash during the execution of `sycl-ls --verbose`. This architecture is not officially supported by HIP, so we can't file a bug and shouldn't expect an official fix for this issue any time soon. It is possible, however, that we'll need to extend this workaround with other architectures over time.
1 parent 4a7bf7b commit bb4f997

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

source/adapters/hip/device.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,18 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
724724
}
725725

726726
case UR_DEVICE_INFO_GLOBAL_MEM_FREE: {
727+
// Work around an issue on some (unsupported) architectures,
728+
// where hipMemGetInfo fails internally and returns hipErrorInvalidValue
729+
// when trying to query the amount of available global memory. Since we
730+
// can't distinguish this condition from us doing something wrong, we can't
731+
// handle it gracefully.
732+
hipDeviceProp_t Props;
733+
detail::ur::assertion(hipGetDeviceProperties(&Props, hDevice->get()) ==
734+
hipSuccess);
735+
if (strcmp(Props.gcnArchName, "gfx1031") == 0) {
736+
return ReturnValue(0);
737+
}
738+
727739
size_t FreeMemory = 0;
728740
size_t TotalMemory = 0;
729741
detail::ur::assertion(hipMemGetInfo(&FreeMemory, &TotalMemory) ==

0 commit comments

Comments
 (0)