wai-quantum: the tensor-engine member's kernel compiles for a device #302
Loading…
Reference in a new issue
No description provided.
Delete branch "wai/tensor-engine-device-compile"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
The tensor-engine member's helper compiled its kernel for the simulator only. On a device, every test of the member failed at the first request with
failed to resolve name 'nl.ndarray'.main(), with the kernel toolchain imported there. The simulator runs the kernel as Python, so the names resolved. Compiling for a device traces the kernel's source and resolves its names in the kernel's module, where they were absent.main()still imports the toolchain after the target is chosen (the toolchain reads the target at import), but binds it as module globals.PATH. The interpreter the member is given (WAI_QUANTUM_TENSOR_ENGINE_PYTHON) need not be onPATH, and in that case the compiler is launched asNone. For a device target, the helper now puts its interpreter's directory first onPATH.Checked
The run on the device itself follows this PR.
🤖 Generated with Claude Code
The helper defined its kernel inside main() and imported the kernel toolchain there. The simulator runs the kernel as Python and found the names; compiling for a device traces the kernel's source and resolves its names in the kernel's module, so it found none ("failed to resolve name 'nl.ndarray'") and every device test failed at the first request. The kernel now sits at module level; main() binds the toolchain as module globals after the target is chosen. Compiling for a device also runs the toolchain's compiler from PATH, and the interpreter the member is given need not be on it, so the helper puts that interpreter's directory first on PATH for a device target. Checked off the device with the toolchain's compiler: the kernel compiles for the device target; the simulator path is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>