fix: guard oversized shared memory driver enums with CUDA >= 13.4 - #4377
Conversation
CU_FUNC_ATTRIBUTE_SHARED_MEMORY_MODE, CU_SHARED_MEMORY_MODE_ALLOW_OVERSIZED_SHARED_MEMORY and CU_DEVICE_ATTRIBUTE_MAX_OVERSIZED_SHARED_MEMORY_PER_BLOCK were introduced in CUDA 13.4; CUDA 13.3 only ships the launch-attribute half of the shared-memory-mode API (CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE, CUsharedMemoryMode values 0-2). The `#if CUDA_VERSION >= 13030` guards added in flashinfer-ai#4122 / relanded in flashinfer-ai#4280 therefore break the trtllm-gen fmha_gen JIT build on CUDA 13.3 (the current released toolkit) with fmhaKernels.cuh(136/157/169): error: identifier ... is undefined on any GPU arch, e.g. via trtllm_batch_decode_with_kv_cache_mla on SM100. Bump the three guards to `#if CUDA_VERSION >= 13040`. No CUDA 13.3 fallback is needed: the 13.3 driver does not support the oversized mode, so falling through to the existing MAX_DYNAMIC_SHARED_SIZE_BYTES path is correct. References: - CUDA 13.3 Driver API (symbols absent): https://docs.nvidia.com/cuda/archive/13.3.0/cuda-driver-api/group__CUDA__TYPES.html - CUDA 13.4 developer preview Driver API (symbols present): https://docs.nvidia.com/cuda/developer-preview/13.4/pdf/CUDA_Driver_API.pdf Verified with CUDA 13.3 (nvcc V13.3.73) on SM100: tests/attention/test_trtllm_gen_mla.py::test_trtllm_batch_decode_mla (trtllm-gen backend) fails to build before, passes after. AI-assisted (Claude Code). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan includes up to 8 reviews per rolling hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe FMHA kernel raises oversized shared-memory API guards from CUDA 13.3 to CUDA 13.4 for setup, launch attributes, and device capability queries. ChangesCUDA shared-memory guards
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to The change limits oversized shared-memory driver enums to CUDA 13.4 and preserves the existing path on CUDA 13.3, with no actionable merge-blocking risk remaining beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @yzh119 , could you help take a look at this PR? Thanks. |
|
/bot run tests/attention |
|
[FAILED] Pipeline #63246609 — 15/16 executed test jobs passed Compared with nightly #63077496 (different CI configuration). Unit Tests
✅ Pass · 🟡 Old failure · ❌ New failure · ⏱ Test timeout · Multi-GPU and Multi-Node Tests — 5/6 passed
Failure detailsTimeouts, infrastructure, or incomplete jobs
|
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
@flashinfer-bot run tests/attention |
…ashinfer-ai#4377) flashinfer-ai#4375 CU_FUNC_ATTRIBUTE_SHARED_MEMORY_MODE, CU_SHARED_MEMORY_MODE_ALLOW_OVERSIZED_SHARED_MEMORY and CU_DEVICE_ATTRIBUTE_MAX_OVERSIZED_SHARED_MEMORY_PER_BLOCK were introduced in CUDA 13.4; CUDA 13.3 only ships the launch-attribute half of the shared-memory-mode API (CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE, CUsharedMemoryMode values 0-2). The `#if CUDA_VERSION >= 13030` guards added in flashinfer-ai#4122 / relanded in flashinfer-ai#4280 therefore break the trtllm-gen fmha_gen JIT build on CUDA 13.3 (the current released toolkit) with fmhaKernels.cuh(136/157/169): error: identifier ... is undefined on any GPU arch, e.g. via trtllm_batch_decode_with_kv_cache_mla on SM100. Bump the three guards to `#if CUDA_VERSION >= 13040`. No CUDA 13.3 fallback is needed: the 13.3 driver does not support the oversized mode, so falling through to the existing MAX_DYNAMIC_SHARED_SIZE_BYTES path is correct. References: - CUDA 13.3 Driver API (symbols absent): https://docs.nvidia.com/cuda/archive/13.3.0/cuda-driver-api/group__CUDA__TYPES.html - CUDA 13.4 developer preview Driver API (symbols present): https://docs.nvidia.com/cuda/developer-preview/13.4/pdf/CUDA_Driver_API.pdf Verified with CUDA 13.3 (nvcc V13.3.73) on SM100: tests/attention/test_trtllm_gen_mla.py::test_trtllm_batch_decode_mla (trtllm-gen backend) fails to build before, passes after. <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete. ### ✅ Pre-commit Checks - [ ] I have installed `pre-commit` by running `pip install pre-commit` (or used your preferred method). - [ ] I have installed the hooks with `pre-commit install`. - [ ] I have run the hooks manually with `pre-commit run --all-files` and fixed any reported issues. > If you are unsure about how to set up `pre-commit`, see [the pre-commit documentation](https://pre-commit.com/). ## 🧪 Tests - [ ] Tests have been added or updated as needed. - [ ] All tests are passing (`unittest`, etc.). ## Reviewer Notes <!-- Optional: anything you'd like reviewers to focus on, concerns, etc. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Updated CUDA compatibility checks for oversized shared-memory support. * Ensured related functionality is available only with CUDA 13.4 or newer, improving compatibility with supported CUDA environments. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Jimmy Zhou <79552142+jimmyzho@users.noreply.github.com>
#4375
CU_FUNC_ATTRIBUTE_SHARED_MEMORY_MODE,
CU_SHARED_MEMORY_MODE_ALLOW_OVERSIZED_SHARED_MEMORY and CU_DEVICE_ATTRIBUTE_MAX_OVERSIZED_SHARED_MEMORY_PER_BLOCK were introduced in CUDA 13.4; CUDA 13.3 only ships the launch-attribute half of the shared-memory-mode API (CU_LAUNCH_ATTRIBUTE_SHARED_MEMORY_MODE, CUsharedMemoryMode values 0-2). The
#if CUDA_VERSION >= 13030guards added in #4122 / relanded in #4280 therefore break the trtllm-gen fmha_gen JIT build on CUDA 13.3 (the current released toolkit) withfmhaKernels.cuh(136/157/169): error: identifier ... is undefined
on any GPU arch, e.g. via trtllm_batch_decode_with_kv_cache_mla on SM100.
Bump the three guards to
#if CUDA_VERSION >= 13040. No CUDA 13.3 fallback is needed: the 13.3 driver does not support the oversized mode, so falling through to the existing MAX_DYNAMIC_SHARED_SIZE_BYTES path is correct.References:
Verified with CUDA 13.3 (nvcc V13.3.73) on SM100:
tests/attention/test_trtllm_gen_mla.py::test_trtllm_batch_decode_mla (trtllm-gen backend) fails to build before, passes after.
📌 Description
🔍 Related Issues
🚀 Pull Request Checklist
Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete.
✅ Pre-commit Checks
pre-commitby runningpip install pre-commit(or used your preferred method).pre-commit install.pre-commit run --all-filesand fixed any reported issues.🧪 Tests
unittest, etc.).Reviewer Notes
Summary by CodeRabbit