metal: workaround for transfers sync issue (#11622)

* metal: workaround for transfers sync issue

* metal tracsfer sync is broken

* hm

* rm it?

* keep it
This commit is contained in:
nimlgen
2025-08-12 16:16:34 +03:00
committed by GitHub
parent efe8b5611d
commit 8a7be0a747
+3
View File
@@ -221,6 +221,9 @@ class MetalAllocator(LRUAllocator[MetalDevice]):
msg("setLabel:")(src_command_buffer, to_ns_str(f"COPY {src_dev.device} -> {dest_dev.device}"))
msg("commit")(src_command_buffer)
src_dev.mtl_buffers_in_flight.append(src_command_buffer)
# Transfers currently synchronize the completion. Otherwise, copies can sometimes lead to incorrect values.
# There is no real metal multidevice support for now, so transfer is used only for tests.
src_dev.synchronize()
def _cp_mv(self, dst, src, prof_desc):
with cpu_profile(prof_desc, self.dev.device, is_copy=True): dst[:] = src
def _as_buffer(self, src:MetalBuffer) -> memoryview: