CPU and GPU are not the same init
If the tensor is going to live on two machines, it cannot pretend they start the same way. The 1st is refAllDecls, a hack to get something compiling — sorry, Andrew. The 2nd is the split: init becomes initCpu. GPU is a device tag and a door that is not open.
slice on CPU reinterprets the []u8 as f32, i32, or bool. On GPU it returns InvalidDevice. The error set grows InvalidDevice and InvalidType. A leak test drops defer so a forgotten free actually fails the build. Errors for reading the buffer as a slice or a pointer, because “just give me the bytes” is how a library starts lying.
A second monitor is not architecture. The last commit of the 2nd is breaking, resume tomorrow. What survives is the contract: host memory and device memory are different, and the Tensor has to say so at init rather than at the first kernel launch. lib.zig finally re-exports Tensor, DType, Device.
e489c17 · d505eec · f865685 · dffa148 · e1a3fe5 · 69176c1 · 48cdf92 · b5334e4