Skip to content

[docs] DGX Spark (GB10) performance & tuning guide + reproduction examples - #1631

Merged
SolitaryThinker merged 5 commits into
hao-ai-lab:mainfrom
Mister-Raggs:docs/spark-device-guide
Aug 6, 2026
Merged

[docs] DGX Spark (GB10) performance & tuning guide + reproduction examples#1631
SolitaryThinker merged 5 commits into
hao-ai-lab:mainfrom
Mister-Raggs:docs/spark-device-guide

Conversation

@Mister-Raggs

Copy link
Copy Markdown
Contributor

Summary

The Spark install guide (installation/spark.md) gets you running on a GB10, but
stops there. This adds the layer above it: which models are practical on the
GB10, what actually makes them faster, and what gives little or nothing on this
unified-memory hardware (and why)
— so users don't spend a night tuning knobs
that can't move here.

New page docs/getting_started/installation/spark_performance.md:

  • Use distilled few-step models (~40 s/video vs 12–47 min full-step); few-step is
    VAE-decode-bound on the ~270 GB/s unified LPDDR5X.
  • A "what helps vs what doesn't" matrix: bf16 VAE decode ✅ (already the Wan
    default), distilled models ✅, VSA ✅ — vs building FlashAttention ❌ (SDPA is
    already flash-efficient on sm_121), torch.compile of the VAE ❌, and
    linear-only quantization ❌ on long-sequence models (attention dominates the
    denoise; linears are a few %). FP4 attention is covered as an opt-in path.
  • A memory section (unified 128 GB pool, nvidia-smi N/A, peak_memory_mb
    as the real per-run figure) and a gotchas section.

New examples under examples/inference/optimizations/:

  • spark_benchmark.py — reproduces the headline claims (few-step median timing +
    fp32-vs-bf16 decode A/B + peak memory), in-process to control for the GB10's
    few-step run-to-run variance.
  • qad_fp4_ab.py — FP4 attention quality/speed A/B on the QAD checkpoint
    (FastVideo/FastWan-QAD-1.3B), one arm per process.

Plus cross-links from installation.md, spark.md, and a note at the top of
inference/optimizations.md.

Test evidence — all numbers measured on a DGX Spark (GB10)

Environment: GB10 (cc 12.1), torch 2.12.0+cu130, transformers 5.14.0, CUDA 13.

Claim Measured
FastWan2.1-1.3B, 3-step ~40 s/video, decode the largest stage
distilled vs full-step (same arch) ~18×
bf16 VAE decode vs fp32 1.14× faster, MS-SSIM 0.9999 (lossless), on the identical latent
FP4 attention (opt-in) −6% denoise (40.87 s → 38.45 s), visually equivalent to bf16
Wan2.1-1.3B few-step peak memory ~8.4 GB (of the 128 GB pool)

Every number in the guide is one of these measured values (no estimates carried
over). Sample stills from the FP4-attention A/B (bf16 vs FP4) are visually
equivalent; I'll attach them to the PR.

Depends on (merge order)

This PR is written assuming two other Spark PRs are on main, and should merge
after both:

Both PRs also touch installation/spark.md / inference/optimizations.md, in
different sections from this one — landing them first avoids a both-touched merge.

Related (not duplicated)

Copilot AI review requested due to automatic review settings July 21, 2026 20:46
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mergify mergify Bot added type: docs Documentation only scope: inference Inference pipeline, serving, CLI scope: docs Documentation labels Jul 21, 2026
@mergify

mergify Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 1 of 1 protections blocking · waiting on 👀 reviews and 🤖 CI

Protection Waiting on
🔴 PR merge requirements 👀 reviews and 🤖 CI

🔴 PR merge requirements

Waiting for

  • #approved-reviews-by>=1
  • check-success=fastcheck-passed
  • check-success=full-suite-passed
  • check-success~=pre-commit
This rule is failing.
  • #approved-reviews-by>=1
  • check-success=fastcheck-passed
  • check-success=full-suite-passed
  • check-success~=pre-commit
  • title~=(?i)^\[(feat|feature|bugfix|fix|refactor|perf|ci|doc|docs|misc|chore|kernel|new.?model|skill|skills|infra)\]

@mergify

mergify Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Pre-commit checks failed

Hi @Mister-Raggs, the pre-commit checks have failed. To fix them locally:

# Install pre-commit if you haven't already
uv pip install pre-commit
pre-commit install

# Run all checks and auto-fix what's possible
pre-commit run --all-files

Common fixes:

  • yapf: yapf -i <file> (formatting)
  • ruff: ruff check --fix <file> (linting)
  • codespell: codespell --write-changes <file> (spelling)

After fixing, commit and push the changes. The checks will re-run automatically.

For future commits, pre-commit will run automatically on changed files before each commit.

Mister-Raggs and others added 5 commits August 6, 2026 13:16
…mples

Add a performance/tuning guide for the DGX Spark that picks up where the
install guide leaves off: which models are practical on the GB10, what
actually makes them faster (distilled few-step models, bf16 VAE decode), and
what gives little or nothing on this unified-memory hardware (building
FlashAttention, torch.compile of the VAE, linear quantization on
long-sequence models) with the reasons why.

- docs/getting_started/installation/spark_performance.md: new guide, incl. a
  "what helps vs what doesn't" matrix and the opt-in FP4 attention path.
- examples/inference/optimizations/spark_benchmark.py: reproduces the headline
  claims (few-step median timing + fp32-vs-bf16 decode A/B), in-process.
- examples/inference/optimizations/qad_fp4_ab.py: FP4 attention quality/speed
  A/B on the QAD checkpoint (one arm per process).
- Cross-links from installation.md, spark.md, and optimizations.md.
…he benchmark

- spark_performance.md: "Memory: one unified 128 GB pool" section (nvidia-smi
  N/A, torch reserved as the real footprint, decode buffers as the pressure) and
  a GB10-specific "Gotchas" section.
- spark_benchmark.py: report peak GPU memory (torch reserved) + unified pool
  free/total alongside the timing.
Verified on a DGX Spark (GB10, torch 2.12.0+cu130, transformers 5.14.0):
- few-step FastWan gen ~40 s (was ~30 s); ~18x vs full-step
- bf16 VAE decode 1.14x, MS-SSIM 0.9999 (was ~1.2-1.3x); ~5-7% e2e
- Wan2.1-1.3B few-step peaks at ~8.4 GB (measured via pipeline peak_memory_mb)
- spark_benchmark.py reads peak_memory_mb from the result (worker-measured)
  instead of the main-process torch allocator (which reads ~0)
… around code blocks)

Reword the "weights + activations + KV" line so the wrapped "+ KV" isn't
misread as a list marker (the auto-fix would corrupt it to "- KV"), and add
the blank lines PyMarkdown wants around a fenced code block.
generate_video returns a plain dict, so getattr(result, ...) always hit the
fallback: generation_time silently became wall time and peak_memory_mb was
always None. Use dict access.

Label the measured metric honestly: generation_time is the full pipeline
(text-encode + denoise + decode), not denoise. Also: the sm_121 runtime
allowlist landed via hao-ai-lab#1647; hao-ai-lab#1598 is the remaining kernel build.
@SolitaryThinker
SolitaryThinker force-pushed the docs/spark-device-guide branch from d32de9a to f85778d Compare August 6, 2026 21:22
@SolitaryThinker

Copy link
Copy Markdown
Collaborator

Pushed two maintainer commits to this branch: a rebase onto current main and a small fix commit.

Verified the docs' checkable claims and the scripts compile; GPU numbers in the guide are yours to re-confirm with the fixed timing since generation_time may shift them slightly.

@SolitaryThinker
SolitaryThinker merged commit a2bfc7c into hao-ai-lab:main Aug 6, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: docs Documentation scope: inference Inference pipeline, serving, CLI type: docs Documentation only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants