Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-08-09 17:03:09 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-08-09 17:03:09 +0300
commitb70f85f2aae977dc361d40b73cf5a110495c6cab (patch)
treebb6a74051208f5a927ac3c88771af23a9d174935
parent2e10c658f42a842404f16a1b03ff4844e41d538c (diff)
parente20a0798dc6ca38eb4a06dda7948bd1c306d0693 (diff)
Merge branch 'master' into blender2.8
-rw-r--r--intern/cycles/device/device_opencl.cpp43
-rw-r--r--intern/cycles/device/opencl/opencl_util.cpp15
-rw-r--r--intern/cycles/util/util_string.cpp5
-rw-r--r--intern/cycles/util/util_string.h2
4 files changed, 47 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);
}
}
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)";
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