From a241286859114c6091a86186aa680d638917a05a Mon Sep 17 00:00:00 2001 From: fclem Date: Thu, 9 Aug 2018 15:27:19 +0200 Subject: Cycles: Util, add to_string() with some helper Currently unused, but will allow to convert unknown argument type to a string for reporting and such. --- intern/cycles/util/util_string.cpp | 5 +++++ intern/cycles/util/util_string.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/intern/cycles/util/util_string.cpp b/intern/cycles/util/util_string.cpp index 995f5d3df27..47119e90a45 100644 --- a/intern/cycles/util/util_string.cpp +++ b/intern/cycles/util/util_string.cpp @@ -168,6 +168,11 @@ string string_from_bool(bool var) return "False"; } +string to_string(const char *str) +{ + return string(str); +} + /* Wide char strings helpers for Windows. */ #ifdef _WIN32 diff --git a/intern/cycles/util/util_string.h b/intern/cycles/util/util_string.h index 7dfa97335a9..3a4f4398158 100644 --- a/intern/cycles/util/util_string.h +++ b/intern/cycles/util/util_string.h @@ -29,6 +29,7 @@ using std::string; using std::stringstream; using std::ostringstream; using std::istringstream; +using std::to_string; #ifdef __GNUC__ #define PRINTF_ATTRIBUTE __attribute__((format(printf, 1, 2))) @@ -49,6 +50,7 @@ bool string_endswith(const string& s, const char *end); string string_strip(const string& s); string string_remove_trademark(const string& s); string string_from_bool(const bool var); +string to_string(const char *str); /* Wide char strings are only used on Windows to deal with non-ascii * characters in file names and such. No reason to use such strings -- cgit v1.2.3 From 01feb5d6cc3ffac99778ef2ef7b66b6b24e0980d Mon Sep 17 00:00:00 2001 From: fclem Date: Thu, 9 Aug 2018 15:31:44 +0200 Subject: Cycles: Report more details about OpenCL devices --- intern/cycles/device/device_opencl.cpp | 43 ++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp index 95eef8263d4..be0f8f45399 100644 --- a/intern/cycles/device/device_opencl.cpp +++ b/intern/cycles/device/device_opencl.cpp @@ -23,6 +23,7 @@ #include "util/util_foreach.h" #include "util/util_logging.h" #include "util/util_set.h" +#include "util/util_string.h" CCL_NAMESPACE_BEGIN @@ -166,11 +167,14 @@ string device_opencl_capabilities(void) platform_ids.resize(num_platforms); opencl_assert(clGetPlatformIDs(num_platforms, &platform_ids[0], NULL)); -#define APPEND_STRING_INFO(func, id, name, what) \ + typedef char cl_string[1024]; + +#define APPEND_INFO(func, id, name, what, type) \ do { \ - char data[1024] = "\0"; \ + type data; \ + memset(&data, 0, sizeof(data)); \ opencl_assert(func(id, what, sizeof(data), &data, NULL)); \ - result += string_printf("%s: %s\n", name, data); \ + result += string_printf("%s: %s\n", name, to_string(data).c_str()); \ } while(false) #define APPEND_STRING_EXTENSION_INFO(func, id, name, what) \ do { \ @@ -182,10 +186,10 @@ string device_opencl_capabilities(void) } \ } \ } while(false) -#define APPEND_PLATFORM_STRING_INFO(id, name, what) \ - APPEND_STRING_INFO(clGetPlatformInfo, id, "\tPlatform " name, what) -#define APPEND_DEVICE_STRING_INFO(id, name, what) \ - APPEND_STRING_INFO(clGetDeviceInfo, id, "\t\t\tDevice " name, what) +#define APPEND_PLATFORM_INFO(id, name, what, type) \ + APPEND_INFO(clGetPlatformInfo, id, "\tPlatform " name, what, type) +#define APPEND_DEVICE_INFO(id, name, what, type) \ + APPEND_INFO(clGetDeviceInfo, id, "\t\t\tDevice " name, what, type) #define APPEND_DEVICE_STRING_EXTENSION_INFO(id, name, what) \ APPEND_STRING_EXTENSION_INFO(clGetDeviceInfo, id, "\t\t\tDevice " name, what) @@ -195,11 +199,11 @@ string device_opencl_capabilities(void) result += string_printf("Platform #%u\n", platform); - APPEND_PLATFORM_STRING_INFO(platform_id, "Name", CL_PLATFORM_NAME); - APPEND_PLATFORM_STRING_INFO(platform_id, "Vendor", CL_PLATFORM_VENDOR); - APPEND_PLATFORM_STRING_INFO(platform_id, "Version", CL_PLATFORM_VERSION); - APPEND_PLATFORM_STRING_INFO(platform_id, "Profile", CL_PLATFORM_PROFILE); - APPEND_PLATFORM_STRING_INFO(platform_id, "Extensions", CL_PLATFORM_EXTENSIONS); + APPEND_PLATFORM_INFO(platform_id, "Name", CL_PLATFORM_NAME, cl_string); + APPEND_PLATFORM_INFO(platform_id, "Vendor", CL_PLATFORM_VENDOR, cl_string); + APPEND_PLATFORM_INFO(platform_id, "Version", CL_PLATFORM_VERSION, cl_string); + APPEND_PLATFORM_INFO(platform_id, "Profile", CL_PLATFORM_PROFILE, cl_string); + APPEND_PLATFORM_INFO(platform_id, "Extensions", CL_PLATFORM_EXTENSIONS, cl_string); cl_uint num_devices = 0; opencl_assert(clGetDeviceIDs(platform_ids[platform], @@ -220,13 +224,16 @@ string device_opencl_capabilities(void) result += string_printf("\t\tDevice: #%u\n", device); - APPEND_DEVICE_STRING_INFO(device_id, "Name", CL_DEVICE_NAME); + APPEND_DEVICE_INFO(device_id, "Name", CL_DEVICE_NAME, cl_string); APPEND_DEVICE_STRING_EXTENSION_INFO(device_id, "Board Name", CL_DEVICE_BOARD_NAME_AMD); - APPEND_DEVICE_STRING_INFO(device_id, "Vendor", CL_DEVICE_VENDOR); - APPEND_DEVICE_STRING_INFO(device_id, "OpenCL C Version", CL_DEVICE_OPENCL_C_VERSION); - APPEND_DEVICE_STRING_INFO(device_id, "Profile", CL_DEVICE_PROFILE); - APPEND_DEVICE_STRING_INFO(device_id, "Version", CL_DEVICE_VERSION); - APPEND_DEVICE_STRING_INFO(device_id, "Extensions", CL_DEVICE_EXTENSIONS); + APPEND_DEVICE_INFO(device_id, "Vendor", CL_DEVICE_VENDOR, cl_string); + APPEND_DEVICE_INFO(device_id, "OpenCL C Version", CL_DEVICE_OPENCL_C_VERSION, cl_string); + APPEND_DEVICE_INFO(device_id, "Profile", CL_DEVICE_PROFILE, cl_string); + APPEND_DEVICE_INFO(device_id, "Version", CL_DEVICE_VERSION, cl_string); + APPEND_DEVICE_INFO(device_id, "Extensions", CL_DEVICE_EXTENSIONS, cl_string); + APPEND_DEVICE_INFO(device_id, "Max clock frequency (MHz)", CL_DEVICE_MAX_CLOCK_FREQUENCY, cl_uint); + APPEND_DEVICE_INFO(device_id, "Max compute units", CL_DEVICE_MAX_COMPUTE_UNITS, cl_uint); + APPEND_DEVICE_INFO(device_id, "Max work group size", CL_DEVICE_MAX_WORK_GROUP_SIZE, size_t); } } -- cgit v1.2.3 From e20a0798dc6ca38eb4a06dda7948bd1c306d0693 Mon Sep 17 00:00:00 2001 From: fclem Date: Thu, 9 Aug 2018 15:41:24 +0200 Subject: Cycles: Append compute units for RX Vega card names Makes it more clear whether compute device is Vega 56 or Vega 64. --- intern/cycles/device/opencl/opencl_util.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/intern/cycles/device/opencl/opencl_util.cpp b/intern/cycles/device/opencl/opencl_util.cpp index 9104f64bedd..d6304ba688a 100644 --- a/intern/cycles/device/opencl/opencl_util.cpp +++ b/intern/cycles/device/opencl/opencl_util.cpp @@ -1136,6 +1136,21 @@ string OpenCLInfo::get_readable_device_name(cl_device_id device_id) name = get_device_name(device_id); } + /* Special exception for AMD Vega, need to be able to tell + * Vega 56 from 64 apart. + */ + if (name == "Radeon RX Vega") { + cl_int max_compute_units = 0; + if (clGetDeviceInfo(device_id, + CL_DEVICE_MAX_COMPUTE_UNITS, + sizeof(max_compute_units), + &max_compute_units, + NULL) == CL_SUCCESS) + { + name += " " + to_string(max_compute_units); + } + } + /* Distinguish from our native CPU device. */ if(get_device_type(device_id) & CL_DEVICE_TYPE_CPU) { name += " (OpenCL)"; -- cgit v1.2.3