Commit Graph

277 Commits

Author SHA1 Message Date
chenyu e6c7c3e499
update pylint path to check indent/space for all (#6022)
also fixed many errors. it was not checking nested dirs. exclude autogen for now.

can we use ruff for this?
2024-08-10 14:41:09 -04:00
George Hotz cfb04c67d1
run unit tests separate from others (and only once) (#6020)
* run unit tests separate from others

* ignore unit tests elsewhere
2024-08-10 11:17:56 -07:00
chenyu 63a8bc29d4
addition divisor in UOp div_folding (#6002)
in addition to try gcd of all terms, also try least common divisor of all MULs
2024-08-09 20:09:05 -04:00
chenyu 5961faa4be
minor change to UOp div_fold (#6004)
remove an unnecessary gcd and swap the quo rem order, minimize diff for divisor pr
2024-08-09 17:09:59 -04:00
chenyu 1f1eb46af6
more failed simplified UOp div test case (#5992)
this speculative div was handled by "divisor" in symbolic.
2024-08-08 18:39:25 -04:00
chenyu c3e1ae2535
add failed simplified UOp div test case (#5990)
more cases!
2024-08-08 17:37:48 -04:00
chenyu 62c77a2831
trim const in UOp div_folding (#5982)
simplify `(4*x+4*y+7)//16` to `(x+y+1)//4`.
fixed `GPU=1 UOP_IS_SYMBOLIC=1 IMAGE=2 python -m pytest test/test_ops.py -k conv`
2024-08-08 12:49:05 -04:00
chenyu 859d0e4709
UOp simplify `(x+c0)*c1 -> x*c1+c0*c1` (#5973) 2024-08-07 21:25:22 -04:00
chenyu fa3a36e576
fancier UOp div gcd folding (#5953)
combine and cancel the remaining const based on gcd of other terms like SumNode.
2024-08-07 02:04:25 -04:00
chenyu aa7fd7ef74
Use `(-self).lt(-x+1)` for `UOp.ge` (#5955)
matched symbolic and fixed UOP_IS_SYMBOLIC=1 arange folding
2024-08-07 01:31:27 -04:00
chenyu aee737bd9e
divide by gcd in UOp div folding (#5949)
* divide by gcd in UOp div folding

`(6x+6y)//16 -> (3x+3y)//8` etc
simpler version

* only factor out const

* don't apply for unsigned

* don't need that if

* space
2024-08-06 20:00:57 -04:00
chenyu 489575c3be
more UOp sum div with gcd tests (#5936)
* more UOp sum div with gcd tests

* one more
2024-08-06 12:50:10 -04:00
chenyu 09b7722637
UOp generic div folding (#5896) 2024-08-05 21:38:43 -04:00
chenyu da61dea1b2
simple failed UOp sub symbolic test case (#5894) 2024-08-03 14:27:23 -04:00
chenyu d5de44340e
UOp add mod folding (#5862)
* UOp add mod folding

* that passes now
2024-08-02 18:31:46 -04:00
chenyu 41bbd3f4c1
update UOp mod reduction patterns (#5883)
prepare generic mod folding, also some test changes from mod folding pr
2024-08-02 17:43:40 -04:00
George Hotz 877e0b4ba0
define global only has the index [run_process_replay] (#5869)
* define global only has the index [run_process_replay]

* fix that linearizer test

* fix ptx

* stupid ptx fix
2024-08-01 19:01:15 -07:00
chenyu f27f949a5d
Revert "revert some UOp IDIV bound (#5863)" (#5871)
This reverts commit 0c8d202348.
2024-08-01 21:38:31 -04:00
chenyu df138bc558
Revert "revert a mod pattern (#5864)" (#5870)
This reverts commit 5c8de2d044.
2024-08-01 20:44:26 -04:00
chenyu 1b0314d9ef
Revert "remove one more UOp mod pattern (#5865)" (#5868)
This reverts commit b03b8e18c2.
2024-08-01 20:28:35 -04:00
chenyu b03b8e18c2
remove one more UOp mod pattern (#5865)
fixed UOP_IS_SYMBOLIC=1 test_failure_40
2024-08-01 18:29:04 -04:00
chenyu 5c8de2d044
revert a mod pattern (#5864)
fixed UOP_IS_SYMBOLIC=1 linearizer failure 47
2024-08-01 17:24:26 -04:00
chenyu 0c8d202348
revert some UOp IDIV bound (#5863)
* revert some UOp IDIV bound

breaks conv with UOP_IS_SYMBOLIC, added some conv tests in CI

* those are correct

* skip slow ones
2024-08-01 15:09:06 -04:00
chenyu c2ffcf6887
remove the wrong mod UOp pattern (#5847)
don't think we are hitting it because the stride construction, and it's wrong and not needed
2024-07-31 16:24:25 -04:00
chenyu 2e087ca8e4
UOp bound for div negative number (#5808) 2024-07-31 02:10:23 -04:00
chenyu 02f0be03f2
tests on UOp div negative number and arange opts (#5825) 2024-07-30 20:06:57 -04:00
nimlgen ab3839a80a
cleanup nv/cuda compilers (#5767)
* cleanup nv/cuda compilers

* destroy prog

* small test

* fix test

* nv ptx rewrite key

* jitlink free

* ptx is part of cuda
2024-07-29 13:50:03 +03:00
chenyu e7a14f398e
more uop_symbolic tests for divmod pairs (#5785) 2024-07-28 21:27:06 -04:00
chenyu 71a64d8252
UOps.MUL bound when one is negative (#5781)
* UOps.MUL bound when one is negative

also one more distribute_mul rule

* don't always expand
2024-07-28 19:02:47 -04:00
chenyu bfbd7c5461
more generic UOp mul mod folding (#5765) 2024-07-27 20:20:35 -04:00
chenyu 80c6475757
update test_uop_symbolic to test UOp min and max (#5764)
covers #5750, #5748, #5741
2024-07-27 19:53:21 -04:00
chenyu dc7483ee6f
UOp simple div folding (#5740)
made UOp.divides return the Optional[quotient] and used it for simple div folding
2024-07-26 17:14:32 -04:00
chenyu a4e9ebc68a
update test_uop_symbolic (#5733)
enabled more passed tests
2024-07-26 13:46:09 -04:00
chenyu 2cc55a3095
UOp simple mul add div fold (#5726) 2024-07-25 22:00:30 -04:00
chenyu 5521b6d437
UOp simple mul-add-lt fold (#5721) 2024-07-25 20:49:38 -04:00
chenyu 845b0d1c9d
UOp more generic div folding (#5722)
old: `x // c` can fold if `0 <= x.vmin <= x.vmax < c`
new: `x // c` can fold if `0 < c and x.vmin // c == x.vmax // c`
2024-07-25 17:49:14 -04:00
chenyu 46e1151c02
UOp more generic mul -> mod folding (#5698) 2024-07-24 21:41:25 -04:00
chenyu 66a9c372af
UOp mod reduction (#5697) 2024-07-24 20:36:00 -04:00
chenyu 8648fb2636
UOp vmin/vmax on ADD (#5689) 2024-07-24 19:09:42 -04:00
chenyu 85710e86cb
UOps div folding (#5690)
#5689, with just div folding and new test cases
2024-07-24 14:21:44 -04:00
chenyu a7a77dfd83
UOp mul lt fold (#5677) 2024-07-24 02:49:25 -04:00
chenyu 4e85761d40
UOp mod folding (#5668) 2024-07-24 00:10:47 -04:00
chenyu 199b3bf02b
simple UOp lt/ge folding (#5657)
works if lhs is a DEFINE_VAR.
folds trivial x < -math.inf now, need to change SPECIAL to use DEFINE_VAR to fold more
2024-07-23 14:11:05 -04:00
chenyu e210c87b4a
uop mod-mod simplification (#5650) 2024-07-23 12:33:55 -04:00
chenyu 4f83da626e
uop symbolic simple mul mod (#5648) 2024-07-22 23:17:41 -04:00
chenyu f2d2afdaa4
dumb linearizer example that max is not simplified (#5644)
* dumb linearizer example that max is not simplified

this might just get fix once basic mod simplification is done

* need local
2024-07-22 18:37:26 -04:00
chenyu 97b116bb1d
UOp mul div simplification (#5637)
* UOp mul div simplification

* != 0 is fine
2024-07-22 16:14:12 -04:00
chenyu 92e7e65712
one more test case for symbolic mod mul (#5615) 2024-07-20 17:23:06 -04:00
George Hotz 2e617ca59e
lowerer img index (#5592) 2024-07-19 14:22:02 -07:00
George Hotz 2de82b8a5d
remove get_lazyop_info (#5570)
* don't use get_lazyop_info more

* keep that min

* no ptx for that test
2024-07-19 03:05:33 -07:00