hcq move map to allocator (#5610)

* hcq move map to allocator

* fix
This commit is contained in:
nimlgen
2024-07-20 19:02:45 +03:00
committed by GitHub
parent ac99ecd94e
commit 0de5812032
4 changed files with 9 additions and 5 deletions

View File

@@ -339,6 +339,8 @@ class NVAllocator(HCQAllocator):
if options.host: self.device._gpu_host_free(opaque)
else: self.device._gpu_free(opaque)
def map(self, buf:HCQBuffer): self.device._gpu_map(buf._base if hasattr(buf, '_base') else buf)
@dataclass
class GPFifo:
ring: memoryview
@@ -437,7 +439,6 @@ class NVDevice(HCQCompiled):
gpuAttributesCount=1, perGpuAttributes=gpu_attrs, va_addr=va_base, size=size, mapped_gpu_ids=[self.gpu_uuid])
def _gpu_map(self, mem):
mem = mem._base if hasattr(mem, '_base') else mem
if self.gpu_uuid in mem.mapped_gpu_ids: return
mem.mapped_gpu_ids.append(self.gpu_uuid)
self._gpu_uvm_map(mem.va_addr, mem.size, mem.hMemory, create_range=False)