fix(engines/base): default use_cuda_graph=False for paged attention continuous batching - #129
Merged
Merged
Conversation
…n continuous batching
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
transformerscontinuous batching defaultsuse_cuda_graph=Truefor flash-attention paths. Whenattn_implementationcontains thepagedmarker (e.g."paged|flash_attention_2"),ModelRunnercaptures a CUDA graph around the model forward, and the paged decode path callsflash_paged._paged_decode_forward→flash_attn_with_kvcache→flash_attn_gpu.fwd_kvcache, which is not capture-safe. It fails withCUDA error: operation not permitted when stream is capturing.This change adds a
__post_init__toBaseEnginePagedBatchingConfigso that whenuse_cuda_graphis not explicitly set andattn_implementationcontains apagedtoken, it defaults to(False, False). Paged Flash Attention still runs, but CUDA graph capture is disabled.This keeps the fix in one place (
Evalution) soGPTQModel/Transformersengine configs always get the safe default, and downstream callers don't need to set it themselves.Version bump
pyproject.toml:0.0.9→0.0.10evalution/version.pyfallback:0.0.9→0.0.10Verification
ruff check evalution/engines/base.pypasses.PYTHON_GIL=0 pytest -q tests/test_transformer.pypasses (62/62).PYTHON_GIL=0 pytest -q tests/test_gptqmodel_engine.py -k "not generate_and_score_on_cuda"passes; the skipped integration test fails becausegptqmodelis not importable underPYTHON_GIL=0in this environment, which is unrelated to this change.gsm8k_platinum_cot(64 samples) on a pre-quantized Llama 3.2 1B GPTQ checkpoint withattn_implementation=paged|flash_attention_2runsbackend=continuous_batching paged_attention=Trueand completes with no CUDA graph-capture error.