fix(write_io): capture complete generate() I/O traces for LLM and VLM models - #1309
Open
talnufai wants to merge 4 commits into
Open
fix(write_io): capture complete generate() I/O traces for LLM and VLM models#1309talnufai wants to merge 4 commits into
talnufai wants to merge 4 commits into
Conversation
- Pass chunk_inputs instead of full padded tensor during prefill
- Use indexed subdirs (prefill_{i}, decode_{n}) to preserve all steps
- Remove self._write_io_dir = None that suppressed subsequent captures
Signed-off-by: talnufai <talnufai@qualcomm.com>
… collision
Two write_io_files gaps in the VLM inference paths:
1. modeling_auto.py (kv_offload_generate): vision_session.run() inputs and
outputs were never captured. Added write_io_files call immediately after
the vision encoder run using subdir "vision_prefill_0".
2. vlm_generation.py (run_prefill_multi_frame_specialization): each per-frame
vision_session.run() was never captured. Added write_io_files call inside
the frame loop using subdir f"vision_prefill_{i}".
Naming: vision encoder subdirs are prefixed "vision_prefill_" to avoid
collision with the lang chunked prefill loop which writes to "prefill_{i}".
Using the same "prefill_{i}" namespace for both sessions would cause the lang
chunk to overwrite the vision .raw files on disk while producing two JSON
entries pointing to the same paths, silently corrupting the captured trace.
Signed-off-by: talnufai <talnufai@qualcomm.com>
…onnx_path indexing Add get_io_dir() helper that appends an EST timestamp to io_dir so each run writes to its own subdirectory. Replace all _write_io_dir assignments with it. Also fix _QEffAutoModelForImageTextToTextDualQPC using self.onnx_path[1] — replace with explicit self.lang_model.onnx_path. Signed-off-by: talnufai <talnufai@qualcomm.com>
quic-rishinr
force-pushed
the
write_io_files
branch
from
September 8, 2026 08:26
9db0167 to
d0b1b0e
Compare
Signed-off-by: talnufai <talnufai@qualcomm.com>
Contributor
Author
|
Hi @quic-rishinr, the Python formatting issue is fixed as you requested |
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
Fix several issues in the
write_io_filescapture flow when using:This PR resolves QRANIUMSW-63509 by:
chunk_inputsduring chunked prefill instead of the full padded inputsio_dirfor eachgenerate()invocation.gitignoreChanges
Correct prefill input capture
Use the same
chunk_inputspassed tosession.run()when writing captured I/O.Preserve all iterations
Store each generation step in a unique file:
Also remove logic that disabled capture after the first decode step.
Capture vision encoder I/O
Add
write_io_filessupport for VLM vision encoder execution paths.Vision captures are stored separately from language captures:
This avoids overwrite/collision with language prefill outputs.
Timestamp output directories
Each
generate()call now writes into a unique timestamped directory:preventing collisions across multiple runs.
Dual-QPC fix
Replace reliance on
self.onnx_path[1]with the explicit language model ONNX path.Example Output
Text-to-Text Model
Vision-Language Model
This demonstrates that vision prefill, language prefill, and all decode iterations are now preserved instead of being overwritten.
Result
With
write_io=True, all inputs and outputs used throughout generation are captured and preserved for both text and vision-language models, including:Validation
Verified on:
Confirmed:
generate()call