-
Notifications
You must be signed in to change notification settings - Fork 65
Add packed MLA fast paths and TP9 numerical evidence #311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
myshytf
wants to merge
30
commits into
local-inference-lab:master
Choose a base branch
from
myshytf:agent/kimi-k3-packed-mla-balanced-splits-20260905
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
debaafe
fix(moe): stage inactive native W4A16 routes
voipmonitor af354ef
fix(moe): sanitize runtime FC2 routes
voipmonitor 6a41770
test(moe): prove inactive-route direct dispatch
voipmonitor acd96cb
docs(validation): record W4A16 route-safety evidence
voipmonitor 97dfe7f
fix(moe): preserve direct micro compile ABI
voipmonitor e38436d
docs(validation): qualify direct micro compile ABI
voipmonitor 0e167cd
fix(moe): validate W4A16 routes before narrowing
voipmonitor 98e3d95
docs(validation): qualify W4A16 int64 route bounds
voipmonitor e53526b
docs(validation): record composed W4A16 suite
voipmonitor 0eba6ae
docs(validation): identify tested runtime tree
voipmonitor 325528a
moe: bound W4A16 prefill route-reduction scratch
voipmonitor c3723e7
fix(moe): freeze bounded W4A16 prefill dispatch
voipmonitor 52364a1
perf(moe): cast fused prefill output from FP32 scratch
voipmonitor 0c3be37
test(moe): record fused prefill timing evidence
voipmonitor da3fbe3
docs(validation): qualify bounded W4A16 prefill reduction
voipmonitor 450ba32
docs(validation): bind prefill evidence to runtime artifacts
voipmonitor a347a47
docs(validation): pin Kimi prefill evidence
voipmonitor 80b12b8
Merge B12X PR #227: honor inactive routes in native W4A16 microkernels
voipmonitor f25c8bd
Merge B12X PR #238: bound W4A16 prefill route-reduction scratch
voipmonitor 46c84ba
production live tree from issue-75 image (f25c8bd + hotfixes)
3689338
perf(attention): fuse four-query dense MLA verification
myshytf f02909c
feat(mla): balanced split ranges and fp32 partials for sparse-MLA decode
myshytf 242d6ca
perf(mla): GLM generic decode fast path for the per-token entry
myshytf 8299c38
fix(mla): rebind S4 softmax state so serial chunks rescale their accu…
myshytf a2fc62b
feat(mla): packed query records for the GLM generic per-token decode …
myshytf 0edbaef
docs(mla): state the condition behind the S4 return_state contract
myshytf 06f319a
bench(mla): qualify packed Kimi reader precision and head padding
myshytf 5713953
Preserve packed MLA numerical evidence and high-page reproduction
myshytf abc4892
docs: limit packed MLA evidence to reproducible operating state
myshytf fe5d680
docs: distinguish scalar and vector references in packed MLA timings
myshytf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: local-inference-lab/b12x
Length of output: 162
🏁 Script executed:
Repository: local-inference-lab/b12x
Length of output: 50381
🌐 Web query:
NVIDIA PTX ISA red relaxed gpu global add v4 f32 syntax💡 Result:
The instruction
red.relaxed.gpu.global.add.f32is a specialized NVIDIA PTX (Parallel Thread Execution) instruction used to perform an atomic reduction operation on global memory [1][2]. Unlike standardatomoperations, thered(reduction) instruction does not return the previous value of the memory location, which allows the hardware to perform the operation more efficiently by not requiring a round-trip to return data to the issuing thread [1][3]. Syntax and Usage: The general syntax for this instruction in inline assembly is:asm volatile("red.relaxed.gpu.global.add.f32 [%0], %1;" : : "l"(addr), "f"(val) : "memory");[1] Breakdown of the instruction components: -red: The base opcode for an atomic reduction operation [4][2]. -.relaxed: Specifies the memory consistency model. It indicates that the operation has relaxed memory ordering requirements, allowing the hardware flexibility in execution [1][2]. -.gpu: Indicates the scope of the atomic operation, in this case, the GPU-wide global scope [2]. -.global: Specifies the memory state space, which is global memory [4][2]. -.add: Specifies the reduction operation to perform (addition) [1]. -.f32: Specifies the data type of the operation (32-bit floating-point) [1]. -[%0]: The address operand (a pointer to the memory location) [1]. -%1: The value operand (the floating-point value to be added) [1]. This instruction is commonly used in high-performance computing scenarios where multiple threads need to accumulate results into a shared global memory location without the overhead of needing to know the previous value [1][5]. It is widely used in libraries such as CUTLASS and various deep learning frameworks for CUDA-based kernels [1][5].Citations:
🤖 get_repo_knowledge executed:
get_repo_knowledge local-inference-lab/b12x /tmp/coderabbit-repo-knowledge/local-inference-lab-b12x-bd145908/conventionsLength of output: 7095
🌐 Web query:
site:docs.nvidia.com/cuda/parallel-thread-execution "red.relaxed.gpu.global.add.v4.f32"💡 Result:
The identifier red.relaxed.gpu.global.add.v4.f32 is not a recognized instruction or standardized mnemonic in the NVIDIA Parallel Thread Execution (PTX) Instruction Set Architecture (ISA), including the latest versions [1][2][3]. PTX provides a 'red' (Reduction) instruction for performing atomic reduction operations in memory [4][5], and atomics can be performed on global memory using 'atom.global' or 'red.global' [1][6]. The structure of standard PTX instructions generally follows a format such as: opcode{.type}{.sem}{.scope}.address-space.operation d, [a], b; For instance, a floating-point atomic addition in global memory would typically be represented as: atom.global.add.f32 d, [a], b; or red.global.add.f32 [a], b; The terms 'relaxed' and 'v4' appear in the context of recent PTX developments (such as asynchronous operations or multimem instructions) [3][7], but 'red.relaxed.gpu.global.add.v4.f32' does not correspond to a valid PTX instruction string [1][2]. It is possible that this string is a construct from a specific compiler intermediate representation (IR), a custom header file, or an auto-generated internal function name rather than a formal PTX machine instruction.
Citations:
🌐 Web query:
NVIDIA PTX ISA red instruction vector v4 f32 reduction syntax💡 Result:
In the NVIDIA Parallel Thread Execution (PTX) ISA, there is no generic
red.v4.f32instruction for vector-based reductions [1][2]. While theredinstruction is used for performing atomic reduction operations on memory locations (such asred.add.f32,red.max.f32, etc.), it operates on scalar values [3][2]. Vector operations in PTX are generally supported for specific instructions likeld(load),st(store), andmov, which can use.v2or.v4type modifiers to handle multiple elements simultaneously [4][5]. For reduction operations, theredinstruction follows this basic syntax:red.op{.sem}{.scope}{.space}.type [addr], a;[2][6] Where: -opis the reduction operation (e.g.,add,min,max,and,or,xor) [6]. -.typeis the data type of the operation (e.g.,.f32,.f64) [2]. -[addr]is the target memory address. -ais the source register or immediate value used for the reduction. If you are looking to perform reductions on multiple floating-point values, you must typically issue separateredinstructions for each scalar element or utilize higher-level CUDA APIs (such as cooperative groups or atomic functions) that may abstract these operations [3][2]. Note that newer features likemultimem.red[1][3] andred.async[3][2] also focus on memory-level synchronization and reduction rather than vector-register arithmetic.Citations:
🏁 Script executed:
Repository: local-inference-lab/b12x
Length of output: 2448
🏁 Script executed:
Repository: local-inference-lab/b12x
Length of output: 7900
Use valid scalar PTX reductions before merging.
The PTX
redinstruction accepts scalar operands. Bothred.relaxed.gpu.global.v4.f32.addandred.relaxed.gpu.global.add.v4.f32are invalid. Emit four scalar reductions atout_addr,out_addr + 4,out_addr + 8, andout_addr + 12.🤖 Prompt for AI Agents