Automatic creation of Scratch Buffer at MSCCLLang (#510)

This commit is contained in:
Caio Rocha
2025-04-23 16:37:14 -07:00
committed by GitHub
parent 474ef0b696
commit 7a25e51b07

View File

@@ -431,6 +431,12 @@ class Ref(ChunkRef):
def chunk(rank, buffer, index, size=1) -> Ref:
if buffer is Buffer.scratch:
if buffer not in _curr().buffers[rank]:
_curr().buffers[rank][buffer] = BufferSlice(Buffer.scratch, buffer)
if index >= len(_curr().buffers[rank][buffer]):
_curr().buffers[rank][buffer][index] = ChunkRef(rank, buffer, index, size)
if _curr().buffers[rank][buffer][index] is None:
return None
return _curr().get_ref(rank, buffer, index, size)