@@ -127,6 +127,9 @@ static sycl::detail::ESIMDEmuPluginOpaqueData *PiESimdDeviceAccess;
127
127
// For PI_DEVICE_INFO_DRIVER_VERSION info
128
128
static char ESimdEmuVersionString[32 ];
129
129
130
+ // For PI_DEVICE_INFO_VERSION info
131
+ static char CmEmuDeviceVersionString[32 ];
132
+
130
133
using IDBuilder = sycl::detail::Builder;
131
134
132
135
template <int NDims>
@@ -463,6 +466,23 @@ pi_result piDevicesGet(pi_platform Platform, pi_device_type DeviceType,
463
466
464
467
int Result = cm_support::CreateCmDevice (CmDevice, Version);
465
468
469
+ // CM Device version info consists of two decimal numbers - major
470
+ // and minor. Minor is single-digit. Version info is encoded into a
471
+ // unsigned integer value = 100 * major + minor. Second from right
472
+ // digit in decimal must be zero as it is used as 'dot'
473
+ // REF - $CM_EMU/common/cm_version_defs.h - 'CURRENT_CM_VERSION'
474
+ // e.g. CM version 7.3 => Device version = 703
475
+
476
+ if (((Version / 10 ) % 10 ) == 0 ) {
477
+ if (PrintPiTrace) {
478
+ std::cerr << " CM_EMU Device version info is incorrect" << std::endl;
479
+ }
480
+ return PI_INVALID_DEVICE;
481
+ }
482
+
483
+ sprintf (CmEmuDeviceVersionString, " %d.%d" , (int )(Version / 100 ),
484
+ (int )(Version % 10 ));
485
+
466
486
if (Result != cm_support::CM_SUCCESS) {
467
487
return PI_INVALID_DEVICE;
468
488
}
@@ -536,9 +556,7 @@ pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName,
536
556
// cl_khr_int64_extended_atomics
537
557
return ReturnValue (" " );
538
558
case PI_DEVICE_INFO_VERSION:
539
- // CM_EMU release version from
540
- // https://github.com/intel/cm-cpu-emulation/releases
541
- return ReturnValue (" 1.0" );
559
+ return ReturnValue (CmEmuDeviceVersionString);
542
560
case PI_DEVICE_INFO_COMPILER_AVAILABLE:
543
561
return ReturnValue (pi_bool{false });
544
562
case PI_DEVICE_INFO_LINKER_AVAILABLE:
0 commit comments