From 86f17468edd8d05aeb03242d3c56659f295c4a48 Mon Sep 17 00:00:00 2001 From: George Hotz <72895+geohot@users.noreply.github.com> Date: Sat, 14 Mar 2026 13:25:05 +0800 Subject: [PATCH] store in spec + USB BOT fix (#15265) * move spec to store * usb bot flag * Revert "usb bot flag" This reverts commit 7b8b7824f057b484c0f77331d9f7fce9d111a7ae. * fix assert --- tinygrad/runtime/support/usb.py | 2 +- tinygrad/uop/spec.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tinygrad/runtime/support/usb.py b/tinygrad/runtime/support/usb.py index a5f9db2a5c..c74d2b73b5 100644 --- a/tinygrad/runtime/support/usb.py +++ b/tinygrad/runtime/support/usb.py @@ -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 diff --git a/tinygrad/uop/spec.py b/tinygrad/uop/spec.py index 839e4992d7..c3f7609a68 100644 --- a/tinygrad/uop/spec.py +++ b/tinygrad/uop/spec.py @@ -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)),