$ the-wire · showcase
C++ FakeTensor catches up to Python, and two ExecuTorch correctness fixes
By RepoJournal · Filed · About PyTorch · Composed from the cited sources · methodology
Four-part C++ FakeTensor work lands the Python fallback's semantics in native code, while ExecuTorch fixes a mis-dequantized 4-bit linear and stops delegating quantized linears Vulkan has no kernel for.
[CPP FakeTensor] Run ops on sparse C++ fakes through their sparse Meta kernels (#203957) pytorch/pytorch
The C++ fake fallback used to reject sparse inputs outright; it now routes COO fakes through SparseMeta and CSR, CSC, BSR, and BSC fakes through SparseCsrMeta, keeping Python's rule that static-shape decomposition rejection applies. Sparse op tracing under FakeTensorMode no longer falls off the C++ path.
[CPP FakeTensor] Run ops on C++ fakes through FakeTensorMode's op_implementations (#204492) pytorch/pytorch
Ops on C++ fakes now run through FakeTensorMode's shared op_implementations after decomposition and CIA selection and before the Meta fallback, including constructors with no tensor inputs. The native mode is passed explicitly while uninstalled, which keeps it consistent with what Dynamo already does for Python fakes.
[CPP FakeTensor] Convert or reject non-fake inputs in the native fallback (#204694) pytorch/pytorch
Non-fake inputs into the native fallback are now validated for tensor ownership and converted through the explicit owning mode's converter, with allow_non_fake_inputs and its thread-local override honored. Paired with the common-device rules being ported into the C++ fallback, the C++ path now matches Python FakeTensorMode on device resolution rather than approximating it.
Fix the linear_q4gsw reference implementation for output channels not a multiple of 4 (#24930) (#24930) pytorch/executorch
make_linear_q4gsw_op and make_linear_dq8ca_q4gsw_op pad weight scales and bias to a multiple of 4 output channels but not the packed weights, so the CompositeExplicitAutograd implementation dequantized unpadded weights with padded scales. Any lowering that re-traced the graph hit a RuntimeError on such a linear, such as the 512 to 1 end-of-speech head of a TTS model.
Do not delegate quantized linears that have no Vulkan kernel (#24971) (#24971) pytorch/executorch
The quantized linear pattern detector matched every linear with a dequantized constant weight, while replace_quantized_linear_patterns only has custom ops for 8-bit statically quantized activations and 4-bit group-quantized weights. An 8-bit weight-only linear (torchao IntxWeightOnlyConfig int8) was therefore delegated wholesale to the Vulkan partitioner with no kernel to run it; such linears s...
Phonon: streaming output and per-backend weight quantization (#24929) pytorch/executorch
Also in ExecuTorch: the Phonon C++ runner gains --stream, writing 16-bit mono PCM to stdout as each 80 ms frame decodes so playback can start after the first frame, and --qlinear now accepts only the modes each backend has a kernel for.