Repository navigation
[TRTLLM-18290][refactor] Add opt-in Modeling V2 pipelines for MiniMax-H3 and FastH3 - #22633
Conversation
|
@yunruis, could you help to review this PR as trt-llm-torch-attention-devs? Thanks~ Assignment explanation
Affinity and workload are snapshots at selection, not live counters. Existing reservations on this PR are counted once. |
|
Review comments that did not fit the review summary for
|
|
Review comments that did not fit the review summary for
|
|
Review comments that did not fit the review summary for
|
Signed-off-by: Yiyun Lu <55233584+luyiyun1021@users.noreply.github.com>
Signed-off-by: Yiyun Lu <55233584+luyiyun1021@users.noreply.github.com>
…en migrations Signed-off-by: Yiyun Lu <55233584+luyiyun1021@users.noreply.github.com>
Signed-off-by: Yiyun Lu <55233584+luyiyun1021@users.noreply.github.com>
Signed-off-by: Yiyun Lu <55233584+luyiyun1021@users.noreply.github.com>
Signed-off-by: Yiyun Lu <55233584+luyiyun1021@users.noreply.github.com>
Signed-off-by: Yiyun Lu <55233584+luyiyun1021@users.noreply.github.com>
…ention Signed-off-by: Yiyun Lu <55233584+luyiyun1021@users.noreply.github.com>
…log op Signed-off-by: Yiyun Lu <55233584+luyiyun1021@users.noreply.github.com>
Signed-off-by: Yiyun Lu <55233584+luyiyun1021@users.noreply.github.com>
Signed-off-by: Yiyun Lu <55233584+luyiyun1021@users.noreply.github.com>
Signed-off-by: Yiyun Lu <55233584+luyiyun1021@users.noreply.github.com>
Signed-off-by: Yiyun Lu <55233584+luyiyun1021@users.noreply.github.com>
Keep H3 family imports behind its lazy resolver. Exercise native context parameters through the catalog's numerical tests and remove the mock-only field check. Signed-off-by: Yiyun Lu <55233584+luyiyun1021@users.noreply.github.com>
Signed-off-by: Yiyun Lu <55233584+luyiyun1021@users.noreply.github.com>
Signed-off-by: Yiyun Lu <55233584+luyiyun1021@users.noreply.github.com>
21b5041 to
d05b35d
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #87737 [ run ] triggered by Bot. Commit: |
|
PR_Github #87737 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #87789 [ run ] triggered by Bot. Commit: |
|
PR_Github #87789 [ run ] completed with state |
Description
Add opt-in Modeling V2 pipelines for MiniMax-H3 and FastH3 so checkpoint-specific work can evolve independently. New H3 development belongs in
visual_gen/modeling_v2/models/minimax_h3/. Model-agnostic VisualGen operations live invisual_gen/modeling_v2/catalog/. The VisualGen Modeling V2 guide covers feature ownership, target splits and merges, routing and migration validation. The H3 developer guide shows how to run and test both checkpoints.TLLM_VISUALGEN_MODELING2_H3=1selects V2 through the existing API and CLI. The resolved checkpoint manifest routes base H3 toh3_pipeline/and FastH3 tofasth3/before model construction. Review H3 V1 retirement one week after merge. Use the supported-feature results, representative peak memory and H3 changes merged during the rollout to decide when to remove V1 and the opt-in switch.to_gate_compress) in BF16 under dynamic FP8, block-scaled FP8 and NVFP4. V1 previously copied FP8 codes into the BF16 gate without applying their scales. With NVFP4 it tried to load packed weights of half the expected width. V1 now explicitly marks the gate as unquantized, so the original quantization configuration works without a gate exclusion.visual_gen_libsCMake target. Packed block-FP8 SwiGLU ships inlibth_visual_gen_catalog.so. Native build guideMigration scope. This PR preserves supported H3 behavior and includes fixes needed for matched V1/V2 validation. Workspace retention across shapes (A4), EXIF-aware FL2VA canvas sizing (A5), prefixed Turbo LoRA keys (A6) and per-tensor FP8 descale precision (A65) are tracked as separate follow-up work. Tracking issue #22891
V1 backend dependencies
H3 V2 runs its own transformer, attention layers, weight mapping and pipeline. The rollout registry still imports H3 V1 to register the default. The opted-in path calls no H3 V1 pipeline or V1 Python attention backend
forward. The Python import check records 29 direct provider imports across 12 V2 caller files (7 in 3 H3 files and 22 in 9 catalog files). These include runtime bindings and provider utilities as well as V1 backend symbols. The expandable table lists additional providers reached through catalog ops and native registrations. Shared services such as configuration, device queries, communication and autotuning are checked separately by exact symbol. These are source-level paths, including optional backends.BlackwellFusedMultiHeadAttentionForwardandBlackwellFusedMultiHeadBlockScaledAttentionForward. FMHA helpers supplyMaskEnum.block_sparse_attn_from_indices_cuteand the package exportsCUTE_AVAILABLE.VideoSparseAttentionForwardGroup2QInterleaveKVon explicit block indices. FastH3 chooses blocks and applies the learned gate.visual_gen_sol_predictorandsol_attn.BatchPrefillTSWrapper,VCAttentionConfig, andvc_token_permutation,vc_quantize,vc_quantize_fp8,vc_quantize_repair.BlockSparseTSWrapper,SageAttentionConfig,SageAttentionParams,_validate_int8_qk_device,_validate_block_sparse_static_profile, andsage_quantize, which launches the native Sage quantizer.low_m_gemm_takes_rows,low_m_gemm_dispatcher.max_m_forandper_token_quant_and_transform,unpack_col_major_tma_aligned_packed_tensor.get_enabled_fmha_lib_classes()accessor andFMHA_LIBSmapping.tensorrt_llm.bindings.internal.thop.run_contextdispatches to the compiled FMHA implementation.load_flash_attn_cute_forwardand QuACK usesinstall_cutlass_dsl_compatibilityfrom the existing CuTe utilities.Providers reached through registered ops and the LLM V2 catalog
cuda_scaled_mm,cublas_scaled_mmorcute_dsl_fp8_per_tensor_gemm_rubin. Block FP8 usesfp8_prequantized_swap_ab_gemm,fp8_swap_ab_gemm,fp8_block_scaling_gemm,fp8_block_scale_low_m_gemmandfp8_quantize_1x128.deep_gemm.fp8_gemm_nt. For unquantized inputs the shared runner can use nativefp8_quantize_1x128_packed_ue8m0ortriton_fp8_quantize_1x128. The generic block path reachesfp8_block_scaling_gemm_impl. These kernels implement the scale layout and output allocation expected by the projection.tunable_fp4_quantizeand the LLM V2nvfp4_gemmprovider, orFp4GemmAllreduceRunner.run_gemmfor fused TP reduction.NVFP4GemmUnifiedRunner. The fused runner requires row-TP and MPI. The standard VisualGen worker disables MPI and takes the ordinary path.quantize_e4m3_per_tensor,static_quantize_e4m3_per_tensor,quantize_e4m3_activation,block_scale_interleaveandcalculate_nvfp4_global_scale. LLM V2fp4_quantizeandmxfp8_quantizecall the FP4 and MXFP8 native ops.flashinfer_rmsnormandflashinfer_fused_add_rmsnormreach the shared FlashInfer registrations.ulysses_packed_qkv_post_unscatter,ulysses_post_unscatter_qkvandulysses_a2a_async_prepare,ulysses_a2a_async_push,ulysses_a2a_async_barrier. H3 Linear usesAllReduceand its group-specific native collectives, or PyTorchdist.all_reduceon a text-encoder subgroup.The standalone BF16 CuTe op also names
cute_dsl_bf16_gemm_blackwellandcute_dsl_bf16_gemm_rubin. Its caller in this PR is the op test. Ordinary H3 BF16 projection uses PyTorch or the optional low-M dispatcher. FA4, FlashInfer prefill and cuDNN use external libraries. The packed block-FP8 SwiGLU kernel and H3 fused Q/K norm + RoPE are V2-owned.Test Coverage
Pre-merge exercises catalog and component tests, the one-GPU text-to-video case and a two-GPU Ulysses case. The two end-to-end cases total about 0.19 GPU-hours using recorded schedule estimates. Post-merge adds workflow and parallel combinations, tuned block-FP8 and a single-GPU FastH3 smoke. The native CMake fixture compiles and loads a small shared library on CPU to check wheel scope and registration. The fixed-reference FastH3 tests require the corresponding SM100 reference tensors on the test machine.
On
886938d2bf, all 17 FA4 and H3 dependency checks passed on GB200. Separate processes forced each implementation to initialize FA4 first. CUDA graph replay with eight-way split-KV matched the single-split output and logsumexp in both orders.Opt-in feature coverage
The VisualGen feature matrix lists nine supported features for Base H3 and four for FastH3. The generation table below covers the listed quantization, compilation and parallel modes. The HTTP check covers serving for both checkpoints.
fullgraph=Truematched eager output using the eager compiler backend.Sleep/wake coverage here uses Base H3 with block-FP8 and pinned host backing. Async Ulysses coverage is BF16. The shared multi-instance sleep failure, FastH3 peak memory and any new H3 features merged during the rollout remain on the V1 retirement review.
Final GB200 results for
7e3d6b3b6bThe original GB200 qualification passed 56 targeted unit tests and three released-checkpoint integration cases on this commit. On the later merge with main, all 208 tests in the affected CBTS selection suites passed.
Each V1/V2 pair used the same released checkpoint, request, seed and GB200 GPUs. Each load ran two warmups before timing. The request column gives resolution, sigma points and execution mode. Every video has 124 frames at 24 FPS.
All 22 comparisons below produced byte-identical video and audio (maximum video LPIPS 0 and audio log-STFT 0 in every row). For the four fixed-snapshot rows, both versions prewarmed the caches and each fresh process restored the same snapshot at the same path. Independent cold starts can produce a one-level RGB difference for
u2-vae2-trtllmandfast-cute-bf16-compiled.enc-tp2-u2enc-tp2-u4dit-tp2u2-vae2-vanillau4-vae3-vanillau2-vae2-fa4u2-vae2-trtllmu2-vae2-flashinfertimed-base-bf16timed-base-fp8-blocktimed-async-u2timed-fast-trtllmbase-nvfp4fp8-block-u2-fa4nvfp4-u2-flashinferbase-cute-fp8-attentionfast-cute-bf16-compiledfast-trtllm-fp8-blockfast-cute-nvfp4base-fl2vabase-ref2vabase-cpu-offloadJob-cache rows shared a writable compiler cache within the benchmark job. Fresh-per-load rows used independent empty caches in counterbalanced runs. For
base-nvfp4, the p50s pool equal sample counts from two nodes. The paired latency change ranged from −2.16% to +15.06% across those nodes, so the direction remains inconclusive.PR Checklist
PR description clearly explains what and why.
PR Follows TRT-LLM CODING GUIDELINES.
Test cases are provided for new code paths.
Any new dependencies have been scanned for license and vulnerabilities.
CODEOWNERS updated if ownership changes.
Documentation updated as needed.
Update tava architecture diagram if significant design change.
Please check this after reviewing the above items as appropriate for this PR.