@@ -924,6 +924,32 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t device,
924
924
925
925
return ReturnValue (memory_bandwidth);
926
926
}
927
+ case UR_DEVICE_INFO_IL_VERSION: {
928
+ std::string il_version = " nvptx-" ;
929
+
930
+ int driver_version = 0 ;
931
+ cuDriverGetVersion (&driver_version);
932
+ int major = driver_version / 1000 ;
933
+ int minor = driver_version % 1000 / 10 ;
934
+
935
+ // We can work out which ptx ISA version we support based on the versioning
936
+ // table published here
937
+ // https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#release-notes
938
+ // Major versions that we support are consistent in how they line up, so we
939
+ // can derive that easily. The minor versions for version 10 don't line up
940
+ // the same so it needs a special case. This is not ideal but it does seem
941
+ // to be the best bet to avoid a maintenance burden here.
942
+ il_version += std::to_string (major - 4 ) + " ." ;
943
+ if (major == 10 ) {
944
+ il_version += std::to_string (minor + 3 );
945
+ } else if (major >= 11 ) {
946
+ il_version += std::to_string (minor);
947
+ } else {
948
+ return UR_RESULT_ERROR_INVALID_VALUE;
949
+ }
950
+
951
+ return ReturnValue (il_version.data (), il_version.size ());
952
+ }
927
953
case UR_EXT_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP: {
928
954
// Maximum number of 32-bit registers available to a thread block.
929
955
// Note: This number is shared by all thread blocks simultaneously resident
0 commit comments