[Bf-blender-cvs] [040630bb9a6] blender-v3.0-release: Fix wrong device check in HIP kernel compile.

Thomas Dinges noreply at git.blender.org
Wed Nov 10 22:26:59 CET 2021


Commit: 040630bb9a634988f45fd9f8e480f39c195ec57b
Author: Thomas Dinges
Date:   Wed Nov 10 22:24:53 2021 +0100
Branches: blender-v3.0-release
https://developer.blender.org/rB040630bb9a634988f45fd9f8e480f39c195ec57b

Fix wrong device check in HIP kernel compile.

Also cleanup some related code, that was falsely copied from CUDA.

Differential Revision: https://developer.blender.org/D13180

===================================================================

M	intern/cycles/device/hip/device_impl.cpp
M	intern/cycles/device/hip/device_impl.h

===================================================================

diff --git a/intern/cycles/device/hip/device_impl.cpp b/intern/cycles/device/hip/device_impl.cpp
index bb0573abf8d..d7f68934b46 100644
--- a/intern/cycles/device/hip/device_impl.cpp
+++ b/intern/cycles/device/hip/device_impl.cpp
@@ -222,7 +222,6 @@ string HIPDevice::compile_kernel_get_common_cflags(const uint kernel_features)
   const string include_path = source_path;
   string cflags = string_printf(
       "-m%d "
-      "--ptxas-options=\"-v\" "
       "--use_fast_math "
       "-DHIPCC "
       "-I\"%s\"",
@@ -236,8 +235,7 @@ string HIPDevice::compile_kernel_get_common_cflags(const uint kernel_features)
 
 string HIPDevice::compile_kernel(const uint kernel_features,
                                  const char *name,
-                                 const char *base,
-                                 bool force_ptx)
+                                 const char *base)
 {
   /* Compute kernel name. */
   int major, minor;
@@ -255,13 +253,11 @@ string HIPDevice::compile_kernel(const uint kernel_features,
 
   /* 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, arch));
-      VLOG(1) << "Testing for pre-compiled kernel " << fatbin << ".";
-      if (path_exists(fatbin)) {
-        VLOG(1) << "Using precompiled kernel.";
-        return fatbin;
-      }
+    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;
     }
   }
 
@@ -298,9 +294,9 @@ string HIPDevice::compile_kernel(const uint kernel_features,
 
 #  ifdef _WIN32
   if (!use_adaptive_compilation() && have_precompiled_kernels()) {
-    if (major < 3) {
+    if (!hipSupportsDevice(hipDevId)) {
       set_error(
-          string_printf("HIP backend requires compute capability 3.0 or up, but found %d.%d. "
+          string_printf("HIP backend requires compute capability 10.1 or up, but found %d.%d. "
                         "Your GPU is not supported.",
                         major,
                         minor));
diff --git a/intern/cycles/device/hip/device_impl.h b/intern/cycles/device/hip/device_impl.h
index 8d81291d15e..eb832ad828c 100644
--- a/intern/cycles/device/hip/device_impl.h
+++ b/intern/cycles/device/hip/device_impl.h
@@ -95,8 +95,7 @@ class HIPDevice : public Device {
 
   string compile_kernel(const uint kernel_features,
                         const char *name,
-                        const char *base = "hip",
-                        bool force_ptx = false);
+                        const char *base = "hip");
 
   virtual bool load_kernels(const uint kernel_features) override;
   void reserve_local_memory(const uint kernel_features);



More information about the Bf-blender-cvs mailing list