summaryrefslogtreecommitdiff
path: root/pkgs/development/rocm-modules/composable_kernel/fix-empty-offload-targets.diff
blob: d314873ff61b69b460f61bbcdd3f266e6b85583a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
diff --git a/library/src/tensor_operation_instance/gpu/CMakeLists.txt b/library/src/tensor_operation_instance/gpu/CMakeLists.txt
index 172f6681b8..d3ddbb2f15 100644
--- a/library/src/tensor_operation_instance/gpu/CMakeLists.txt
+++ b/library/src/tensor_operation_instance/gpu/CMakeLists.txt
@@ -154,9 +154,15 @@ function(add_instance_library INSTANCE_NAME)
                 list(FILTER INST_TARGETS INCLUDE REGEX "gfx12")
             endif()
             set(offload_targets)
-            foreach(target IN LISTS INST_TARGETS)
-                string(APPEND offload_targets "--offload-arch=${target} ")
-            endforeach()
+            if(NOT INST_TARGETS)
+                # No valid GPU targets for this source, compile for 90a as fallback
+                # so the add_device…instances and hip_fatbin… symbols still exist
+                set(offload_targets "--offload-arch=gfx90a")
+            else()
+                foreach(target IN LISTS INST_TARGETS)
+                    string(APPEND offload_targets "--offload-arch=${target} ")
+                endforeach()
+            endif()
             set_source_files_properties(${source} PROPERTIES COMPILE_FLAGS ${offload_targets})
             list(APPEND INST_OBJ ${source})
         endforeach()