Fix CUDA EP provider_options and use float masks for fallback layers - #255
Fix CUDA EP provider_options and use float masks for fallback layers#255justinchuby wants to merge 2 commits into
Conversation
justinchuby
commented
May 5, 2026
- Remove CUDA provider_options from EP defaults — explicit options conflict with GenAI's internal session setup, causing NaN. 2. Use float16 additive masks for all fallback Attention layers instead of bool masks (more robust on CUDA). 3. Return empty provider_options list when no options needed.
Two fixes for Gemma4 CUDA EP inference: 1. Remove CUDA provider_options from EP defaults. Explicit CUDA provider_options in genai_config.json conflict with GenAI's internal session setup (ClearOutput, ReuseEmbeddingsBuffer, etc.), causing NaN or crashes for multimodal CUDA models. GenAI's C++ code handles all CUDA EP configuration internally. 2. Use float16 additive masks for all fallback Attention layers (KV-shared and head_dim>256 layers) instead of bool masks. Bool masks triggered NaN in ORT's CUDA ConvertAttnMaskToBias path. Float16 masks match the working default EP model's behavior. Tested: CUDA EP model (12 GQA + 23 Attention) generates at 13.5 tok/s through GenAI with valid output. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Justin Chu <justinchu@microsoft.com>
🏗️ Architecture Diff
No architecture changes detected. ✅ Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed) |
Performance Comparison
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Signed-off-by: Justin Chu <justinchu@microsoft.com>
|
Closing: this PR is superseded by other changes:
Relevant PRs:
|