Commit Graph
570 Commits
Author SHA1 Message Date
qazalandGitHub ae10e936e7 UOps.VECTORIZE cleanups [run_process_replay] (#5314)
* still render_cast

* one extra line ok

* these are all just vectorize

* save space

* behavior change can go in a different diff
2024-07-07 10:49:08 +03:00
77b2ce9fc9 Add UOps.VECTORIZE [run_process_replay] (#5289)
* Add UOps.VECTORIZE to core

* Update vectorized cast tests

* Addresses code review comments

- Removes VECTORIZE from LLVMRenderer
- Add line breaks to unduly long lines
- Add noop CAST rule back
- Update asserts and add render_vectorize in
  CSytleLanguage renderer

* Add missing const folding rule for VECTORIZE

Also adds corresponding test

* Fixes test_const_vectorize_fold and add assert

- Use sane types with VECTORIZE in test_const_vectorize_fold
- Add assert that sanity checks the types for VECTORIZE

* Rename test_cast_vectorized_fold

Renames test_cast_vectorized_fold to test_noop_vectorize_fold
because the test targets a very specific rule and there are
other tests for VECTORIZE.

* Revert unrelated changes

---------

Co-authored-by: qazal <[email protected]>
Co-authored-by: qazal <[email protected]>
2024-07-07 09:59:57 +03:00
qazalandGitHub 1cefbb33ab uop graph tests + type_verify cleanup (#5292)
* test_cast_alu_fold

* test_double_cast_fold + these should assert
2024-07-05 13:00:01 +03:00
chenyuandGitHub 3929a9dc94 fix UOp.cmp_tuple for ALU (#5280)
* fix UOp.cmp_tuple for ALU

for ALU, use self.arg instead of self.op to compare

* skip that?
2024-07-03 14:59:05 -04:00
George HotzandGitHub 16e3b8b013 uops work from lowerer [run_process_replay] (#5279) 2024-07-03 09:40:00 -07:00
chenyuandGitHub ce52b10f6f add a flag DISABLE_LOOP_COLLAPSE (#5270)
workaround if user encountered UNMUL error
2024-07-02 20:01:11 -04:00
George HotzandGitHub e53b164e1a small changes from lowerer (#5266) 2024-07-02 15:03:54 -07:00
qazalandGitHub 59bc837ad1 refactor gated load rendering [run_process_replay] (#5259)
* refactor gated load rendering [run_process_replay]

* hotfix: extra line

* remove llvm diff
2024-07-02 15:13:10 +03:00
qazalandGitHub d3cfb6c2e3 refactor UOps.LOAD barrier [run_process_replay] (#5258) 2024-07-02 13:48:47 +03:00
qazalandGitHub a1044e6063 iterate over scoped uops once [run_process_replay] (#5255) 2024-07-02 09:21:09 +03:00
Carson PowersandGitHub d7839fdc5f Add x!=0 -> (bool)x pattern [run_process_replay] [no_assert] (#5237)
* x!=0 -> (bool)x pattern

* bool != bool pattern

* redundant upat
2024-06-30 17:48:45 -07:00
qazalandGitHub f374fb77af assert bool dtype for valid [run_process_replay] (#5214)
* valid is always bool

* prevent NumNode to begin with

* part 2

* test: disable pattern matchers, asserts should pass

* test: store without cast

* test: if (0)

* cleanup time

* only pattern match bool literal

* better for upstream debug
2024-06-29 21:20:32 +03:00
qazalandGitHub 3f4eeb8b54 late UOps.IF generation [run_process_replay] [no_assert] (#5027)
* find all places

* test gates

* test

* gate based on depths

* add ctx

* that cache was so wrong

* delete useless things

* dont double write if

* self.if_cond

* move UOps.IF to gated store

* test_padto_where_multioutput

* test_padto_group

* minor cleanup

* hmm this actually works?

* need a good barrier

* merge 2

* delete ctx

* p1

* maybe p2

* p3

* minor fixup

* fixup 2

* smart thing from the Lowerer branch

* refactoring

* refactoring 2

* maybe before graph_rewrite

* slightly more acceptable Linearizer diff

* more correct

* [run_process_replay] [no_assert]
2024-06-29 12:22:14 -04:00
George HotzandGitHub c9714dfcf4 rename graph to children [run_process_replay] (#5215) 2024-06-28 09:53:52 -07:00
kormannandGitHub 6c456b6d66 remove uopgraph dedup + slight speedup (#5199)
* rm dedup

* rm dedup

* tests

* reduce diff

* oups

* reduce diff

* rm UOp.tuple
2024-06-28 09:26:32 -07:00
George HotzandGitHub 345bcc2099 move graph_dedup out of class [run_process_replay] (#5197) 2024-06-27 12:04:00 -07:00
George HotzandGitHub d094a6828f single pass rewrite (#5159)
* single pass rewrite

* claude cleanups

* claude cleanups

* skip those tests

* restrict that to ints

* comment

* asserts i don't expect to fail do fail

* simplest...rewrite...ever

* simplest...rewrite...ever

* add that rule back

* tests pass?

* only collapse reduce loops

* second SHL/SHR arg must be 4 bytes

* fix verify

* no SHL/SHR in ptx

* put that back

* skip them in PTX...bad tests
2024-06-27 11:36:05 -07:00
9704c7d4d4 ruff rule if-exp-instead-of-or-operator (FURB110) (#5178)
Co-authored-by: chenyu <[email protected]>
2024-06-27 08:22:19 -07:00
Roelof van DijkandGitHub f88f71d73a ruff: unnecessary-comprehension (#5174)
* enable ruff C416 unnecessary-comprehension

* already a list
2024-06-27 07:45:29 -04:00
George HotzandGitHub 396ce6cfc9 clean up graph dedup function [run_process_replay] (#5169) 2024-06-26 15:07:34 -07:00
Roelof van DijkandGitHub 294bd1a9ff refactor: name check [run_process_replay] (#5158) 2024-06-26 11:39:41 -07:00
Roelof van DijkandGitHub 2c80583e14 perf: cache const UOp creation [run_process_replay] (#5156) 2024-06-26 11:13:14 -07:00
George HotzandGitHub eda2824cd8 freeze uop [run_process_replay] (#5155) 2024-06-26 10:18:15 -07:00
7b709c3ccd switch tensorcoreoptions to tuple [run_process_replay] (#5143)
* switch tensorcoreoptions to tuple [run_process_replay]

* localbuffer can stay namedtuple for now

* freeze LocalBuffer

* remove NamedTuple

---------

Co-authored-by: qazal <[email protected]>
2024-06-26 14:12:53 +03:00
qazalandGitHub 6ca7b13ed1 limit pickled objects [run_process_replay] (#5154)
* limit pickled objects

* delete uop from the list

* debug metal

* need self.opts for TC

* dont need device

* [run_process_replay]

* minor
2024-06-26 13:51:32 +03:00
George HotzandGitHub ee4f080a14 rewrite div const [run_process_replay] [no_assert] (#5151)
* rewrite div const [run_process_replay] [no_assert]

* Update uops.py
2024-06-25 20:23:14 -07:00
George HotzandGitHub 89e106686a simpler unmatch [run_process_replay] (#5149) 2024-06-25 19:57:40 -07:00
George HotzandGitHub 63ba2d05d1 uops dfs cleanup (#5147)
* uops dfs cleanup

* Update uops.py
2024-06-25 18:51:42 -07:00
George HotzandGitHub cc7fafcd8b sink folding rule [run_process_replay] (#5145) 2024-06-25 18:34:44 -07:00
Jhenner TigrerosandGitHub fa78755f19 Add new patterns to unfold division (#5139)
* Add new patterns to unfold division

* Create regression test and fix pattern
2024-06-25 18:07:47 -07:00
qazalandGitHub 18e70deec3 verify_lazyop (#5124)
* start verify_lazyop

* bfs order

* assert

* assert shapetrackers 2

* refactor

* more iteration

* skips

* that ast was wrong too
2024-06-24 13:45:35 -07:00
qazalandGitHub fe707bc968 hotfix: don't use is for comparing dtype (#5128) 2024-06-24 14:12:34 -04:00
dfa562dbc1 DEFINE_ACC takes UOps.CONST in vin instead of arg (#4975)
* Change DEFINE_ACC to receive UOps.CONST in vin

* Use localtype instead of acc dtype

* Fix idp

* Fix copy list

* Fix warp

* Fix error

* Fix merge

* Fix testing

* Fix merge

* Use deepcopy

* Change to copy of inp

* Fix lint

* Move const to first place

* Fix issue upat

* Fix upat patterns

* Change to list, to test permutations

* Add condition

* Change pm

* Revert change pm

* Remove unused rule

* Fix

* Change of float4 DEFINE_ACC values

* Cast on PM to correct dtype

* Improve assert message

* Move IFs

---------

Co-authored-by: George Hotz <[email protected]>
2024-06-24 09:25:33 -07:00
Francis LamandGitHub b563cd52ed linearizer: change globals to merge into left axis/gridDims.x first (#5033)
* linearizer: change order of collapse to be left-most

also fixes Variable max size to be correct and add docs for the off
parameter

* fix multiple global dim oversizes

* add passing variable test and reorganize tests

* use assert RuntimeError for failing test
2024-06-23 18:53:15 -04:00
qazalandGitHub 64a3b7931e simplify render_ops ctx [run_process_replay] (#5116)
* new ctx

* delete DEFINE_VAR

* lt isnt static
2024-06-23 16:56:32 +03:00
George HotzandGitHub 9f875123b6 small changes from lowerer. [run_process_replay] [no_assert] (#5102) 2024-06-22 11:09:35 -07:00
kormannandGitHub f4a041af16 Simplify graph_dedup [run_process_replay] (#5084)
* reset master

* remvpe double default
2024-06-21 22:12:30 +03:00
qazalandGitHub 24c89a2a33 move assert_equiv_uops to helpers + use == for dtypes (#5067)
* dtypes should use ==

* use TestUOps

* should use assertIs
2024-06-20 16:39:34 +03:00
qazalandGitHub 55e02cdd84 generic gate folding (#5061)
* add assert

* fold truthy gates [run_process_replay]

* fold falsy gates [run_process_replay] [no_assert]

* redo asserts

* check both barriers

* spec start

* spec end

* assert srcs

* make test_fold_gated_load_local better

* [run_process_replay] [no_assert]
2024-06-20 16:10:08 +03:00
kormannandGitHub bdca2da2be typannos (#5059) 2024-06-20 09:02:31 -04:00
qazalandGitHub a6a5dba637 Revert "UPat for has_valid in load/store (#5052)" (#5056)
* manually insert in the Linearizer

* fix process replay
2024-06-19 20:53:36 +03:00
qazalandGitHub 99fc275c27 UPat line savings [run_process_replay] (#5053)
* line savings

* move to new style
2024-06-19 12:43:20 +03:00
qazalandGitHub 71194df1da UPat for has_valid in load/store [run_process_replay] (#5052)
* fold gated load/store [run_process_replay]

* handle temp loads

* direct store
2024-06-19 12:20:22 +03:00
kormannandGitHub fe332464d2 src->vin [run_process_replay] (#5036) 2024-06-18 22:23:49 +03:00
kormannandGitHub 7c3b877216 rename uop [run_process_replay] (#5031)
* rename

* fix unittests

* rename vin

* fix test

* fix type [run_process_replay]

* rm pre commit hook change
2024-06-18 21:34:05 +03:00
Francis LamandGitHub 8d33998e0d [run_process_replay] linearizer: fix get_grouping_dims to respect global/local max (#4855)
* linearizer: fix get_grouping_dims to respect global/local max

* fix lidx variable index offset and unrestrict clang/llvm global len

* test reverse variable indexing when reverse_dims is true

* change the collapse axis to be the right most if reversed
2024-06-18 16:51:27 +03:00
c8cd6e725c Remove BinaryOps.SUB. Replace SUB by ADD and NEG in all tests. Regenerate dataset (#4977)
* feat: remove BinaryOps.SUB

* remove SUB in test_early_end_local

* regenerate dataset. remove SUB in test_linearizer_*

* reenable overflow tests

* simplify tensor.sub function by returning a+(-b)

* remove whitespaces

---------

Co-authored-by: chenyu <[email protected]>
2024-06-18 09:06:13 -04:00
qazalandGitHub 026c59543c allow keyword args in UOp.store [run_process_replay] (#5008)
* allow keyword args in UOp.store [run_process_replay]

* same for load

* typing can stay
2024-06-17 15:42:27 +03:00
uuuvnandGitHub f1de8cd8cf Convert a bunch more rules [run_process_replay] (#5007)
* Convert a bunch more rules [run_process_replay]

* more rules, narrow down CMPLT rule

* smart linter cut two lines

* nope, the linter is dumb

* make dumb linter shut up

* revert two rules

* Revert "revert two rules"

This reverts commit 585688da17.

* fix
2024-06-17 15:16:31 +03:00
chenyuandGitHub 72c9b22833 sort vars in jit when building expected input args (#4990)
* sort vars in jit when building expected input args

fixed symbolic jit bugs with two variables.

* sort in clanggraph

* space

* one more
2024-06-16 15:55:51 -04:00