perf(fish_audio): add HIP Fast-AR top-k sampler - #386
Merged
Conversation
Select exact Fast-AR top-k candidates on HIP and copy only the compact sampling data back to the host while preserving the existing sampling distribution and RNG path.
Owner
|
Thanks @reezex0-ux! It overall looks good to me. One minor concern: the HIP sampler CMake block runs unconditionally whenever @IIIIIllllIIIIIlllll Could you take a look at this PR? |
Owner
|
@reezex0-ux I'm going to merge it now and follow-up PRs are appreciated! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is the first small HIP-scoped piece from the Fish S2 Pro AMD optimization work discussed in #317.
Fish Fast-AR produces a 4096-entry logits tensor for each acoustic codebook step. On the HIP path this PR:
fish_audiois part of the model composite.Other backends keep the existing path unchanged.
This intentionally does not include the more aggressive experiments from the original patch set: chained Fast-AR, resident embedding gather, device-side mask/position updates, backend stream access, or the GGML convolution fixes. Those can be reviewed separately if useful.
Validation
Tested against current
mainat3497b7cc44753e2c141d8fe60ac42cec433e3281.System:
gfx1100)fish-audio-s2-pro-q8_0.gguf)Build:
Benchmark input:
Generation settings:
Five identical requests were run in one loaded process. Request 1 was treated as graph/model warmup; requests 2-5 are the warm measurements below. Each output was 4411.79 ms of audio.
That is about 4.22% lower warm wall time for this isolated optimization.
Output parity: all five baseline WAVs and all five patched WAVs were bit-identical:
After a small code cleanup/refactor, I rebuilt/relinked and reran three requests; the warm times were 4038.98 / 4106.59 ms and the same SHA-256 was preserved for all three outputs.
I also compiled
src/models/fish_audio/ar.cppwith the HIP Fish sampler macro removed to verify the existing non-HIP fallback path still compiles.Known limitations
top_k <= 256; unsupported values fall back to the existing full-logits path.