Skip to content

Update FBGEMM for Blackwell HSTU attention - #431

Merged
shijieliu merged 8 commits into
NVIDIA:mainfrom
JacoCheung:junzhang/hstu_attn_blackwell_opt
Jul 10, 2026
Merged

shijieliu merged 8 commits into
NVIDIA:mainfrom
JacoCheung:junzhang/hstu_attn_blackwell_opt

Conversation

@JacoCheung

@JacoCheung JacoCheung commented Jul 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • update third_party/FBGEMM to recsys-examples-v26.06
  • rebase the recsys FBGEMM patch stack from recsys-examples-v26.05 onto jiayus-nvidia/FBGEMM:dev (excluding 9da5a6 because of extra output contiguous())

Testing

  • not run; submodule pointer update only

@JacoCheung

Copy link
Copy Markdown
Collaborator Author

/build devel

@greptile-apps

greptile-apps Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR updates the third_party/FBGEMM submodule pointer to a new commit for Blackwell HSTU attention support, switches the tracked branch in .gitmodules from the versioned recsys-examples-v26.05 to the mutable recsys-examples-dev, and substantially refactors the HSTU attention kernel benchmark tooling.

  • Benchmark refactoring: hstu_attn_kernel_benchmark.py now saves results as JSON (decoupled from plotting), adds per-iteration CUDA event timing with configurable percentiles (P1/P10/P20/P50/P100), CUDA-graph support, and profiler start/stop control; a new plot_hstu_attn_kernel_heatmap.py script reads the JSON and produces heatmaps.
  • NVTX toggle: nvtx_op.py gains a process-level _NVTX_HOOKS_ENABLED flag (defaulting to the ENABLE_NVTX_HOOKS env var) so NVTX ranges can be disabled at runtime without removing hook registrations.
  • Dependency pin: quack-kernels gains an upper bound (<0.5) in the Dockerfile to guard against breaking API changes in 0.5.x.

Confidence Score: 5/5

Safe to merge — the submodule SHA is pinned so builds are deterministic, and the benchmark refactoring is self-contained tooling with no impact on training or inference paths.

All changes are in benchmark tooling and infrastructure: the FBGEMM submodule pointer is updated to a specific commit, the benchmark script is refactored to decouple timing from plotting, and the NVTX toggle is additive. No training or inference code is modified.

.gitmodules — the branch now tracks recsys-examples-dev rather than a versioned release branch, which is worth revisiting once a stable v26.06 branch is available.

Important Files Changed

Filename Overview
.gitmodules Branch changed from versioned recsys-examples-v26.05 to mutable recsys-examples-dev; submodule SHA is pinned so builds are reproducible, but git submodule update --remote would now follow the dev branch.
third_party/FBGEMM Submodule pointer advanced from 9fd4440 to 647f0f5; change is intentional and the commit is pinned.
docker/Dockerfile Adds <0.5 upper bound to quack-kernels to prevent unintentional upgrades to a potentially incompatible major version.
examples/commons/utils/nvtx_op.py Adds process-level _NVTX_HOOKS_ENABLED toggle (env-var controlled) and gates all hook functions on it; logic is correct and the short-circuit in output_nvtx_hook avoids creating placeholder tensors when disabled.
examples/hstu/training/benchmark/scripts/hstu_attn_kernel_benchmark.py Major refactor: per-iter CUDA event timing, percentile-based TFLOPS/MFU, CUDA graph capture, and JSON output. Contains one dead expression (net.scaling_seqlen) whose value is silently discarded.
examples/hstu/training/benchmark/scripts/plot_hstu_attn_kernel_heatmap.py New standalone plotting script; reads JSON produced by the benchmark, validates metadata consistency across runs, and renders TFLOPS/MFU/time heatmaps with correct NaN masking and colorbar usage.
examples/hstu/training/benchmark/README.md Documentation updated to reflect the two-step benchmark → plot workflow, P10-based timing rationale, and new GB200/H100 result figures.
examples/hstu/training/benchmark/blackwell_fixed2048_exp45.txt Deleted Blackwell-specific experiment config; experiments are presumably subsumed by the updated benchmark framework.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant User
    participant benchmark as hstu_attn_kernel_benchmark.py
    participant attn as HSTUAttention (FBGEMM/CUTLASS)
    participant events as CUDA Events
    participant json as JSON output

    User->>benchmark: python hstu_attn_kernel_benchmark.py --timing-mode per-iter --cuda-graph
    benchmark->>attn: create_hstu_attention(kernel_backend, num_heads, ...)
    loop warmup_iters
        benchmark->>attn: attn_fn(tq, tk, tv, offsets, seqlen, seqlen)
    end
    loop phases (fwd / bwd / e2e)
        benchmark->>events: _make_cuda_events(bench_iters)
        benchmark->>attn: capture CUDA graph
        loop bench_iters
            benchmark->>events: record start
            benchmark->>attn: graph.replay()
            benchmark->>events: record end
        end
        benchmark->>events: synchronize → compute percentiles (P1/P10/P20/P50/P100)
    end
    benchmark->>json: dump results (TFLOPS, MFU, time percentiles)
    User->>benchmark: plot_hstu_attn_kernel_heatmap.py --output-dir ...
    benchmark->>json: load and validate runs
    benchmark->>User: PNG heatmap (TFLOPS / MFU / ms per cell)
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant User
    participant benchmark as hstu_attn_kernel_benchmark.py
    participant attn as HSTUAttention (FBGEMM/CUTLASS)
    participant events as CUDA Events
    participant json as JSON output

    User->>benchmark: python hstu_attn_kernel_benchmark.py --timing-mode per-iter --cuda-graph
    benchmark->>attn: create_hstu_attention(kernel_backend, num_heads, ...)
    loop warmup_iters
        benchmark->>attn: attn_fn(tq, tk, tv, offsets, seqlen, seqlen)
    end
    loop phases (fwd / bwd / e2e)
        benchmark->>events: _make_cuda_events(bench_iters)
        benchmark->>attn: capture CUDA graph
        loop bench_iters
            benchmark->>events: record start
            benchmark->>attn: graph.replay()
            benchmark->>events: record end
        end
        benchmark->>events: synchronize → compute percentiles (P1/P10/P20/P50/P100)
    end
    benchmark->>json: dump results (TFLOPS, MFU, time percentiles)
    User->>benchmark: plot_hstu_attn_kernel_heatmap.py --output-dir ...
    benchmark->>json: load and validate runs
    benchmark->>User: PNG heatmap (TFLOPS / MFU / ms per cell)
Loading

Reviews (11): Last reviewed commit: "Add HSTU attention benchmark heatmaps" | Re-trigger Greptile

@JacoCheung

JacoCheung commented Jul 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

❌ Pipeline #56593317 -- failed

Job Status Log
build_devel_x86 ✅ success view
build_devel_arm64 ✅ success view
build_tritonserver_devel_x86 ❌ failed view
build_tritonserver_devel_arm64 ✅ success view
manifest_devel ❌ failed view
manifest_tritonserver_devel ⏩ skipped view
pre_check ❌ failed view
train_build_x86 ⏩ skipped view
train_build_arm64 ⏩ skipped view
tritonserver_build_x86 ❌ failed view
prepare-jet-b200-smoke ⏩ skipped view
prepare-jet-b200-inference ⏩ skipped view
prepare-jet-cw-dfw-e2e-benchmark ⏩ skipped view
build_whl ⏩ skipped view
dynamicemb_test_fwd_bwd_8gpus ⏩ skipped view
dynamicemb_test_load_dump_8gpus ⏩ skipped view
unit_test_1gpu_a100 ⏩ skipped view
unit_test_1gpu_h100 ⏩ skipped view
unit_test_4gpu ⏩ skipped view
unit_test_tp_4gpu ⏩ skipped view
L20_unit_test_1gpu ⏩ skipped view
inference_unit_test_1gpu ⏩ skipped view
inference_test_1gpu ⏩ skipped view

Result: 3/7 jobs passed

View full pipeline

@JacoCheung

Copy link
Copy Markdown
Collaborator Author

/build devel

@JacoCheung

JacoCheung commented Jul 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

❌ Pipeline #56703625 -- failed

Job Status Log
build_devel_x86 ✅ success view
build_devel_arm64 ✅ success view
build_tritonserver_devel_x86 ✅ success view
build_tritonserver_devel_arm64 ✅ success view
manifest_devel ✅ success view
manifest_tritonserver_devel ✅ success view
pre_check ❌ failed view
train_build_x86 ✅ success view
train_build_arm64 ✅ success view
tritonserver_build_x86 ✅ success view
prepare-jet-b200-smoke ✅ success view
prepare-jet-b200-inference ✅ success view
prepare-jet-cw-dfw-e2e-benchmark ✅ success view
build_whl ✅ success view
dynamicemb_test_fwd_bwd_8gpus ✅ success view
dynamicemb_test_load_dump_8gpus ✅ success view
unit_test_1gpu_a100 ❌ failed view
unit_test_1gpu_h100 ❌ failed view
unit_test_4gpu ❌ failed view
unit_test_tp_4gpu ❌ failed view
L20_unit_test_1gpu ✅ success view
inference_unit_test_1gpu ✅ success view
inference_test_1gpu ❌ failed view

Result: 17/23 jobs passed

View full pipeline

@JacoCheung
JacoCheung force-pushed the junzhang/hstu_attn_blackwell_opt branch from 966fc0a to a8abac1 Compare July 3, 2026 08:01
@JacoCheung

Copy link
Copy Markdown
Collaborator Author

/build devel

@JacoCheung

JacoCheung commented Jul 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

❌ Pipeline #56709019 -- failed

Job Status Log
build_devel_x86 ✅ success view
build_devel_arm64 ✅ success view
build_tritonserver_devel_x86 ✅ success view
build_tritonserver_devel_arm64 ✅ success view
manifest_devel ❌ failed view
manifest_tritonserver_devel ✅ success view
pre_check ❌ failed view
train_build_x86 ⏩ skipped view
train_build_arm64 ⏩ skipped view
tritonserver_build_x86 ✅ success view
prepare-jet-b200-smoke ⏩ skipped view
prepare-jet-b200-inference ⏩ skipped view
prepare-jet-cw-dfw-e2e-benchmark ⏩ skipped view
build_whl ⏩ skipped view
dynamicemb_test_fwd_bwd_8gpus ⏩ skipped view
dynamicemb_test_load_dump_8gpus ⏩ skipped view
unit_test_1gpu_a100 ⏩ skipped view
unit_test_1gpu_h100 ⏩ skipped view
unit_test_4gpu ⏩ skipped view
unit_test_tp_4gpu ⏩ skipped view
L20_unit_test_1gpu ⏩ skipped view
inference_unit_test_1gpu ⏩ skipped view
inference_test_1gpu ⏩ skipped view

Result: 6/8 jobs passed

View full pipeline

@JacoCheung

JacoCheung commented Jul 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

❌ Pipeline #56709603 -- failed

Job Status Log
build_devel_x86 ✅ success view
build_devel_arm64 ✅ success view
build_tritonserver_devel_x86 ✅ success view
build_tritonserver_devel_arm64 ✅ success view
manifest_devel ✅ success view
manifest_tritonserver_devel ✅ success view
pre_check ❌ failed view
train_build_x86 ✅ success view
train_build_arm64 ✅ success view
tritonserver_build_x86 ✅ success view
prepare-jet-b200-smoke ✅ success view
prepare-jet-b200-inference ✅ success view
prepare-jet-cw-dfw-e2e-benchmark ✅ success view
build_whl ✅ success view
dynamicemb_test_fwd_bwd_8gpus ✅ success view
dynamicemb_test_load_dump_8gpus ✅ success view
unit_test_1gpu_a100 ❌ failed view
unit_test_1gpu_h100 ❌ failed view
unit_test_4gpu ❌ failed view
unit_test_tp_4gpu ❌ failed view
L20_unit_test_1gpu ✅ success view
inference_unit_test_1gpu ✅ success view
inference_test_1gpu ❌ failed view

Result: 17/23 jobs passed

View full pipeline

@JacoCheung

Copy link
Copy Markdown
Collaborator Author

/build devel

@JacoCheung

JacoCheung commented Jul 6, 2026 •

Copy link
Copy Markdown
Collaborator Author

❌ Pipeline #56933477 -- failed

Job Status Log
build_devel_x86 ✅ success view
build_devel_arm64 ✅ success view
build_tritonserver_devel_x86 ✅ success view
build_tritonserver_devel_arm64 ✅ success view
manifest_devel ✅ success view
manifest_tritonserver_devel ❌ failed view
pre_check ❌ failed view
train_build_x86 ✅ success view
train_build_arm64 ✅ success view
tritonserver_build_x86 ❌ failed view
prepare-jet-b200-smoke ✅ success view
prepare-jet-b200-inference ✅ success view
prepare-jet-cw-dfw-e2e-benchmark ✅ success view
build_whl ✅ success view
dynamicemb_test_fwd_bwd_8gpus ✅ success view
dynamicemb_test_load_dump_8gpus ✅ success view
unit_test_1gpu_a100 ✅ success view
unit_test_1gpu_h100 ❌ failed view
unit_test_4gpu ✅ success view
unit_test_tp_4gpu ❌ failed view
L20_unit_test_1gpu ✅ success view
inference_unit_test_1gpu ✅ success view
inference_test_1gpu ⏩ skipped view

Result: 17/22 jobs passed

View full pipeline

@JacoCheung

Copy link
Copy Markdown
Collaborator Author

/build devel

@JacoCheung

JacoCheung commented Jul 6, 2026 •

Copy link
Copy Markdown
Collaborator Author

❌ Pipeline #56950530 -- failed

Job Status Log
build_devel_x86 ✅ success view
build_devel_arm64 ✅ success view
build_tritonserver_devel_x86 ✅ success view
build_tritonserver_devel_arm64 ✅ success view
manifest_devel ✅ success view
manifest_tritonserver_devel ✅ success view
pre_check ❌ failed view
train_build_x86 ✅ success view
train_build_arm64 ✅ success view
tritonserver_build_x86 ✅ success view
prepare-jet-b200-smoke ✅ success view
prepare-jet-b200-inference ✅ success view
prepare-jet-cw-dfw-e2e-benchmark ✅ success view
build_whl ✅ success view
dynamicemb_test_fwd_bwd_8gpus ✅ success view
dynamicemb_test_load_dump_8gpus ✅ success view
unit_test_1gpu_a100 ❌ failed view
unit_test_1gpu_h100 ❌ failed view
unit_test_4gpu ✅ success view
unit_test_tp_4gpu ❌ failed view
L20_unit_test_1gpu ❌ failed view
inference_unit_test_1gpu ✅ success view
inference_test_1gpu ❌ failed view

Result: 17/23 jobs passed

View full pipeline

@JacoCheung
JacoCheung force-pushed the junzhang/hstu_attn_blackwell_opt branch from 4cb259c to f53db8c Compare July 7, 2026 06:05
@JacoCheung

Copy link
Copy Markdown
Collaborator Author

/build devel

1 similar comment
@JacoCheung

Copy link
Copy Markdown
Collaborator Author

/build devel

@JacoCheung

JacoCheung commented Jul 8, 2026 •

Copy link
Copy Markdown
Collaborator Author

❌ Pipeline #57211389 -- failed

Job Status Log
build_devel_x86 ✅ success view
build_devel_arm64 ✅ success view
build_tritonserver_devel_x86 ✅ success view
build_tritonserver_devel_arm64 ✅ success view
manifest_devel ✅ success view
manifest_tritonserver_devel ✅ success view
pre_check ❌ failed view
train_build_x86 ✅ success view
train_build_arm64 ✅ success view
tritonserver_build_x86 ✅ success view
prepare-jet-b200-smoke ✅ success view
prepare-jet-b200-inference ✅ success view
prepare-jet-cw-dfw-e2e-benchmark ✅ success view
build_whl ✅ success view
dynamicemb_test_fwd_bwd_8gpus ✅ success view
dynamicemb_test_load_dump_8gpus ✅ success view
unit_test_1gpu_a100 ✅ success view
unit_test_1gpu_h100 ✅ success view
unit_test_4gpu ✅ success view
unit_test_tp_4gpu ❌ failed view
L20_unit_test_1gpu ✅ success view
inference_unit_test_1gpu ✅ success view
inference_test_1gpu ❌ failed view

Result: 20/23 jobs passed

View full pipeline

@JacoCheung
JacoCheung requested a review from shijieliu July 8, 2026 14:42
@JacoCheung

Copy link
Copy Markdown
Collaborator Author

/build devel

@JacoCheung

JacoCheung commented Jul 9, 2026 •

Copy link
Copy Markdown
Collaborator Author

❌ Pipeline #57344935 -- failed

Job Status Log
build_devel_x86 ✅ success view
build_devel_arm64 ✅ success view
build_tritonserver_devel_x86 ✅ success view
build_tritonserver_devel_arm64 ✅ success view
manifest_devel ✅ success view
manifest_tritonserver_devel ✅ success view
pre_check ❌ failed view
train_build_x86 ✅ success view
train_build_arm64 ✅ success view
tritonserver_build_x86 ✅ success view
prepare-jet-b200-smoke ✅ success view
prepare-jet-b200-inference ✅ success view
prepare-jet-cw-dfw-e2e-benchmark ✅ success view
build_whl ✅ success view
dynamicemb_test_fwd_bwd_8gpus ✅ success view
dynamicemb_test_load_dump_8gpus ✅ success view
unit_test_1gpu_a100 ✅ success view
unit_test_1gpu_h100 ✅ success view
unit_test_4gpu ✅ success view
unit_test_tp_4gpu ❌ failed view
L20_unit_test_1gpu ✅ success view
inference_unit_test_1gpu ✅ success view
inference_test_1gpu ❌ failed view

Result: 20/23 jobs passed

View full pipeline

@JacoCheung
JacoCheung force-pushed the junzhang/hstu_attn_blackwell_opt branch from 01b56d7 to 5eb9f4f Compare July 9, 2026 13:38
@JacoCheung
JacoCheung force-pushed the junzhang/hstu_attn_blackwell_opt branch from 5eb9f4f to 50400f7 Compare July 9, 2026 13:55
@shijieliu
shijieliu merged commit a8781db into NVIDIA:main Jul 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants