Repository navigation
Description
Repro: https://github.com/rongjiecomputer/litert-kokoro-vocoder-webgpu-repro
CompiledModel with the WebGPU accelerator fails with
Shape mismatch in GpuModelBuilder::UpdateOutputTensors(output of convolution1x1(conv_generic)).
Requested shape:{bhwdc, {230400, 1, 1, 1, 1}} vs reference shape: {bhwdc, {1, 1, 230400, 1, 1}}
Failed to create litert::ml_drift::DelegateKernelLiteRt: INVALID_ARGUMENT:
Unable to parse bc coord for BATCH axis. Layout is bhwc, args are res, DST_X + 0, DST_Y + 0, DST_S + 0.
for a FULLY_CONNECTED whose weights are int8 (per-tensor quantised, float
activations) and whose input has rank 3 with keep_num_dims=false, i.e. the
output is [B*T, units]. The same op with float weights, with
keep_num_dims=true, or with a rank-2 input compiles and runs correctly.
It is hit by the vocoder of
litert-community/Kokoro-82M
(kokoro_int8_gpu_fp16.litertlm, the file the model card recommends for
Delegate.GPU / WebGPU): the SourceModuleHnNSF Linear(9 -> 1) is exactly
this op, so the whole vocoder graph fails delegation on WebGPU
(CreateCompiledModel returns status 3).
Reproduce
py -m venv .venv && .venv\Scripts\activate
pip install -r requirements.txt
py repro.py # compiles every model in models/ on CPU and on GPUThe models in models/ are tiny (~600 bytes) and checked in;
py make_models.py regenerates them (it only needs the ai-edge-litert
wheel, the FlatBuffer schema ships inside it).
Result with ai-edge-litert==2.4.0 (the same output with 2.3.0):
PASS fc_f32w_1x230400x9_u1.tflite: fully_accelerated=True max|gpu-ref|=7.15e-07
FAIL fc_int8w_1x1000x9_u1.tflite: GPU compile raised RuntimeError
FAIL fc_int8w_1x230400x9_u1.tflite: GPU compile raised RuntimeError
PASS fc_int8w_1x230400x9_u1_keepdims.tflite: fully_accelerated=True max|gpu-ref|=7.15e-07
FAIL fc_int8w_1x230400x9_u2.tflite: GPU compile raised RuntimeError
PASS fc_int8w_230400x9_u1.tflite: fully_accelerated=True max|gpu-ref|=7.15e-07
| model | input | weights | units | keep_num_dims | WebGPU |
|---|---|---|---|---|---|
fc_int8w_1x230400x9_u1 (the Kokoro op) |
[1,230400,9] |
int8 | 1 | false | fails |
fc_int8w_1x1000x9_u1 |
[1,1000,9] |
int8 | 1 | false | fails (length is irrelevant) |
fc_int8w_1x230400x9_u2 |
[1,230400,9] |
int8 | 2 | false | fails (units is irrelevant) |
fc_f32w_1x230400x9_u1 |
[1,230400,9] |
float32 | 1 | false | ok |
fc_int8w_1x230400x9_u1_keepdims |
[1,230400,9] |
int8 | 1 | true | ok |
fc_int8w_230400x9_u1 |
[230400,9] |
int8 | 1 | false | ok |
So the failure is specific to the int8-weight path (lowered to
convolution1x1) when the batch dims of a rank-3 input are flattened into the
output: the node's output is declared as {B*T,1,1,1,1} while the reference
shape is {1,1,B*T,1,1}, and the BUFFER Write selector can't resolve the
batch axis.
logs/windows_gtx1050_ai-edge-litert-2.4.0.log is the native log of the
failing case (INFO noise removed).
The model op
The op as it appears in the real Kokoro vocoder
(FULLY_CONNECTED, opcode version 5):
input [1, 230400, 9] float32
weights [1, 9] int8, per-tensor scale 0.004312947, zero point 0
bias [1] float32
output [230400, 1] float32
options fused_activation=NONE weights_format=DEFAULT keep_num_dims=false asymmetric_quantize_inputs=false
Environment
- Windows 10 (19045), NVIDIA GeForce GTX 1050, driver 581.57 (Direct3D 12 backend,
arch=pascal) - Python 3.13,
ai-edge-litert2.4.0 (latest on PyPI) and 2.3.0; the full
vocoder also fails identically with the LiteRT C API nightly20261126 - Not tried on other GPUs/OSes. Please check whether it also fails on the
Metal / OpenCL paths.
Side note: Windows wheel misses the DXC DLLs
The ai-edge-litert Windows wheel ships libLiteRtWebGpuAccelerator.dll but
not dxcompiler.dll / dxil.dll. Without them WebGPU device creation fails
before any model is compiled:
DynamicLib.Open: dxcompiler.dll Windows Error: 87
Failed to initialize WebGPU environment: INTERNAL: Device could not be created
To reach the actual bug above, copy dxcompiler.dll and dxil.dll (x64, from
a DirectXShaderCompiler release,
v1.9.2609 was used) into
.venv\Lib\site-packages\ai_edge_litert\.
Reproducing with the real model (optional)
hf download litert-community/Kokoro-82M kokoro_int8_gpu_fp16.litertlm --local-dir .
litert-lm unpack kokoro_int8_gpu_fp16.litertlm --output-dir unpacked
py repro.py unpacked/Section2_TFLiteModel_tf_lite_vocoder.tflite(Section 2 is the vocoder; for a model that is not a single FULLY_CONNECTED
the script only checks that it compiles and runs on the GPU.) Whether the vocoder has further WebGPU blockers behind this one can't be
checked until it is fixed. The acoustic graph (Section 1) is CPU-only and needs the
litert_custom_op.bidirectional_lstm kernel registered separately.
Activity
rongjiecomputer commentedon Nov 28, 2026
I tested that the PR is the only change needed to make kokoro-tts gpu model works on Windows WebGPU
shivvaam0001 commentedon Nov 30, 2026
Hi @rongjiecomputer,
Thank you for the detailed report on the WebGPU
CompiledModelcompilation error for int8-weightFULLY_CONNECTEDwith rank-3 inputs (keep_num_dims=false), as well as the minimal reproduction repository and linked PR (#12497). We will investigate further and get back to you.Thanks!