ops_ext to replace cpu import (#3409)

* ops_ext to replace cpu import

* don't allow zero copy with as buffer

* memoryview(bytearray

* reenable test

* fix jit issue
This commit is contained in:
George Hotz
2024-02-15 13:03:42 +01:00
committed by GitHub
parent ede4fd4705
commit a40df14fef
11 changed files with 35 additions and 12 deletions

View File

@@ -135,8 +135,8 @@ assert len(lazyop.srcs) == 2
# the source is a LazyBuffer that is a "CPU" Tensor
# again, a LazyOp AST is like a GPU kernel. you have to copy the data on the device first
assert lazyop.srcs[0].op == LoadOps.COPY
assert lazyop.srcs[0].srcs[0].device == "CPU"
assert lazyop.srcs[0].srcs[0].realized._buf[0] == 2, "the src of the COPY LazyOP is a LazyBuffer on the CPU holding [2]"
assert lazyop.srcs[0].srcs[0].device == "EXT"
assert lazyop.srcs[0].srcs[0].realized._buf[0][0] == 2, "the src of the COPY LazyOP is a LazyBuffer on the CPU holding [2]"
assert result.lazydata.base.realized is None, "the LazyBuffer is not realized yet"
# now we realize the LazyBuffer