MCPcopy
hub / github.com/tinygrad/tinygrad / system_paddrs

Method system_paddrs

tinygrad/runtime/support/system.py:51–53  ·  view source on GitHub ↗
(self, vaddr:int, size:int)

Source from the content-addressed store, hash-verified

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)
53 return [(x & ((1<<55) - 1)) * mmap.PAGESIZE for x in array.array('Q', self.pagemap.read(size//mmap.PAGESIZE*8, binary=True))]
54
55 def pci_scan_bus(self, vendor:int, devices:tuple[tuple[int, tuple[int, ...]], ...], base_class:int|None=None) -> list[str]:
56 all_devs = []

Callers 2

alloc_sysmemMethod · 0.80
mapMethod · 0.80

Calls 2

seekMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected