Commit Graph

387 Commits

Author SHA1 Message Date
George Hotz ded1b38b84
minor dtype cleanup [pr] (#7124)
* minor dtype cleanup [pr]

* use ptr() function
2024-10-17 17:41:23 +08:00
George Hotz d990a16326
fix tests to use render (#7116) 2024-10-17 14:35:22 +08:00
chenyu 842fe444df
test case for valid only simplification (#7108) 2024-10-16 16:40:46 -04:00
Francis Lata 90eff347e2
tinytqdm write support (#6359)
* add write support

* add test

* update test case to compare write outputs

* assert final write output

* flush when using write

* update write logic

* Revert "update write logic"

This reverts commit 5e0e611b46cde7a22e41aa5770bc4ccad20de073.

---------

Co-authored-by: chenyu <chenyu@fastmail.com>
2024-10-16 14:51:41 -04:00
chenyu 2008bac6bf
use validhack logic to rewrite buffer idx (#6740)
* use validhack logic to rewrite buffer idx

saved a whopping one mod in the conv backward kernel...

* cleanup more
2024-10-14 16:47:31 -04:00
chenyu a99e42cf2f
clean up test_uop_symbolic.py (#7058)
enable more tests and remove dead tests
2024-10-14 15:35:58 -04:00
chenyu bd8ecf7fd6
remove NumNode (#7035) 2024-10-13 16:42:19 -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 29c81db0f7880848b001c2728aa555a1ef17e7d3.

* remove define_var
2024-10-12 22:36:24 +08:00
George Hotz a71bb09ec3
remove symbolic file [pr] (#7012) 2024-10-12 18:44:44 +08:00
George Hotz 5ae2de9845
UOp.variable (#7010)
* UOp.variable [pr]

* fix tests

* clean

* improve name rendering

* last bug
2024-10-12 18:20:44 +08:00
George Hotz e7a0ffe46a
break out linearization [pr] (#6994) 2024-10-11 15:27:33 +08:00
chenyu e3dc10f8f6
improve fold_unrolled_divs (#6977)
addressed #6935
the first few terms in fold_unrolled_divs might have been folded already, so the check should first try to add those terms back. there is a case that every but one term is folded which is not an add chain anymore, so just added as a failed test case for now
2024-10-10 10:52:05 -04:00
chenyu 08414d7b7c
cleanup test_uop_symbolic.py (#6894)
no more test_symbolic for reference, so force expected output to be exact instead of a set
2024-10-04 20:53:10 -04:00
ignaciosica 555bcb5e54
static access for code_for_op (#6889) 2024-10-05 07:38:01 +08:00
George Hotz a0cb16ac61
node cleanup + local metal test speed [pr] (#6880)
* node cleanup [pr]

* fix tests, including the double one on metal

* no time tqdm tests
2024-10-04 18:14:23 +08:00
George Hotz cdff1d75b6
things that are only used in one place don't belong in helpers [pr] (#6878)
* things that are only used in one place don't belong in helpers [pr]

* pretty print moved
2024-10-04 17:27:38 +08:00
George Hotz f4ec39fe58
switch symbolic from old to uops, final PR (#6872)
* switch symbolic from old to uops, final PR

* two wrong answers

* not needed resolves

* symbolic ops passes

* symbolic ops passes

* progress

* tests pass (almost)

* fix last test

* fix some tests

* global binding and unbinding

* Revert "global binding and unbinding"

This reverts commit 9456725630316487509980af20c6d2981de00bec.

* that test works now

* vars on uop doesn't recurse

* fix fuzzer

* update

* fix type

* fix gpt, it's UOp now

* ssimplify symbolics
2024-10-04 16:42:27 +08:00
George Hotz 738a5794a9
last update for new symbolic [pr] (#6877) 2024-10-04 14:58:51 +08:00
George Hotz e10245909a
explore global uop cache [pr] (#6863)
* explore global uop cache

* wvd uops

* remove useless lru caches

* key is is

* simpler rewriter
2024-10-03 13:08:13 +08:00
chenyu c3c93f332a
symbolic bool raise ValueError when not sure [pr] (#6853) 2024-10-02 09:10:58 -04:00
George Hotz 7214450c23
little symbolic changes [pr] (#6849)
* little symbolic changes [pr]

* symbolic needs resolve too

* no resolve

* less change
2024-10-02 17:12:30 +08:00
George Hotz be12409b51
changes for symbolic (#6844)
* changes for symbolic

* only for ints

* check int first
2024-10-02 12:57:16 +08:00
George Hotz 100ce7a684 hotfix: min/max on CMPNE was wrong 2024-10-02 10:15:03 +08:00
George Hotz 1ac83aaa4b
lil sym changes (#6837)
* lil sym changes [pr]

* fix inf crap

* Update ops.py

* remove that, it's wrong
2024-10-02 09:54:17 +08:00
George Hotz 84726e8855
good changes from symbolic removal [run_process_replay] (#6835)
* good changes from symbolic removal [run_process_replay]

* fix __ne__
2024-10-01 18:49:09 +08:00
George Hotz e907b25792
move some pm rules to uopgraph.py [run_process_replay] (#6831)
* move some pm rules to uopgraph.py [run_process_replay]

* move more

* move lt and clean

* end maybe

* put back
2024-10-01 18:28:41 +08:00
George Hotz 8a93c48901
pickle main pattern matcher [run_process_replay] (#6827)
* pickle main pattern matcher [run_process_replay]

* del line
2024-10-01 13:58:42 +08:00
George Hotz d726eb6f48
uop resolve [run_process_replay] (#6826)
* uop bool and int and stuff [run_process_replay]

* add ne support

* can't even be None anymore

* BinaryOps.AND support

* less compare
2024-10-01 13:11:42 +08:00
George Hotz 0f28e93224
add pickle support for pattern matchers [run_process_replay] (#6816)
* add pickle support for pattern matchers [run_process_replay]

* cleaner and all

* no closures

* fix tests

* revert that

* final

* cleaner

* python 3.8 fix

* add round trip back

* this

* waste lines on this. that's the final line count

* max print better

* more targetted fix

* regrettably add 3.8 support
2024-09-30 21:54:46 +08:00
George Hotz eaa1e0eeeb
rename constant_folder to sym [run_process_replay] (#6780) 2024-09-27 14:54:54 +08:00
wozeparrot 2b899164c6
no numpy (#6751) 2024-09-26 16:40:18 +08:00
George Hotz 882339f729
remove parens from neg (#6738) 2024-09-25 15:38:20 +08:00
chenyu ff25bfb1b0
conv backward tests in test_simplify_valid_idx (#6727)
the backward idx is pretty ugly now
2024-09-25 02:51:07 -04:00
chenyu e6a1b5aa8f
more test_simplify_valid_idx cleanup (#6726)
moved UOps.VECTORIZE of idx into the helper
2024-09-24 23:47:42 -04:00
chenyu 14524eeddc
test_image_valid.py -> test_simplify_valid_idx.py (#6724)
restructure the tests, will use the same file for non-image tests
2024-09-24 23:32:27 -04:00
chenyu 8d75326cb5
do not fold var with min==max (#6713)
not really used, want it to keep as a var for valid simplification
[run_process_replay]
2024-09-24 06:16:34 -04:00
chenyu 9e51879019
fix idx setup in image_valid test_openpilot_conv3 (#6710)
* fix idx setup in image_valid test_openpilot_conv3

* corrected output and sad
2024-09-24 05:49:04 -04:00
chenyu 4bb1694f49
more tests about bounds of UOp divs (#6700) 2024-09-24 00:41:43 -04:00
chenyu 79aef64d70
update tests in test_image_valid (#6698) 2024-09-24 00:04:21 -04:00
chenyu f55459c98e
failed validhack test for a 0.9.7 conv (#6677) 2024-09-23 04:43:47 -04:00
chenyu 0362dbbbe8
relax idx simplification given valid (#6669)
apply to kernels in op 0.9.7.
if a valid has a complicated expr, we cannot drop valid but it's possible to simplify idx given valid
2024-09-23 03:04:57 -04:00
chenyu 26ebb7cab4
don't use div_folding in lt_folding (#6666)
* don't use div_folding in lt_folding

valids 35 -> 13

* fails the same as before
2024-09-23 01:50:18 -04:00
chenyu da5b741656
removed valid in openpilot conv (#6619)
35 valids left
2024-09-23 00:30:18 -04:00
George Hotz 52c2c4df9c
fix match of sz 0 + dedup kernel ast [run_process_replay] (#6663)
* fix match of sz 0 [run_process_replay]

* empty graph rewrite to dedup st
2024-09-23 11:56:53 +08:00
chenyu 1923932339
canonicalize simplex lt (#6658)
(X := a0*x0 + a1*x1 + ...) > 0 is equivalent to x0 + x1 + ... > 0 if xi >= 0 and ai > 0 for ints
2024-09-22 23:04:47 -04:00
chenyu 90c1ccc402
simpler drop valid check in simplify_valid_image_load (#6653)
* simpler drop valid check in simplify_valid_image_load

* update tests
2024-09-22 21:46:39 -04:00
qazal 982086f54c
UOps.VALID try 2 (#6623)
* make UOps.VALID compile

* fixable tests

* bufs dedup

* cleanup the CONST spec

* regenerate dataset with graph_rewrite

```py
def rewrite_const(const:UOp, st_src:UOp) -> UOp:
  st: ShapeTracker = st_src.arg
  return UOp(UOps.VALID, dtypes.bool, (st.to_uop(),)).where(UOp.const(const.dtype, const.arg), UOp.const(const.dtype, 0))
pm = PatternMatcher([(UPat(UOps.CONST, name="const", src=(UPat(UOps.SHAPETRACKER, name="st_src"),)), rewrite_const)])
```

* rm arg

* remove arg

* revert arg removal

This reverts commit 2c35c75c950075d38c9fb8572f14640fe8235f74.

* red test_pickle_define_var
2024-09-21 14:19:25 +08:00
qazal d2351af019
fixup non-void SINKs in tests [run_process_replay] (#6624) 2024-09-21 13:29:18 +08:00
qazal 391d14438e
DEFINE_VAR prereqs for VALID [run_process_replay] (#6637) 2024-09-21 13:28:39 +08:00
nimlgen 053c4dee55
qcom test for image pitch (#6621)
* qcom test for image pitch

* comment
2024-09-20 18:13:48 +08:00