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:
authorBrian Savery <bsavery>2021-11-04 22:16:26 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-11-04 22:24:39 +0300
commit36f5198282d3e91b11d9db488705a852377edd31 (patch)
treebb1319ba9bd8e0a75556511a6f523de8a3e88522 /intern/cycles/device/hip
parent5c34e34195e2ec46c4a4e17fd2ddea784f69d628 (diff)
Fix Cycles HIP Kernels loading on Arch names with extra options
The kernel file names are search for based on the arch name, for example gfx1010. However HIP's gcnArchName can contain options such as xnack- in the name. For example gfx1010:sramecc-:xnack-. This revision tokenizes the info from gcnArchName and just uses the first token for choosing the Kernel file to use. Kernels are portable across those features in the arch name. Also remove the bit for recompiling ptx as clearly that is not relevant. Differential Revision: https://developer.blender.org/D13117
Diffstat (limited to 'intern/cycles/device/hip')
-rw-r--r--intern/cycles/device/hip/device_impl.cpp35
1 files changed, 10 insertions, 25 deletions
diff --git a/intern/cycles/device/hip/device_impl.cpp b/intern/cycles/device/hip/device_impl.cpp
index 1ea387513d5..a71fc4b888b 100644
--- a/intern/cycles/device/hip/device_impl.cpp
+++ b/intern/cycles/device/hip/device_impl.cpp
@@ -240,36 +240,23 @@ string HIPDevice::compile_kernel(const uint kernel_features,
hipDeviceProp_t props;
hipGetDeviceProperties(&props, hipDevId);
+ /* gcnArchName can contain tokens after the arch name with features, ie.
+ "gfx1010:sramecc-:xnack-" so we tokenize it to get ther first part. */
+ char *arch = strtok(props.gcnArchName, ":");
+ if (arch == NULL) {
+ arch = props.gcnArchName;
+ }
+
/* Attempt to use kernel provided with Blender. */
if (!use_adaptive_compilation()) {
if (!force_ptx) {
- const string fatbin = path_get(string_printf("lib/%s_%s.fatbin", name, props.gcnArchName));
+ const string fatbin = path_get(string_printf("lib/%s_%s.fatbin", name, arch));
VLOG(1) << "Testing for pre-compiled kernel " << fatbin << ".";
if (path_exists(fatbin)) {
VLOG(1) << "Using precompiled kernel.";
return fatbin;
}
}
-
- /* The driver can JIT-compile PTX generated for older generations, so find the closest one. */
- int ptx_major = major, ptx_minor = minor;
- while (ptx_major >= 3) {
- const string ptx = path_get(
- string_printf("lib/%s_compute_%d%d.ptx", name, ptx_major, ptx_minor));
- VLOG(1) << "Testing for pre-compiled kernel " << ptx << ".";
- if (path_exists(ptx)) {
- VLOG(1) << "Using precompiled kernel.";
- return ptx;
- }
-
- if (ptx_minor > 0) {
- ptx_minor--;
- }
- else {
- ptx_major--;
- ptx_minor = 9;
- }
- }
}
/* Try to use locally compiled kernel. */
@@ -292,12 +279,10 @@ string HIPDevice::compile_kernel(const uint kernel_features,
# ifdef _DEBUG
options.append(" -save-temps");
# endif
- options.append(" --amdgpu-target=").append(props.gcnArchName);
+ options.append(" --amdgpu-target=").append(arch);
const string include_path = source_path;
- const char *const kernel_arch = props.gcnArchName;
- const string fatbin_file = string_printf(
- "cycles_%s_%s_%s", name, kernel_arch, kernel_md5.c_str());
+ const string fatbin_file = string_printf("cycles_%s_%s_%s", name, arch, kernel_md5.c_str());
const string fatbin = path_cache_get(path_join("kernels", fatbin_file));
VLOG(1) << "Testing for locally compiled kernel " << fatbin << ".";
if (path_exists(fatbin)) {