mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-06-24 02:14:17 +00:00
skip bounds check when NOOPs exist
This commit is contained in:
parent
db3ed92ae3
commit
6f977100ff
1 changed files with 3 additions and 2 deletions
|
|
@ -14,10 +14,11 @@ def validate_index(buf:UOp, idx:UOp, gate:UOp|None=None):
|
|||
if 0<=idx.vmin and idx.vmax<sz: return True
|
||||
|
||||
# TODO: validate these
|
||||
# WEBGPU has a BITCAST in the index, PTX casts pointer to long
|
||||
# WEBGPU has a BITCAST in the index, PTX casts pointer to long, X86 turns certain casts into NOOPs
|
||||
# VECTORIZE/GEP can't be properly modeled in z3 since it doesn't support vectors
|
||||
for x in idx.toposort() | gate.toposort():
|
||||
if x.op in {Ops.BITCAST, Ops.VECTORIZE, Ops.GEP} or (x.op is Ops.CAST and isinstance(x.src[0].dtype, PtrDType)): return True
|
||||
if x.op in {Ops.BITCAST, Ops.VECTORIZE, Ops.GEP} or (x.op is Ops.CAST and isinstance(x.src[0].dtype, PtrDType)) \
|
||||
or x.op is Ops.NOOP: return True
|
||||
|
||||
# if all is good and CHECK_OOB=1, validate with z3
|
||||
from tinygrad.uop.validate import validate_index_with_z3
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue