Commit graph

25 commits

Author SHA1 Message Date
chenyu
e18922f111
limit AND const min max to ints [pr] (#12918) 2025-10-25 16:07:52 -04:00
Sieds Lykles
1f3950a484
Invalid idx (#12067)
* merge index_dtype_3

* new lowering with Invalid idx

* remove that dtype from range

* finish merge

* annotate better

* indentation

* dont need that anymore

* always process replay for openpilot

* more uop_given_valid for idx

* valid past index_child

* fix bug preventing load getting an alt value

* add track_match_stats back in in shapetracker and remove cache

* get_valid_idx -> get_valid and get_idx

* fix heuristics with new idx

* split line

* fix typo

* fix signature

* dont skip idx if stride is 0

the idx may still be invalid

* lower const with new valid

* delete to_indexed_uops

* update shapetracker test

* delete axis_is_masked

* add cache back

* move around comment

* fix get_valid bug

* move invalid fold to symbolic so its earlier

* cleanup

* update applying padto to new idx

* add unit tests

* cleanup

* fold line

* improve spec

* dont try to render Invalid as a float

* more consistent invalid index

* update some tests

* Fold index with true cond

* skip test

* vconst min max if Invalid in arg

* fix signature of UOp.const

* add test for min/max of Invalid CONST/VCONST

* add InvalidType to as_const signature

* is Invalid to isinstance

* Add InvalidType to ConstLike

* index gate is a where gate

* make that a metaclass

* fix heurisics for new idx

* mypy happy
2025-09-12 01:42:02 +02:00
Sieds Lykles
572a3c15c6
Move Ops.SPECIAL arg to src (#11918)
* initial moving bound to src

* arg to src

* remove import

* fixup linearizer

* arg to src

* fix test_uop_graph

* fix more tests

* fix python renderer

* get const value from const uop

* ssimplify uop estimates

* fix webgpu locals

* fix old test

* gate Ops.SPECIAL in linearizer

* use ssimplify() for local/global_size

* remove toposort gate_parents_instead_of_self

* fix rendering in comment

* cleanup

* rename and add comments

* add BottomUpGate with test
2025-09-04 09:31:44 +02:00
Sieds Lykles
53eff8970a
add Ops.GEP to _min_max (#11976) 2025-09-03 07:07:54 +02:00
Sieds Lykles
d3252ccd85
fix special vmax when arg is UOp (#11930) 2025-08-31 06:54:39 +02:00
chenyu
7db07e5f2c
don't narrow range of CAST on bool/unsigned (#11156) 2025-07-09 22:20:09 -04:00
George Hotz
411392dfb7
move files into uop dir (#10399)
* move files into uop dir [pr]

* tinygrad.uop is a thing

* fix uop docs, no pr

* fix viz
2025-05-18 11:38:28 -07:00
chenyu
cba508c8c3
update uop symbolic tests (#10228)
clean up TODOs and update tests
2025-05-09 01:55:53 -04:00
chenyu
56def6c319
better bound for mod negative number (#10227) 2025-05-09 01:19:47 -04:00
chenyu
99f6d89dfb
tighter idiv bound for symbolic denominator (#10226) 2025-05-08 22:38:56 -04:00
chenyu
c672716b38
improve vmin/vmax for IDIV (#9678) 2025-04-01 23:16:01 -04:00
George Hotz
3c5161b4cb
add validation of the bounds of Ops.INDEX (#9503)
* add validation of the bounds of Ops.INDEX

* do mask properly

* more validation

* correct

* fix gated

* add CAST support to vmin/vmax

* fix ptx and image

* ptx no diff

* upat.index also stays

---------

Co-authored-by: qazal <qazal.software@gmail.com>
2025-03-20 12:15:55 +08:00
chenyu
e5c85ec684
type annotation of resolve [pr] (#8467)
it takes UOp|bool
2025-01-01 10:21:59 -05:00
chenyu
f3fdec940d
Tensor.mod (#8458)
it's a python style mod. possibily can be cleaner with a floor div

relaxed the vmin for MOD slightly for cstyle negatives mod, it's more correct and might fix other bugs
2024-12-31 11:31:42 -05:00
George Hotz
52243b258c
move flops_mem to renderer [pr] (#8320) 2024-12-18 12:13:17 -08:00
ttomsa
e22d7b6fb0
fix var vmax inside special (#8116) 2024-12-09 01:16:08 -05:00
chenyu
0c060fa040
update uop and tests to not use lt/gt/le/ge [pr] (#8023)
just use dunder methods, eventually remove those from ops
2024-12-03 21:02:52 -05:00
George Hotz
c8bf09b7d4
s/UOps/Ops (#7500)
* s/UOps/Ops [pr]

* fix
2024-11-03 11:26:10 +08:00
George Hotz
b647fa7514
rename MathTraits to maximum [pr] (#7356) 2024-10-29 16:43:04 +08:00
chenyu
c398f2467c
test uop mul min/max do not have nan in 0*inf (#7340) 2024-10-28 17:52:01 -04:00
Sieds Lykles
75dcd98e79
Fix calculation of vmin and vmax in multiplication when one src is negative and the other src has negative min and positive max (#7333)
Co-authored-by: chenyu <chenyu@fastmail.com>
2024-10-28 16:01:46 -04:00
George Hotz
85a45164fb
remove pyint [pr] (#7016)
* remove pyint

* bump time on tp [pr]

* dont truncate in const fold

* remove dead code

* Revert "dont truncate in const fold"

This reverts commit 29c81db0f7.

* remove define_var
2024-10-12 22:36:24 +08:00
George Hotz
100ce7a684 hotfix: min/max on CMPNE was wrong 2024-10-02 10:15:03 +08:00
chenyu
7f9fd556b0
_min_max for WHERE (#6564)
prereq to gated load simplification

just for int
2024-09-18 23:47:48 -04:00
George Hotz
07bd6e070d
add more uops tests for vmin/vmax/const_factor/divides (#6533) 2024-09-16 13:06:31 +08:00