[Kernel] Share SM70 projection, attention and row reduction paths - #581
Draft
yangzhuxinyzx wants to merge 28 commits into
Draft
Conversation
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Preserve both explicit query tiling and layer residency options. 63 affected CPU checks pass. Record rejected operand probes without changing production kernels. Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Both H3 and other DiT callers use explicit native FP16 attention without model-specific dispatch gates. Twelve GPU interface, non-H3 shape, padding and graph checks pass; 18 affected CPU checks pass. Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Preserve FP32 accumulation and the original K64 online reduction order while eliminating shared probability traffic and cross-warp softmax synchronization. Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
Assisted-by: OpenAI Codex Signed-off-by: yangzhuxinyzx <153831768+yangzhuxinyzx@users.noreply.github.com>
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.
Purpose
H3 repeats projection preparation, LoRA addition and row communication across its dense workflows. This change shares FP16 projection/epilogue and D128 Attention interfaces across original floating and W8A16 weights, adds explicit FlashAttention-V100 query tiling, and exposes calibrated TP4 peer row reduction through native H3 APIs. LoRA keeps unrotated input and adds row-parallel increments before reduction; FP32 accumulation, scaling and rounding protections remain.
Current delivery concentrates on already working dense H3 workflows using retained
FLASH_ATTN_V100, which is already the default H3 backend. Slower experimental replacements are excluded. Further Attention prototypes, FI optimization and new workflow expansion are paused at the user's request. The validated FI implementation remains selectable. Experimental artifacts are not installed or promoted.The peer reduction plan owns IPC buffers, calibrates to native FP32 addition order, respects explicit memory budgets, reuses matching shapes and closes collectively. TP1/TP2 or unsupported/over-budget inputs retain ordinary reduction. Native metrics include actual peer/fallback calls and raw IPC memory. Explicit query128, prepared floating-weight columns, residual sharding and peer reduction remain opt-in; no AUTO configuration is qualified.
This is the existing shared-kernel PR, stacked on #578 (accounting) and #571 (general execution/residency). VSA and caches are separate child PRs #583/#584; this does not duplicate those changes.
Test Plan
Check shared projections/LoRA, independent FP32 Attention operators, non-H3 shapes, tails, aliases and invalid inputs. Validate peer reduction against native collectives and complete native video/audio sampling. Measure useful work over the slowest complete-denoise rank with a full request warmup and three unprofiled requests. Keep official-reference and human quality acceptance separate.
Test Result
Python 3.12.13, Torch 2.10.0+cu128, CUDA 12.8.93, V100 SXM2 32GB. All commit hooks pass. Latest scope/status changes only update documentation; existing benchmark records are not relabeled as new runs.
Matched formal four-step result
TP4, single request, 1280x736 canvas, 120 requested frames aligned to 124, W8A16 Light4 v1.2, native peer reduction and the same pageable host/shared VAE policy. Each backend has one full request warmup and three unprofiled requests.
FA denoise is 4.389750% faster. The full request includes other stages and is slower in these FA measurements; no overall request speedup is claimed. Live allocation upper bound including IPC is 20,475,227,136 bytes/card. Both backends fail the >80 gate. Older pinned-host controls are retained separately and are not used for an isolated overall-request comparison.
Original floating H3 without LoRA also passes complete default sampling (50 sigma points, 49 updates): denoise 725.819030 to 649.973214 seconds, request 835.355602 to 700.121402 seconds, all final latent/RGB/PCM values bitwise. Candidate useful throughput is 57.353041 TFLOP/s/card. These are captured cold controls, not formal repeated performance acceptance, and the combined host/projection/residual changes are not an isolated Attention comparison.
TP4 1344x768/243-frame and 15-second/362-frame runs establish generation/memory compatibility only. VSA full numerical quality fails; cache primary-shape official quality/performance, independent official references, human audiovisual review and the full matrix remain incomplete. Keep Draft; no main/default/AUTO promotion or relaxed quality threshold.
Evidence:
docs/design/minimax_h3/CURRENT_STATUS.md,CAMPAIGN_RESULTS.md,FA_DEVELOPMENT.md,SM70_EPILOGUES.md,SHARED_ATTENTION.md,EXACT_ROW_REDUCTION.md; exact commands, binary/source hashes and results under/data/minimax-h3/sm70-general-20260909/.AI assistance: implemented and initially validated with OpenAI Codex. Human code review and independent validation remain required before promotion.