Measure CUDA Graph replay on Cua-S1 multimodal language forward - #20
Open
Levius-Fubuki wants to merge 24 commits into
Open
Levius-Fubuki wants to merge 24 commits into
Levius-Fubuki wants to merge 24 commits into
Conversation
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.
Purpose
After request-local image reuse and final-token projection, each Cua-S1 multimodal question still submits the full language forward through eager PyTorch. This PR adds a bounded CUDA Graph experiment and publishes raw evidence, including cases where replay fails the numerical gate. It does not enable Graph replay in the serving worker.
The experiment captures the multimodal language forward after vision features, embeddings and three-dimensional positions have been prepared. It replays through fixed input buffers, checks tensor layout, and compares against the original reused worker. It also changes the image and same-length question text between replays to detect stale inputs. Source is stacked on #18 (and its #12, #15 and #17 dependencies); the new work starts after
c522e00.Results
One RTX 4090, BF16 base with unmerged multimodal LoRA, serial synthetic requests. Three short-instruction cases passed the selected-choice and 0.002 absolute candidate-probability gate. Across two runs of 20 calls per variant and case (240 timed predictions), synchronized
engine.predictp50 changed as follows:The eager variant returned the original worker response exactly. Graph's maximum candidate-probability difference in these cases was 0.000421 on the original inputs. First capture plus three warmups cost 347–416 ms per shape.
Two other cases were rejected before timing: eight distinct questions had a 0.065181 probability difference; a long-instruction case differed by 0.051902 after a same-length text change. Choices happened to remain the same, but this is insufficient for production use. The cause remains to be isolated. These results do not cover the native worker in #19, arbitrary shapes, concurrency or HTTP throughput.
Validation
11831981ae8ea1c414075d563284b40b378a3471a8164c26b9a281986a12bee0.Measured source commit:
809cacc70979b1b4e3a55b8b89be4691d09b0ce4(clean checkout). The subsequent commit publishes evidence only.