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

Method ptr

tinygrad/dtype.py:80–81  ·  view source on GitHub ↗
(self, size=-1, addrspace=AddrSpace.GLOBAL)

Source from the content-addressed store, hash-verified

78 if sz == 1 or self == dtypes.void: return self # void doesn't vectorize, and sz=1 is scalar
79 return DType(self.priority, self.bitsize*sz, f"{INVERSE_DTYPES_DICT[self.name]}{sz}", None, sz, self)
80 def ptr(self, size=-1, addrspace=AddrSpace.GLOBAL) -> PtrDType:
81 return PtrDType(self.priority, self.bitsize, self.name, self.fmt, self.count, None, self, addrspace, 1, size)
82 def scalar(self) -> DType: return self._scalar if self._scalar is not None else self
83 def nbytes(self) -> int: raise RuntimeError("only ptr types have nbytes")
84 @functools.cached_property

Callers 15

render_wmma_amxFunction · 0.45
_render_kernelMethod · 0.45
gated_loadFunction · 0.45
gated_storeFunction · 0.45
x86.pyFile · 0.45
placeholderMethod · 0.45
decompositions.pyFile · 0.45
dcache_flushFunction · 0.45
fold_expanded_indexFunction · 0.45
split_load_storeFunction · 0.45
image_fixupFunction · 0.45
no_vectorized_bufFunction · 0.45

Calls 1

PtrDTypeClass · 0.85

Tested by 15

test_global_prod_maxMethod · 0.36
test_where_castMethod · 0.36
test_vec_doubleMethod · 0.36
test_scalarMethod · 0.36
test_serializeMethod · 0.36
test_vec_ptr_szMethod · 0.36
test_vcountMethod · 0.36
test_ptr_eqMethod · 0.36
test_ptr_nbytesMethod · 0.36