mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-02-16 09:37:11 -05:00
@@ -362,6 +362,8 @@ class AMDAllocator(HCQAllocator):
|
||||
|
||||
def _free(self, opaque, options:BufferOptions): self.device._gpu_free(opaque)
|
||||
|
||||
def map(self, buf:HCQBuffer): self.device._gpu_map(buf._base if hasattr(buf, '_base') else buf)
|
||||
|
||||
MAP_FIXED, MAP_NORESERVE = 0x10, 0x400
|
||||
|
||||
@dataclass
|
||||
@@ -380,7 +382,6 @@ class AMDDevice(HCQCompiled):
|
||||
gpus:List[pathlib.Path] = []
|
||||
|
||||
def _gpu_map(self, mem):
|
||||
mem = mem._base if hasattr(mem, '_base') else mem
|
||||
if self.gpu_id in getattr(mem, "mapped_gpu_ids", []): return
|
||||
mem.__setattr__("mapped_gpu_ids", getattr(mem, "mapped_gpu_ids", []) + [self.gpu_id])
|
||||
c_gpus = (ctypes.c_int32 * len(mem.mapped_gpu_ids))(*mem.mapped_gpu_ids)
|
||||
|
||||
Reference in New Issue
Block a user