Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/device/hip/device_impl.cpp
| Context not available. | |||||
| /* Attempt to use kernel provided with Blender. */ | /* Attempt to use kernel provided with Blender. */ | ||||
| if (!use_adaptive_compilation()) { | if (!use_adaptive_compilation()) { | ||||
| if (!force_ptx) { | if (!force_ptx) { | ||||
| const string fatbin = path_get(string_printf("lib/%s_%s.fatbin", name, props.gcnArchName)); | /* 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; | |||||
| const string fatbin = path_get(string_printf("lib/%s_%s.fatbin", name, arch)); | |||||
| VLOG(1) << "Testing for pre-compiled kernel " << fatbin << "."; | VLOG(1) << "Testing for pre-compiled kernel " << fatbin << "."; | ||||
| if (path_exists(fatbin)) { | if (path_exists(fatbin)) { | ||||
| VLOG(1) << "Using precompiled kernel."; | VLOG(1) << "Using precompiled kernel."; | ||||
| return fatbin; | 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. */ | /* Try to use locally compiled kernel. */ | ||||
| Context not available. | |||||