codec: drop the fused streaming tail
The fused mode appended the codec stream tail to the predictor frame graph, so one compute produced both a frame's codes and its 80 ms of audio with no host round trip. The experiment applied to max_batch 1 with a streaming synthesis only, it cost throughput against the buffered flush that stays the default, and it kept a second frame graph, its ring inputs and an init flag alive for that single case. It is not worth keeping. Remove the tail helpers, the fused graph of CodePredGraphSet, the codec_fused field of qt_init_params, the --codec-fused flag of both tools and the harness switch that exercised it. The predictor frame unroll and the in graph sampler are untouched.
This commit is contained in:
Executable → Regular
-33
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Shared helpers for the qwentts.cpp cossim debug scripts.
|
||||
|
||||
Provides Philox uniform stream, dump load and save, install_hooks for the
|
||||
@@ -396,35 +395,3 @@ GEN_KWARGS_GREEDY = dict(
|
||||
subtalker_dosample = False,
|
||||
repetition_penalty = 1.0,
|
||||
)
|
||||
|
||||
|
||||
def fused_pass(cmd, text, dump_cpp):
|
||||
"""Re-run the C++ side with --codec-fused (streaming, wav on stdout)
|
||||
and gate on codes equality against the buffered run: the decode path
|
||||
cannot change the predictor, so codes-full.bin must match exactly.
|
||||
The fused audio itself is not scored here, greedy amplitudes vanish
|
||||
in the streamed PCM_16 and the fused FP envelope has its own
|
||||
validation against the stream path."""
|
||||
import subprocess
|
||||
|
||||
dump_fused = dump_cpp + "-fused"
|
||||
os.makedirs(dump_fused, exist_ok=True)
|
||||
|
||||
cmd_f = list(cmd)
|
||||
cmd_f[cmd_f.index("--dump") + 1] = dump_fused
|
||||
cmd_f[cmd_f.index("-o") + 1] = "-"
|
||||
cmd_f.append("--codec-fused")
|
||||
|
||||
print(f"[GGML] Cmd: {' '.join(cmd_f)}")
|
||||
r = subprocess.run(cmd_f, input=text.encode(), capture_output=True)
|
||||
if r.returncode != 0:
|
||||
sys.stderr.write(r.stderr.decode(errors="replace"))
|
||||
sys.exit(r.returncode)
|
||||
|
||||
# surface the fused run's perf lines next to the buffered ones
|
||||
# already in the log, so every grid cell carries the comparison
|
||||
for line in r.stderr.decode(errors="replace").splitlines():
|
||||
if "[Perf]" in line:
|
||||
print(line.replace("[Perf]", "[Perf Fused]"))
|
||||
|
||||
compare_exact_i32("codes-full.bin", dump_fused, dump_cpp, "CodesFullFused")
|
||||
|
||||
@@ -155,7 +155,6 @@ def main():
|
||||
n = min(aa.size, ab.size)
|
||||
print(f"[Cossim] WAV stft_cos: {cc.stft_cos(aa.ravel()[:n], ab.ravel()[:n]):.6f} samples: {n}")
|
||||
|
||||
cc.fused_pass(cmd, text, DUMP_CPP)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -485,7 +485,6 @@ def main():
|
||||
n = min(aa.size, ab.size)
|
||||
print(f"[Cossim] WAV stft_cos: {cc.stft_cos(aa.ravel()[:n], ab.ravel()[:n]):.6f} samples: {n}")
|
||||
|
||||
cc.fused_pass(cmd, text, DUMP_CPP)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -181,7 +181,6 @@ def main():
|
||||
n = min(aa.size, ab.size)
|
||||
print(f"[Cossim] WAV stft_cos: {cc.stft_cos(aa.ravel()[:n], ab.ravel()[:n]):.6f} samples: {n}")
|
||||
|
||||
cc.fused_pass(cmd, text, DUMP_CPP)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -169,7 +169,6 @@ def main():
|
||||
n = min(aa.size, ab.size)
|
||||
print(f"[Cossim] WAV stft_cos: {cc.stft_cos(aa.ravel()[:n], ab.ravel()[:n]):.6f} samples: {n}")
|
||||
|
||||
cc.fused_pass(cmd, text, DUMP_CPP)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user