From 16bb1d83c5e4c4ee1d73f254e7527345751193c7 Mon Sep 17 00:00:00 2001 From: Jack Frankland <30410009+FranklandJack@users.noreply.github.com> Date: Wed, 1 Jul 2020 17:30:31 +0100 Subject: [PATCH] Add `CL_DEVICE_NAME` to clDeviceInfo File (#836) - [x] Add `CL_DEVICE_NAME` to list of device properties printed into the clDeviceInfo file for offline compilation testing. - [x] Add `get_device_name` helper function. - [x] Update offline compiler interface explanation file with `CL_DEVICE_NAME` and `CL_DEVICE_IMAGE_SUPPORT` which was missed from this file when added. --- test_common/harness/cl_offline_compiler-interface.txt | 2 ++ test_common/harness/deviceInfo.cpp | 6 ++++++ test_common/harness/deviceInfo.h | 2 ++ test_common/harness/kernelHelpers.cpp | 2 ++ 4 files changed, 12 insertions(+) diff --git a/test_common/harness/cl_offline_compiler-interface.txt b/test_common/harness/cl_offline_compiler-interface.txt index 30ab1822..fd6997de 100644 --- a/test_common/harness/cl_offline_compiler-interface.txt +++ b/test_common/harness/cl_offline_compiler-interface.txt @@ -23,3 +23,5 @@ It is of the following form: CL_DEVICE_EXTENSIONS="" CL_DEVICE_IL_VERSION="" CL_DEVICE_VERSION="OpenCL " + CL_DEVICE_IMAGE_SUPPORT=<0|1> + CL_DEVICE_NAME="device name" diff --git a/test_common/harness/deviceInfo.cpp b/test_common/harness/deviceInfo.cpp index a5b0a588..c9816fa2 100644 --- a/test_common/harness/deviceInfo.cpp +++ b/test_common/harness/deviceInfo.cpp @@ -79,3 +79,9 @@ std::string get_device_version_string(cl_device_id device) { return get_device_info_string(device, CL_DEVICE_VERSION); } + +/* Returns a string containing the device name. */ +std::string get_device_name(cl_device_id device) +{ + return get_device_info_string(device, CL_DEVICE_NAME); +} diff --git a/test_common/harness/deviceInfo.h b/test_common/harness/deviceInfo.h index d4432ea8..87afdc60 100644 --- a/test_common/harness/deviceInfo.h +++ b/test_common/harness/deviceInfo.h @@ -35,4 +35,6 @@ std::string get_device_il_version_string(cl_device_id device); /* Returns a string containing the supported OpenCL version for a device. */ std::string get_device_version_string(cl_device_id device); +/* Returns a string containing the device name. */ +std::string get_device_name(cl_device_id device); #endif // _deviceInfo_h diff --git a/test_common/harness/kernelHelpers.cpp b/test_common/harness/kernelHelpers.cpp index ee1be76e..6dbd63f2 100644 --- a/test_common/harness/kernelHelpers.cpp +++ b/test_common/harness/kernelHelpers.cpp @@ -374,6 +374,8 @@ static cl_int get_cl_device_info_str(const cl_device_id device, const cl_uint de clDeviceInfoStream << "CL_DEVICE_VERSION=\"" << versionString << "\"" << std::endl; clDeviceInfoStream << "CL_DEVICE_IMAGE_SUPPORT=" << (0 == checkForImageSupport(device)) << std::endl; + clDeviceInfoStream << "CL_DEVICE_NAME=\"" << get_device_name(device).c_str() + << "\"" << std::endl; clDeviceInfo = clDeviceInfoStream.str();