cache is_int [run_process_replay] (#6131)

* cache is_int [run_process_replay]

* functools.cached_property is pretty slow
This commit is contained in:
George Hotz
2024-08-17 00:19:03 -07:00
committed by GitHub
parent 3a2d724cb2
commit 4df4845b47
3 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -286,7 +286,7 @@ constant_folder = PatternMatcher([
(NOp.var('x') * 0, lambda x: x.const(float('nan') if isinstance(x.arg, float) and (math.isnan(x.arg) or math.isinf(x.arg)) else 0)),
# x-x -> 0
(NOp.var('x') - NOp.var('x'), lambda x: x.const(0)),
# min==max -> CONST
# min==max -> CONST (slow!)
(UPat({UOps.ALU, UOps.DEFINE_VAR}, name='x'), lambda x: x.const(x.vmin.arg) if x.vmin.arg == x.vmax.arg else None),
# ** load/store folding **
(NOp.store(NOp.var("buf"), NOp.var("idx"), NOp.load(NOp.var("buf"), NOp.var("idx"))), lambda buf,idx:UOp(UOps.NOOP)),