Skip to content

Commit 933d59e

Browse files
authored
GPU Metal: relink the backend library when the kernels change (#16076)
1 parent d99b72f commit 933d59e

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎GPU/GPUTracking/Base/metal/CMakeLists.txt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ if(METAL_ENABLED) # BUILD Metal source code for runtime compilation target
103103
target_link_options(${targetName}
104104
PRIVATE
105105
"-Wl,-sectcreate,__DATA,__gpu_resource,${METAL_BIN}.ir")
106+
# The linker reads the IR, so relink when it changes: otherwise a change to the
107+
# kernels alone leaves the old code in the library.
108+
set_property(TARGET ${targetName} APPEND PROPERTY LINK_DEPENDS ${METAL_BIN}.ir)
106109
add_dependencies(${targetName} metal_preprocessed_code)
107110
add_dependencies(${targetName} metal_intermediate_representation)
108111
endif()

0 commit comments

Comments
 (0)