store in spec + USB BOT fix (#15265)

* move spec to store

* usb bot flag

* Revert "usb bot flag"

This reverts commit 7b8b7824f0.

* fix assert
This commit is contained in:
George Hotz
2026-03-14 13:25:05 +08:00
committed by GitHub
parent 06d7cddb33
commit 86f17468ed
2 changed files with 4 additions and 4 deletions

View File

@@ -107,7 +107,7 @@ class USB3:
if self.use_bot:
dir_in = rlen > 0
data_len = rlen if dir_in else (len(send_data) if send_data is not None else 0)
assert (data_len == 0) if dir_in else (rlen == 0), "BOT mode only supports either read or write per command"
assert not (rlen > 0 and send_data is not None), "BOT mode only supports either read or write per command"
# CBW
self._tag += 1

View File

@@ -59,6 +59,9 @@ shared_spec = PatternMatcher([
# RANGE/SPECIAL define loops, END closes them
(UPat(Ops.END, src=(UPat(), UPat(Ops.RANGE))), lambda: True),
# STORE in tensor graph: store a value into a target
(UPat(Ops.STORE, dtypes.void, (UPat(), UPat())), lambda: True),
# NOOP
(UPat(Ops.NOOP), lambda: True)
])
@@ -96,9 +99,6 @@ _tensor_spec = PatternMatcher([
# ASSIGN has a target and a value. It can also optionally depend on other assigns
(UPat(Ops.ASSIGN, name="x"), lambda x: len(x.src) >= 2 and all(s.op is Ops.ASSIGN for s in x.src[2:])),
# STORE in tensor graph: store a value into a target
(UPat(Ops.STORE, dtypes.void, (UPat(), UPat())), lambda: True),
# MSELECT chooses one of the multi buffers
(UPat(Ops.MSELECT, name="x"), lambda x: isinstance(x.src[0].device, tuple) and x.arg < len(x.src[0].device)),