Conversation
Export trace on a background thread and dispatch the worker RPC with non_block=True, so stop_profile no longer stalls the step loop. Signed-off-by: Elvir Crncevic <elvircrn@gmail.com>
elvircrn
marked this pull request as draft
August 11, 2026 12:19
Executor.profile()/EngineCore.profile()'s non_block=True path returns a Future that only resolves if something else calls .result() on MultiprocExecutor's shared FutureWrapper queue -- nothing does that for a one-off utility call, so it hangs forever in real multi-process runs. Verified this hang against a live opt-125m server; reverting it here. The worker-side fix (backgrounding trace export in wrapper.py) already covers the original problem: verified against the same real model, stop_profile() dropped from 22.6s to 3.5s with no hang. Signed-off-by: Elvir Crncevic <elvircrn@gmail.com>
elvircrn
marked this pull request as ready for review
August 11, 2026 14:24
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
3 tasks
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
Export trace on a background thread instead of inline in
on_trace_ready, since Kineto has already stopped collecting by then. Verified against a real opt-125m server:stop_profile()22.6s -> 3.5s, no correctness regressions.(Earlier revision also made
Executor.profile()dispatch non-blocking viacollective_rpc(non_block=True). Dropped it — the returned Future only resolves if something else calls.result()on it, which nothing does for this call, so it hung under real multiprocessing. Worker-side fix alone already solves the reported slowdown.)Repro
Measured on CPU, opt-125m, gzip'd trace:
stop_profile()= 22.6sstop_profile()= 3.5sTest plan
tests/v1/worker/test_gpu_profiler.pyfacebook/opt-125mon CPU: start_profile -> generate -> stop_profile -> generate, no hang, real trace produced