Skip to content

fix: add cuDNN-only build option that skips the SageAttention-3 shim#367

Open
mvanhorn wants to merge 1 commit into
NVIDIA:mainfrom
mvanhorn:fix/334-sage3-optout-native-build
Open

fix: add cuDNN-only build option that skips the SageAttention-3 shim#367
mvanhorn wants to merge 1 commit into
NVIDIA:mainfrom
mvanhorn:fix/334-sage3-optout-native-build

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Summary

Adds a build-time option to produce a cuDNN-only OmniDreams single-view native extension that skips the SageAttention-3 Blackwell shim. The heavy Sage3 path needs >62 GB in a single cudafe++ invocation even when the manifest selects the cuDNN backend and Sage3 is never used at runtime; the opt-out builds against the existing stubs instead.

Why this matters

Reported in #334. A collaborator confirmed on 2026-07-03 that current main still compiles the Sage3 (and LightVAE FP8) sources unconditionally, and that the right fix is a build-time cuDNN-only / no-Sage3 mode that uses the existing Sage3 stubs and makes sage3_is_built() return false. A ready-made stub translation unit already exists at integrations/omnidreams/omnidreams_singleview/src/dit_streaming/kernels/sage3_attention_stub.cu (it defines sage3_is_built() -> false, sage3_is_runtime_supported() -> false, and TORCH_CHECK(false, ...) bodies for every run_sage3_* entry point), but nothing wired it into the build.

Changes

  • Adds a build flag that swaps sage3_blackwell_api_shim.cu for the existing sage3_attention_stub.cu and drops the CUTLASS sm_120 kernel sources, so a cuDNN-only extension compiles without the >62 GB Sage3 compile. Default behavior (Sage3 built) is unchanged; the flag is opt-in.

Testing

Built the extension with the opt-out flag set and confirmed the Sage3 shim and CUTLASS sm_120 sources are excluded, sage3_is_built() returns false, and the cuDNN attention path runs. Default build still compiles Sage3.

Fixes #334

@copy-pr-bot

copy-pr-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@greptile-apps

greptile-apps Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a cuDNN-only build option for the OmniDreams single-view native extension. The main changes are:

  • New OMNIDREAMS_SINGLEVIEW_DISABLE_SAGE3 environment flag.
  • Conditional source selection that swaps Sage3 kernels for the existing stub.
  • Sage3 build mode included in compiler flags and extension names.
  • Tests for flag parsing, source selection, macro propagation, and name isolation.

Confidence Score: 4/5

The changed build mode needs a cache fix before merging.

  • Source selection and compiler flags line up with the new Sage3-disabled mode.
  • Backend selection avoids Sage3 when the stubbed extension is actually loaded.
  • A process that changes the flag after a successful load can keep using the wrong native binary.

integrations/omnidreams/omnidreams/native/omnidreams_singleview.py

Important Files Changed

Filename Overview
integrations/omnidreams/omnidreams/native/omnidreams_singleview.py Adds the Sage3-disable flag, source swap, macro propagation, and extension-name isolation; the in-process cache can still return a module built for the previous flag value.
integrations/omnidreams/tests/test_omnidreams_singleview_native.py Adds tests for the new build flag and source/name selection behavior.

Reviews (1): Last reviewed commit: "fix: honor sage3 opt-out in native build" | Re-trigger Greptile

@@ -536,6 +551,7 @@ def load_extension(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Sage3 Mode Cache Stays Stale

When the extension has already loaded once, load_extension() returns the module-level _extension before recomputing has_sage3. A process that loads with Sage3 enabled and later sets OMNIDREAMS_SINGLEVIEW_DISABLE_SAGE3=1 still receives the Sage3-enabled binary; loading in the opposite order leaves callers with the stubbed binary after the flag is cleared.

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.

Exclude unused kernels from compilation, when cuDNN backend is selected?

1 participant