MCPcopy
hub / github.com/tinygrad/tinygrad / disk_copy_is_buffer

Function disk_copy_is_buffer

tinygrad/callify.py:18–24  ·  view source on GitHub ↗
(ctx:AllocCtx, u:UOp)

Source from the content-addressed store, hash-verified

16 return x.replace(tag=(len(ctx.uop_list)-1,))
17
18def disk_copy_is_buffer(ctx:AllocCtx, u:UOp):
19 # copies to disk are replaced with the disk buffer
20 to_disk = isinstance(u.device, str) and u.device.startswith(("DISK", "TINYFS"))
21 if to_disk: ctx.buffer_map[u] = u.empty_like()
22 # all copies from disk/numpy are realized into a real buffer
23 from_creation = isinstance(u.src[0].device, str) and any(u.src[0].device.startswith(x) for x in ["NPY", "DISK", "PYTHON", "TINYFS"])
24 if from_creation: return tag_uop(ctx, u)
25
26def apply_after(ctx:AllocCtx, u:UOp):
27 base = u.src[0]

Callers

nothing calls this directly

Calls 2

tag_uopFunction · 0.85
empty_likeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…