Cortexelus Claude Opus 4.7 (1M context) commited on
Commit
a429ffa
·
1 Parent(s): e11ce65

Decoder ONNX: clip+scale in FP32 before int32 cast

Browse files

The PCM-baked tail (audio → clamp → ×32767 → int32) ran in the engine's
FP16/BF16 trunk, where 32767 is not representable (rounds up to 32768),
causing the int32 output to exceed the int16 range. The consumer code
then wrapped 32768 → -32768 on int16 downcast, producing audible clicks
on loud transients.

Fix: cast audio to FP32 before the clip/scale chain in both
build_same_l_decoder.py and build_same_s_decoder.py producers. 32767 is
exact in FP32. A trailing clamp(-32767, 32767) is added as
belt-and-suspenders against any residual numerical drift.

Affected: dec_dynamic_triton_swa.{onnx,trt} (SAME-L), dec_dynamic_bf16.{onnx,trt} (SAME-S).
Verified: 0 samples outside [-32767, +32767] on real-music decode (was ~800 with the old engines).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

onnx/same-l/dec_dynamic_triton_swa.onnx CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:c92a289c6e94e4f622107c2726f4a9e7b63380100e792bb4aeffacc5eefd63a5
3
- size 1192531589
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3f76e79f27e5f33161b314d0c89b484d96106646dac594f5eaf4a74bf65a8d26
3
+ size 1192532027
onnx/same-s/dec_dynamic_bf16.onnx CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:8923525c0d988de0c257513fa394f17232b02bcd1507342d26eebc9b4a703da7
3
- size 218676830
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba1e92f888e4ad6caef75858a4dff0bd14d24422ffcfd7a7517fc65f56de5f90
3
+ size 218677278
tensorRT/sm_90/same-l/dec_dynamic_triton_swa.trt CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:e91745733080485e5c725d1a0a369c40b7a932587f0a649583330b49165c6c99
3
- size 1198545588
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:13fdf7dcea5c171c3de4b072fda04212aeeaf07ecd52b6cd47aa10fc08a848a5
3
+ size 1198546196
tensorRT/sm_90/same-s/dec_dynamic_bf16.trt CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:1a389e4611448da804a9d88d4383bd199752f722a333fc9b07ea307f319e82bd
3
- size 115053444
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:edafd78ff38d706ad2e8498b20cdc66d0177860067dc4ee1045457c35ab78ba7
3
+ size 115053940