Repository navigation
Conversation
FLARE_KIMI3_KDA_FUSED_VERIFY=1 (read when a verify layer with records is prepared; set it identically for export and serving) makes each KDA verify layer run the b12x one-launch verify (gdn_decode.run_kda_fused_verify: speculative short conv, recording verification and gated RMSNorm) instead of short_conv.run + kda_record (3 launches -> 1 per KDA layer, 69 layers). New custom op flare::kda_record_fused mutates output, records and the convolution state. The fused binding is prepared by a finalizer after both bindings exist and re-prepared if they are replaced; geometries the kernel refuses fall back to the three launches with a warning. Requires the b12x gdn_decode one-launch KDA speculative verify. Bit-identical to the three-launch path (new test test_kimi3_kda_fused_verify_cuda.py: synthetic BF16 weights at the K3.1 TP8 rank geometry, compile_forward + CUDA graph, poisoned arena, OFF vs ON output projection / gated / conv state / recurrent / records bitwise, rows 1/4/8). kimi3 recipe tests: 30 passed, 16 skipped (checkpoint), 1 pre-existing failure (test_shard_columns_survive_export_scratch_clearing) with the switch off and on.
Author
|
GPU validation of this branch as published (base
|
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.
📌 Description
FLARE_KIMI3_KDA_FUSED_VERIFY=1(default off) is read when a verify layer with records is prepared, and must be set identically for export and serving. With it, each KDA verify layer runs b12x's one-launch verify (speculative short conv, recording verification and gated RMSNorm) instead ofshort_conv.run+kda_record. That is 3 launches -> 1 per KDA layer, over 69 layers. A new custom opflare::kda_record_fusedmutates the output, the records and the convolution state. The fused binding is prepared by a finalizer after both bindings exist, and is re-prepared if they are replaced. Geometries the kernel refuses fall back to the three launches with a warning.Kernel-level gains are in FlashInfer local-inference-lab/flashinfer#90 (rows 1: 6.90 -> 5.66 us; rows 8: 13.03 -> 11.28 us per layer).
Exactness: bit-identical to the three-launch path. Default-off guarantee: unset keeps the three launches and the existing op graph.
🧪 Tests
tests/recipes/test_kimi3_kda_fused_verify_cuda.py. It uses synthetic BF16 weights at the K3.1 TP8 rank geometry,compile_forward+ CUDA graph and a poisoned arena, and compares off vs on bitwise for output projection, gated output, conv state, recurrent state and records at rows 1/4/8. GPU only; on this branch it was collected and skipped on CPU (actually run). The other kimi3 CPU tests have the same failure set as the release branch.test_shard_columns_survive_export_scratch_clearing) that was present before the change, with the switch off and on.Topology assumptions
Generic (single GPU; uses b12x thread-block clusters).
Reviewer Notes / risk
AttributeError, because onlyValueErroris caught for the fallback. With the switch off nothing touches the new API. Ahasattrguard could be added if the maintainer prefers.