Skip to content

Commit 5f4dd11

Browse files
authored
Merge pull request #1447 from Bensuo/ewan/rocm_5_5_1
[HIP][CMDBUF] Require ROCm 5.5.1 for HIP command-buffers
2 parents ed1f8bf + b551c77 commit 5f4dd11

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

source/adapters/hip/device.cpp

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,20 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
539539
// native asserts are in progress
540540
std::string SupportedExtensions = "";
541541
SupportedExtensions += "pi_ext_intel_devicelib_assert ";
542-
// Return supported for the UR command-buffer experimental feature
543-
SupportedExtensions += "ur_exp_command_buffer ";
542+
543+
int RuntimeVersion = 0;
544+
UR_CHECK_ERROR(hipRuntimeGetVersion(&RuntimeVersion));
545+
546+
// Return supported for the UR command-buffer experimental feature on
547+
// ROCM 5.5.1 and later. This is to workaround HIP driver bug
548+
// https://github.com/ROCm/HIP/issues/2450 in older versions.
549+
//
550+
// The version is returned as (10000000 major + 1000000 minor + patch).
551+
const int CmdBufDriverMinVersion = 50530202; // ROCM 5.5.1
552+
if (RuntimeVersion >= CmdBufDriverMinVersion) {
553+
SupportedExtensions += "ur_exp_command_buffer ";
554+
}
555+
544556
SupportedExtensions += " ";
545557

546558
hipDeviceProp_t Props;
@@ -844,9 +856,18 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
844856
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
845857

846858
case UR_DEVICE_INFO_COMMAND_BUFFER_SUPPORT_EXP:
847-
case UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_SUPPORT_EXP:
848-
return ReturnValue(true);
859+
case UR_DEVICE_INFO_COMMAND_BUFFER_UPDATE_SUPPORT_EXP: {
860+
int DriverVersion = 0;
861+
UR_CHECK_ERROR(hipDriverGetVersion(&DriverVersion));
849862

863+
// Return supported for the UR command-buffer experimental feature on
864+
// ROCM 5.5.1 and later. This is to workaround HIP driver bug
865+
// https://github.com/ROCm/HIP/issues/2450 in older versions.
866+
//
867+
// The version is returned as (10000000 major + 1000000 minor + patch).
868+
const int CmdBufDriverMinVersion = 50530202; // ROCM 5.5.1
869+
return ReturnValue(DriverVersion >= CmdBufDriverMinVersion);
870+
}
850871
default:
851872
break;
852873
}

0 commit comments

Comments
 (0)