This repository was archived by the owner on Sep 30, 2026. It is now read-only.
Repository navigation
Conversation
**Problem** Kineto's PyTorch-build CI jobs hit the 180-minute timeout. Two phases dominate the run. Installing cmake takes ~62 minutes because setup.sh adds the conda-forge channel with strict priority, which forces conda's classic solver to re-solve the entire base environment onto conda-forge. The PyTorch build then recompiles all ~8k objects from scratch on every run because no compiler cache is configured. **Fix** Install cmake from PyPI instead of conda. The cmake wheel ships a prebuilt binary and installs in seconds, and this removes conda from the critical path for all nine workflows that source setup.sh. Enable sccache backed by PyTorch's S3 cache for the PyTorch build. Most Kineto PRs touch only Kineto, so the bulk of PyTorch's objects become cache hits on warm runs. PyTorch's CMake picks up the CMAKE_*_COMPILER_LAUNCHER vars, so we only install the binary and point it at S3; credentials come from the runner's AWS instance role. The binary is selected by host architecture, and an unrecognized arch builds uncached rather than failing. A sccache --show-stats after the build makes cache behavior visible.
**Problem** The ROCm and XPU PyTorch-build jobs fail at cmake configure. The sccache change routed every compile through sccache via CMAKE_*_COMPILER_LAUNCHER, but the ROCm and XPU runners are not AWS instances and have no credentials for the S3 cache bucket. sccache then errors on cmake's compiler-probe compile, which cmake reports as a broken compiler and aborts the build. Because the launchers were exported even when the cache was unreachable, the failure was fatal instead of degrading to an uncached build. **Fix** Reachability of the S3 cache is a property of the runner, so move that decision into the per-architecture config files: the AWS-hosted cpu and cuda runners opt in with KINETO_USE_SCCACHE=1, and the off-AWS rocm and xpu runners opt out with 0. pytorch_build_test.sh installs and enables sccache only when the active config opts in, and sets the compiler launchers only if the sccache server actually starts, so a cache problem now degrades to an uncached build rather than breaking it.
**Problem** The PyTorch-build jobs clone PyTorch into the Kineto checkout (KINETO_DIR/pytorch) and then symlink PyTorch's third_party/kineto back to KINETO_DIR. Because the symlink target contains the clone, the tree forms an endless path cycle (third_party/kineto/pytorch/third_party/kineto/pytorch/...). setuptools follows it while collecting license files during the editable-wheel build, emitting thousands of ever-deepening paths and burning several minutes per run. It does not error, so it went unnoticed until sccache made the compile fast enough for the walk to dominate. **Fix** Clone PyTorch as a sibling of the Kineto checkout instead of inside it, so the third_party/kineto symlink no longer points at a directory that contains the clone and the cycle cannot form. The build still runs inside the cloned tree, so relative paths are unchanged.
**Problem** The CUDA PyTorch-build job times out at the 180-minute limit. A single test, TestExperimentalUtils::test_profiler_conv2d_bias_followed_by_batchnorm2d_pattern, hangs for the final ~87 minutes with no output until the job is cancelled. It profiles with stacks enabled and runs pattern matching, exercising stack symbolization, which appears to hang on these runners (its sibling test_fuzz_symbolize is already deselected for the same area). Nothing bounds an individual test, so one hang consumes the entire job budget. **Fix** Run the profiler suite under pytest-timeout with a per-test limit. A hang now fails that single test in five minutes, with a stack dump at the hang point, instead of burning the whole timeout. The thread method is required because the hang holds the GIL in native code, which the signal method cannot interrupt.
**Problem** The per-test timeout used pytest-timeout's thread method, which runs a watchdog thread for every test. The profiler captures Python calls on all live threads, so that watchdog thread appears in the trace and inflates the distinct-thread counts that the test_source_multithreaded tests assert on, failing all seven with an off-by-one (expected N, got N+1). **Fix** Switch to the signal method, which uses SIGALRM and adds no thread, so the thread-counting tests pass again. The known tradeoff is that signal cannot interrupt a hang that holds the GIL in native code (the CUDA symbolization hang), so such a hang still rides the job timeout; that gap is left for a follow-up.
**Problem** PyTorch pull request 182434 added a device-generic TestProfilerDevice suite via instantiate_device_type_tests. Its CUDA instances do not work on our GPU runners: every one errors during setup, on ROCm/HIP one also asserts a CUDA-specific event count that HIP does not produce, and its forked_process test deadlocks once a GPU runtime is initialized in the process. Because the job pins viable/strict, this upstream test breakage fails the CUDA and ROCm jobs even though Kineto itself is fine. **Fix** Deselect the TestProfilerDeviceCUDA class and the forked_process CPU test in the CUDA and ROCm configs. The class node ID covers the whole erroring set because pytest matches --deselect by node-ID prefix. The CPU-only and XPU configs are left alone: they either do not build the CUDA device tests or do not exhibit the fork deadlock. These remain until upstream fixes the suite.
**Problem** On the CUDA runner the profiler captures no GPU kernel events at runtime even though CUPTI is compiled in (the build logs Found CUPTI / HAS_CUPTI). Every test that inspects kernel activity in the trace therefore fails. Four of these are the TestMetadataJsonFormat kernel-metadata tests, which fail with 'No kernel activity found in trace'. The same root cause also explains several already-deselected TestProfilerDeviceCUDA failures. The tests pass on ROCm, so this is specific to the CUDA runner's CUPTI runtime, not a Kineto change. **Fix** Deselect the four TestMetadataJsonFormat tests in the CUDA config. Listed individually rather than by class so the known-failing set is explicit and easy to re-enable once GPU event capture works on the runner. Left out of the other configs, where these tests pass.
|
@scotts has imported this pull request. If you are a Meta employee, you can view this in D108136613. |
scotts
marked this pull request as ready for review
June 10, 2026 12:58
ryanzhang22
reviewed
Jun 10, 2026
| test/profiler/test_profiler.py::TestExperimentalUtils::test_fuzz_symbolize | ||
|
|
||
| # https://github.com/pytorch/kineto/issues/1429 | ||
| test/profiler/test_profiler.py::TestProfilerDeviceCUDA |
Contributor
There was a problem hiding this comment.
weird... seems like this should've been automatically deselected for rocm tests
Contributor
Author
There was a problem hiding this comment.
I believe these get HIPified, so the CUDA tests are also ROCm tests.
ryanzhang22
reviewed
Jun 10, 2026
| git clone --recursive --branch viable/strict https://github.com/pytorch/pytorch.git | ||
| # Clone PyTorch as a sibling of the Kineto checkout, never inside it. Below we | ||
| # replace PyTorch's third_party/kineto with a symlink back to KINETO_DIR. If the | ||
| # PyTorch tree lived inside KINETO_DIR, that symlink would point at a directory |
Contributor
There was a problem hiding this comment.
small nit: missing "If"
Contributor
Author
There was a problem hiding this comment.
Hmm. I'm not sure what you mean?
Contributor
There was a problem hiding this comment.
"If" PyTorch tree lived inside KINETO_DIR, that symlink would point at a directory...
Contributor
Author
There was a problem hiding this comment.
It's there, on the line above. :)
ryanzhang22
approved these changes
Jun 10, 2026
scotts
added a commit
to scotts/pytorch
that referenced
this pull request
Jun 16, 2026
Includes the following commits: - surface HSA queue ID (pytorch/kineto#1425) 1d43601 - Add TypedMetadata to CUPTI activities (pytorch/kineto#1434) 461a26c - Move around methods so they are accurately described by the comments (pytorch/kineto#1435) ff95265 - Introduce TypedMetadata structs (pytorch/kineto#1433) 965a14d - Add unit tests for sync/async interleaving behavior (pytorch/kineto#1431) 67612e6 - Restrict on-demand trace output path to a safe directory (pytorch/kineto#1426) 9ea826e - Add a cancellation state to the state machine and remove syncTraceActive_ (pytorch/kineto#1355) 3289139 - Move state machine from profiler into async handler (pytorch/kineto#1352) eb578c5 - map kernel and copy events to logical stream ID instead of HSA queue ID (pytorch/kineto#1424) 25856f7 - Speedup and fix PyTorch CI build (pytorch/kineto#1428) e675bbb - Add logging for async rejections (pytorch/kineto#1422) 14becfb - Make sure we clear the logger observer before starting a new session (pytorch/kineto#1387) a8cae92 - Add a scope guard for logging to help us capture all exit paths (pytorch/kineto#1383) ce13b13 - Remove roctracer support (pytorch/kineto#1419) 2a3a002
pytorchmergebot
pushed a commit
to pytorch/pytorch
that referenced
this pull request
Jun 16, 2026
Includes the following commits: - surface HSA queue ID (pytorch/kineto#1425) 1d43601 - Add TypedMetadata to CUPTI activities (pytorch/kineto#1434) 461a26c - Move around methods so they are accurately described by the comments (pytorch/kineto#1435) ff95265 - Introduce TypedMetadata structs (pytorch/kineto#1433) 965a14d - Add unit tests for sync/async interleaving behavior (pytorch/kineto#1431) 67612e6 - Restrict on-demand trace output path to a safe directory (pytorch/kineto#1426) 9ea826e - Add a cancellation state to the state machine and remove syncTraceActive_ (pytorch/kineto#1355) 3289139 - Move state machine from profiler into async handler (pytorch/kineto#1352) eb578c5 - map kernel and copy events to logical stream ID instead of HSA queue ID (pytorch/kineto#1424) 25856f7 - Speedup and fix PyTorch CI build (pytorch/kineto#1428) e675bbb - Add logging for async rejections (pytorch/kineto#1422) 14becfb - Make sure we clear the logger observer before starting a new session (pytorch/kineto#1387) a8cae92 - Add a scope guard for logging to help us capture all exit paths (pytorch/kineto#1383) ce13b13 - Remove roctracer support (pytorch/kineto#1419) 2a3a002 Pull Request resolved: #187440 Approved by: https://github.com/ryanzhang22, https://github.com/Skylion007
gplutop7
pushed a commit
to gplutop7/pytorch
that referenced
this pull request
Jul 15, 2026
Includes the following commits: - surface HSA queue ID (pytorch/kineto#1425) 1d43601 - Add TypedMetadata to CUPTI activities (pytorch/kineto#1434) 461a26c - Move around methods so they are accurately described by the comments (pytorch/kineto#1435) ff95265 - Introduce TypedMetadata structs (pytorch/kineto#1433) 965a14d - Add unit tests for sync/async interleaving behavior (pytorch/kineto#1431) 67612e6 - Restrict on-demand trace output path to a safe directory (pytorch/kineto#1426) 9ea826e - Add a cancellation state to the state machine and remove syncTraceActive_ (pytorch/kineto#1355) 3289139 - Move state machine from profiler into async handler (pytorch/kineto#1352) eb578c5 - map kernel and copy events to logical stream ID instead of HSA queue ID (pytorch/kineto#1424) 25856f7 - Speedup and fix PyTorch CI build (pytorch/kineto#1428) e675bbb - Add logging for async rejections (pytorch/kineto#1422) 14becfb - Make sure we clear the logger observer before starting a new session (pytorch/kineto#1387) a8cae92 - Add a scope guard for logging to help us capture all exit paths (pytorch/kineto#1383) ce13b13 - Remove roctracer support (pytorch/kineto#1419) 2a3a002 Pull Request resolved: pytorch#187440 Approved by: https://github.com/ryanzhang22, https://github.com/Skylion007
aws-kingrj
pushed a commit
to amazon-contributing/upstream-to-pytorch
that referenced
this pull request
Jul 29, 2026
Includes the following commits: - surface HSA queue ID (pytorch/kineto#1425) 1d43601 - Add TypedMetadata to CUPTI activities (pytorch/kineto#1434) 461a26c - Move around methods so they are accurately described by the comments (pytorch/kineto#1435) ff95265 - Introduce TypedMetadata structs (pytorch/kineto#1433) 965a14d - Add unit tests for sync/async interleaving behavior (pytorch/kineto#1431) 67612e6 - Restrict on-demand trace output path to a safe directory (pytorch/kineto#1426) 9ea826e - Add a cancellation state to the state machine and remove syncTraceActive_ (pytorch/kineto#1355) 3289139 - Move state machine from profiler into async handler (pytorch/kineto#1352) eb578c5 - map kernel and copy events to logical stream ID instead of HSA queue ID (pytorch/kineto#1424) 25856f7 - Speedup and fix PyTorch CI build (pytorch/kineto#1428) e675bbb - Add logging for async rejections (pytorch/kineto#1422) 14becfb - Make sure we clear the logger observer before starting a new session (pytorch/kineto#1387) a8cae92 - Add a scope guard for logging to help us capture all exit paths (pytorch/kineto#1383) ce13b13 - Remove roctracer support (pytorch/kineto#1419) 2a3a002 Pull Request resolved: pytorch#187440 Approved by: https://github.com/ryanzhang22, https://github.com/Skylion007
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
Kineto's PyTorch-build CI jobs timeout. Two phases dominate the run:
Addressing that also exposed more problems:
Fixes