mm: reset_cast_buffers: sync compute stream before free (#12822)

Sync the compute stream before freeing the cast buffers. This can cause
use after free issues when the cast stream frees the buffer while the
compute stream is behind enough to still needs a casted weight.
This commit is contained in:
rattus 2026-03-07 09:38:08 -08:00 committed by GitHub
parent 6ac8152fc8
commit bcf1a1fab1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1148,6 +1148,7 @@ def reset_cast_buffers():
LARGEST_CASTED_WEIGHT = (None, 0)
for offload_stream in STREAM_CAST_BUFFERS:
offload_stream.synchronize()
synchronize()
STREAM_CAST_BUFFERS.clear()
soft_empty_cache()