diff options
Diffstat (limited to 'intern/cycles/device/hip/device_impl.cpp')
-rw-r--r-- | intern/cycles/device/hip/device_impl.cpp | 35 |
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)) { |