Skip to content

[Bugfix][Build] Guard fused GDN decode declaration by its own macro - #112

Draft
lesj0610 wants to merge 2 commits into
mainfrom
lesj/fused-gdn-decode-ops-guard-20260816
Draft

lesj0610 wants to merge 2 commits into
mainfrom
lesj/fused-gdn-decode-ops-guard-20260816

Conversation

@lesj0610

@lesj0610 lesj0610 commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Purpose

fused_gdn_decode_post_conv_mtp is declared inside the VLLM_ENABLE_FUSED_KDA_DECODE block in csrc/libtorch_stable/ops.h, but the op is defined and registered under VLLM_ENABLE_FUSED_GDN_DECODE in csrc/libtorch_stable/torch_bindings.cpp. The build derives those two macros from different architecture lists: KDA decode is compiled for 9.0a;10.0f;12.0f, while GDN decode is also compiled for 8.0;8.6;8.9. A build restricted to those extra architectures — SM80/86 Ampere or SM89 Ada — therefore defines VLLM_ENABLE_FUSED_GDN_DECODE without VLLM_ENABLE_FUSED_KDA_DECODE, and torch_bindings.cpp references a function that was preprocessed away.

This PR moves the declaration into its own VLLM_ENABLE_FUSED_GDN_DECODE block so each declaration is gated by the macro that gates its registration. No functional change on architectures where both macros are defined.

AI assistance: Claude Opus 5 was used during investigation and PR preparation; the submitter reviewed the changes.

Changes

  • Close the VLLM_ENABLE_FUSED_KDA_DECODE block after fused_kda_decode and open a VLLM_ENABLE_FUSED_GDN_DECODE block for fused_gdn_decode_post_conv_mtp in csrc/libtorch_stable/ops.h.

Test Plan

Preprocessor visibility check for every enabled-macro combination the architecture lists can produce (KDA+GDN, GDN only, KDA only; the neither-macro case is not exercised because neither op is registered there). ops.h is preprocessed standalone, with its #include lines stripped since the declarations are what matter, before and after the change:

git show origin/main:csrc/libtorch_stable/ops.h | grep -v '^#include' > /tmp/ops_before.h
grep -v '^#include' csrc/libtorch_stable/ops.h > /tmp/ops_after.h

for v in before after; do
  for macros in \
    "-DVLLM_ENABLE_FUSED_KDA_DECODE=1 -DVLLM_ENABLE_FUSED_GDN_DECODE=1" \
    "-DVLLM_ENABLE_FUSED_GDN_DECODE=1" \
    "-DVLLM_ENABLE_FUSED_KDA_DECODE=1"; do
    gdn=$(gcc -E -P -x c++ $macros /tmp/ops_$v.h | grep -c fused_gdn_decode_post_conv_mtp)
    kda=$(gcc -E -P -x c++ $macros /tmp/ops_$v.h | grep -c "void fused_kda_decode")
    echo "$v | $macros | gdn_decl=$gdn kda_decl=$kda"
  done
done

Guard/registration cross-check:

grep -n "VLLM_ENABLE_FUSED_GDN_DECODE" csrc/libtorch_stable/torch_bindings.cpp
grep -n "FUSED_KDA_DECODE_ARCHS\|FUSED_GDN_DECODE_ARCHS" CMakeLists.txt

git diff --check

End-to-end build in the GDN-only configuration, followed by a symbol check of the produced extension:

TORCH_CUDA_ARCH_LIST=8.0 cmake --preset release
cmake --build --preset release --target install

cuobjdump --list-elf vllm/_C_stable_libtorch.abi3.so | awk '{print $NF}' | sort | uniq -c
strings vllm/_C_stable_libtorch.abi3.so | grep -c "fused_gdn_decode_post_conv_mtp("
strings vllm/_C_stable_libtorch.abi3.so | grep -c "fused_kda_decode("

Test Result

Preprocessor visibility, before the change:

macros defined fused_gdn_decode_post_conv_mtp declared fused_kda_decode declared
KDA + GDN yes yes
GDN only no no
KDA only yes yes

After the change:

macros defined fused_gdn_decode_post_conv_mtp declared fused_kda_decode declared
KDA + GDN yes yes
GDN only yes no
KDA only no yes

The "GDN only" row is the failing configuration: torch_bindings.cpp compiles ops.def("fused_gdn_decode_post_conv_mtp(...)") and ops.impl("fused_gdn_decode_post_conv_mtp", TORCH_BOX(&fused_gdn_decode_post_conv_mtp)) under #ifdef VLLM_ENABLE_FUSED_GDN_DECODE (csrc/libtorch_stable/torch_bindings.cpp:534, :803-804), so the missing declaration is a compile error rather than a silently dropped op.

Guard/registration cross-check:

  • CMakeLists.txt: FUSED_KDA_DECODE_ARCHS intersects 9.0a;10.0f;12.0f, FUSED_GDN_DECODE_ARCHS intersects 8.0;8.6;8.9;9.0a;10.0f;12.0f; each list independently adds VLLM_ENABLE_FUSED_KDA_DECODE=1 / VLLM_ENABLE_FUSED_GDN_DECODE=1 to _C_stable_libtorch.
  • git diff --check: passed.

End-to-end build with TORCH_CUDA_ARCH_LIST=8.0, which is exactly the "GDN only" configuration:

  • cmake --build --preset release --target install completed; _C_stable_libtorch.abi3.so was produced.
  • cuobjdump --list-elf: 59 ELF images, all sm_80, no other architecture.
  • The op schema is present in the binary: fused_gdn_decode_post_conv_mtp(Tensor mixed_qkv, Tensor a, Tensor b, Tensor A_log, Tensor dt_bias, Tensor state_indices, Tensor cu_seqlens, Tensor num_accepted_tokens, Tensor! state, Tensor output_gate, Tensor norm_weight, Tensor! out, float scale, float norm_eps=1e-5) -> ().
  • fused_kda_decode is absent from the binary, as expected for an architecture outside FUSED_KDA_DECODE_ARCHS.

So the configuration that the mismatch breaks now builds and registers the op, with KDA correctly excluded.

Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results.
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

Summary by CodeRabbit

  • Build & Release Improvements
    • Updated ARM64 CUDA 13.0 build and release environments to newer, pinned builder images.
    • Improved consistency across Python wheel, standard, Ubuntu 24.04, and GH200 image builds.
    • Added safeguards for fused decode feature configuration, improving build reliability for supported configurations.

@lesj0610
lesj0610 marked this pull request as draft August 22, 2026 10:21
fused_gdn_decode_post_conv_mtp is declared inside the
VLLM_ENABLE_FUSED_KDA_DECODE block, but the op is registered under
VLLM_ENABLE_FUSED_GDN_DECODE and the build defines the two macros from
separate architecture lists. KDA decode is built for 9.0a/10.0f/12.0f
while GDN decode is also built for 8.0/8.6/8.9, so a build restricted to
SM80/86 Ampere or SM89 Ada enables the GDN macro without the KDA one and
torch_bindings.cpp then references an undeclared function.

Move the declaration into its own VLLM_ENABLE_FUSED_GDN_DECODE block so
each declaration is gated by the macro that gates its registration.

Signed-off-by: lesj0610 <lesj0610@godoiksan.org>
@lesj0610
lesj0610 force-pushed the lesj/fused-gdn-decode-ops-guard-20260816 branch from fec9b46 to f8028c3 Compare August 22, 2026 11:09
@lesj0610

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 29b23976-3639-4b85-b74e-47c967c2d896

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a6582ed6-3a73-430e-8a03-3b1861792ff4

📥 Commits

Reviewing files that changed from the base of the PR and between 040700a and f8028c3.

📒 Files selected for processing (4)
  • .buildkite/image_build/image_build_arm64.sh
  • .buildkite/release-pipeline.yaml
  • .buildkite/scripts/hardware_ci/run-gh200-test.sh
  • csrc/libtorch_stable/ops.h

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The ARM64 CUDA 13.0 build and release paths now use newer pinned PyTorch builder images. The libtorch stable operator declarations now separate fused GDN decode from the fused KDA decode compile guard.

Changes

ARM64 CUDA 13.0 build images

Layer / File(s) Summary
Update ARM64 builder image pins
.buildkite/image_build/image_build_arm64.sh, .buildkite/release-pipeline.yaml, .buildkite/scripts/hardware_ci/run-gh200-test.sh
The ARM64 CUDA 13.0 wheel, release image, standard image, Ubuntu 24.04 image, and GH200 test builds use newer pinned PyTorch builder image digests.

Fused decode compile guards

Layer / File(s) Summary
Separate fused decode guards
csrc/libtorch_stable/ops.h
The fused KDA decode guard is closed before a dedicated fused GDN decode guard protects its declaration.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to f8028

This change corrects declaration visibility for GDN-only builds while keeping KDA excluded where unsupported; the affected configuration builds and registers the expected operation, so no actionable merge-blocking risk remains.

Suggested reviewers: khluu, tjtanaa

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary build fix: guarding the fused GDN decode declaration with its own macro.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3 files. (1 skipped: 1 unsupported.)
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lesj/fused-gdn-decode-ops-guard-20260816

Comment @coderabbitai help to get the list of available commands.

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.

1 participant