Lunderberg commented on a change in pull request #7867:
URL: https://github.com/apache/tvm/pull/7867#discussion_r616195716
##########
File path: src/runtime/opencl/opencl_device_api.cc
##########
@@ -72,20 +75,26 @@ void OpenCLWorkspace::GetAttr(Device dev, DeviceAttrKind
kind, TVMRetValue* rv)
*rv = static_cast<int64_t>(value);
break;
}
- case kComputeVersion:
- return;
- case kDeviceName: {
- char value[128] = {0};
- OPENCL_CALL(
- clGetDeviceInfo(devices[index], CL_DEVICE_NAME, sizeof(value) - 1,
value, nullptr));
- *rv = std::string(value);
+ case kComputeVersion: {
+ std::string ret = GetDeviceInfo(devices[index], CL_DEVICE_VERSION);
+ // String returned is "OpenCL $MAJOR.$MINOR $VENDOR_INFO". To
+ // match other implementations, we want to return "$MAJOR.$MINOR"
Review comment:
Ooh, I think I see the confusion. The current commit on main queries
`CL_DEVICE_NAME` for `kDeviceName`, but returns immediately for
`kComputeVersion`. The PR here would still query `CL_DEVICE_NAME` for
`kDeviceName`, but has the suffix-stripping for `kComputeVersion`.
The handling of `kDeviceName` is a few lines below, lines 88-90 of the
modified file. I noticed that it could take advantage of the `GetDeviceInfo`
helper function that was already in this file, which is why it looks a bit
different than in the previous. It still shows the full device name without
any modification (e.g. "GeForce GTX 1080" on my machine)
```
device_type cpu gpu opencl
vulkan
attribute
kApiVersion None 10010 220
131
kComputeVersion None 6.1 1.2
1.2.133
kDeviceName None GeForce GTX 1080 GeForce GTX 1080 GeForce
GTX 1080
kDriverVersion None None 450.102.04
450.408.256
kGcnArch None None None
None
kMaxClockRate None 1809500 1809000
None
kMaxRegistersPerBlock None 65536 None
None
kMaxSharedMemoryPerBlock None 49152 49152
49152
kMaxThreadDimensions None [1024, 1024, 64] [1024, 1024, 64] [1536,
1024, 64]
kMaxThreadsPerBlock None 1024 1024
1536
kMultiProcessorCount None 20 20
None
kWarpSize None 32 1
32
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]