MCPcopy Index your code
hub / github.com/tinygrad/tinygrad / lock_memory

Method lock_memory

tinygrad/runtime/support/system.py:48–49  ·  view source on GitHub ↗
(self, addr:int, size:int)

Source from the content-addressed store, hash-verified

46 def memory_barrier(self): lib.atomic_thread_fence(__ATOMIC_SEQ_CST:=5) if (lib:=self.libsys if OSX else self.atomic_lib) is not None else None
47
48 def lock_memory(self, addr:int, size:int):
49 if libc.mlock(ctypes.c_void_p(addr), size): raise RuntimeError(f"Failed to lock memory at {addr:#x} with size {size:#x}")
50
51 def system_paddrs(self, vaddr:int, size:int) -> list[int]:
52 self.pagemap.seek(vaddr // mmap.PAGESIZE * 8)

Callers 1

mapMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected