MCPcopy
hub / github.com/tinygrad/tinygrad / alloc

Method alloc

tinygrad/runtime/ops_amd.py:931–938  ·  view source on GitHub ↗
(self, size:int, host=False, uncached=False, cpu_access=False, contiguous=False, force_devmem=False, **kwargs)

Source from the content-addressed store, hash-verified

929 return HCQBuffer(vaddr, size, meta=PCIAllocationMeta(region, has_cpu_mapping=False), view=self.pci_dev.dma_view(ctrl_addr, size), owner=self.dev)
930
931 def alloc(self, size:int, host=False, uncached=False, cpu_access=False, contiguous=False, force_devmem=False, **kwargs) -> HCQBuffer:
932 # custom usb allocates uncached and cpu_access in vram. vram writes are faster than sram writes
933 if (host or (not self.pci_dev.usb.usb.is_custom and uncached and cpu_access)) and self.sys_next_off + size < self.sys_buf.size:
934 self.sys_next_off += size
935 return self.sys_buf.offset(self.sys_next_off - size, size)
936
937 # force devmem
938 return super().alloc(size, host=False, uncached=uncached, cpu_access=cpu_access, contiguous=contiguous, force_devmem=True, **kwargs)
939
940 def create_queue(self, queue_type, ring, gart, rptr, wptr, eop_buffer=None, cwsr_buffer=None, ctl_stack_size=0, ctx_save_restore_size=0,
941 xcc_id=0, idx=0):

Callers

nothing calls this directly

Calls 2

offsetMethod · 0.45
allocMethod · 0.45

Tested by

no test coverage detected