Repository navigation
feat(fast): add an fp32 TileLang CPU lowering for the kernels - #896
Conversation
|
Merged for 0.3.25. The evidence page is the reason this went in. Replacing a prose claim ("GPU-only") with the exact diagnostics for each of the five kernels, in both dtypes, and then isolating fragments from bf16 by re-probing with Two things I want to be straight about, neither a blocker. Nothing in CI runs this. #901 landed in the same pass and changes a default you now also read. It takes The GPU-preservation evidence is what let me take it without being able to run it: 24 bit-identical output tensors, 10/10 byte-identical generated CUDA sources, and Verified here: the shared suite list and pytest lane green, Thank you. |
laya/tl_kernels.pyhas always been GPU-only: the kernels use fragments, fragment reductions and bf16, and none of that lowers for TileLang's CPU ("c") target. docs/fast-backends.md recorded that as prose. This PR makes the CPU target work for all five kernels and pins, with tests, what still does not work.What changed
test_fast_cpu.pycovers each kernel against an fp32 torch reference.cpu=selector on the kernel factories is the only API surface added. The GPU dtype default is unchanged.What is still not supported
bfloat16/float16CPU execution.tests/test_fast_cpu.pypins the diagnostics for both, including the RoPE fp16 compiler error, so a TileLang upgrade that changes them fails loudly instead of silently changing the claim.Checks
Numerics: CPU vs the fp32 reference at most 1.073e-6; CPU vs GPU below 0.05 (0.02 for attention, on the documented fixtures). The GPU path is untouched: 24 captured output tensors bit-identical, 10/10 generated CUDA sources byte-identical, maximum before/after probability delta 0.
This is a portability change, not a speed claim: no CPU speedup and no CPU
Agentbackend is implied.