Conversation
…racerLogger Adds RoctracerLogger::recordEvent / resolveWait / clearEventMap mirroring the RocprofLogger PR2 design. Backs them with a sorted-vector map keyed by hipEvent_t so handle reuse is handled correctly: a hipStreamWaitEvent at correlation N resolves to the most recent hipEventRecord whose correlation is strictly less than N. Co-authored-by: Cursor <cursoragent@cursor.com>
…N output Mirrors the rocprofiler-sdk metadataJson specializations for rocprofEventRecordRow and rocprofSyncRow. Same field names as CUPTI (wait_on_stream, wait_on_hip_event_record_corr_id, wait_on_hip_event_id) so trace consumers use one code path across all three backends. Co-authored-by: Cursor <cursoragent@cursor.com>
RocmActivityProfiler: :onResetTraceData was conditionally clearing only the rocprofiler-sdk g_eventMap. With sync-API attribution now in the roctracer path too (this PR), the same hygiene is needed there to prevent prior-session producer records from being returned as the source of a wait in the next session. Co-authored-by: Cursor <cursoragent@cursor.com>
PyTorch's build system propagates -Wall -Wextra -Werror to kineto. The roctracer code has 3 pre-existing unused parameters (RoctracerLogger::api_callback / ::activity_callback / RoctracerActivityApi::setMaxBufferSize) that have lived there since the file was written but never tripped a build before, because nobody had built the roctracer backend under these flags. PR3 is the first thing that exercises this combination; annotate the params with [[maybe_unused]] so the build is clean. No behaviour change. Co-authored-by: Cursor <cursoragent@cursor.com>
…r fallback path Without these case branches in handleRoctracerActivity, the new rocprofEventRecordRow / rocprofSyncRow records emitted by RoctracerLogger fall through to the default branch and get dropped, and the RuntimeActivity<T>::metadataJson template specializations are never instantiated. Mirror the rocprofsdk dispatch so both backends produce identical wait-event metadata in the trace JSON. Co-authored-by: Cursor <cursoragent@cursor.com>
Drops the #ifndef ROCTRACER_FALLBACK guards around InterStreamDependencyTest, StreamWaitEventFutureCorrelation, EventMapClearedOnReset, EventSynchronizeResolvesProducer, UnresolvedWaitStillEmitsEventId. Adds HIP_EVENT_RECORD_ID / HIP_STREAM_WAIT_EVENT_ID / HIP_EVENT_SYNCHRONIZE_ID macros mirroring the existing HIP_LAUNCH_KERNEL pattern, and a SyncMapLogger alias that resolves to RocprofLogger on rocprofsdk and RoctracerLogger on roctracer. Because PR3 makes the two backends produce identical wait-event JSON, one set of tests now covers both code paths. Co-authored-by: Cursor <cursoragent@cursor.com>
Previously, on ROCm >= 6.4 the rocm-backend setup unconditionally set USE_ROCPROFILER_SDK=ON, ignoring any -DUSE_ROCPROFILER_SDK=OFF the caller passed. That made it impossible to test the roctracer fallback path on modern ROCm without patching kineto. Wrap the auto-detect in 'if(NOT DEFINED USE_ROCPROFILER_SDK)' so the auto value is a default, not an override. Same conventions as KINETO_BACKEND itself. Co-authored-by: Cursor <cursoragent@cursor.com>
…ckend RocprofLogger: :ensureRegistered() is rocprofiler-sdk-specific (calls rocprofiler_force_configure). On the roctracer fallback path RocprofLogger.cpp isn't compiled, so init.cpp's reference to that symbol failed to link. Guard the call with #ifndef ROCTRACER_FALLBACK so the roctracer-backed libkineto links cleanly. Roctracer doesn't need a force-configure step. Co-authored-by: Cursor <cursoragent@cursor.com>
ajassani
force-pushed
the
pr2/interstream-deps-rebased
branch
from
May 23, 2026 13:27
d862fbf to
e097ad6
Compare
ajassani
force-pushed
the
pr3/roctracer-interstream-deps
branch
from
May 23, 2026 13:27
7994033 to
b5e52fc
Compare
…tyApi Upstream dead code: RoctracerActivityApi::registered_ is declared but never used. The standalone kineto build picks up -Wall -Wextra -Werror when KINETO_BUILD_TESTS=ON, and this combination has never been exercised before on the roctracer backend because the test suite was previously rocprofiler-sdk-only. PR3's test-unification (e769860) is the first thing that compiles RoctracerActivityApi.cpp under -Werror, exposing this latent issue. Annotate the field with [[maybe_unused]]; no behaviour change. The matching field in RocprofActivityApi.h has the same shape but isn't reached by the current rocprofiler-sdk test build path, so leaving it alone for now (separate trivial fix if it ever fires). Co-authored-by: Cursor <cursoragent@cursor.com>
Owner
Author
|
Superseded by a clean standalone branch: #4 (or next) — see https://github.com/ajassani/kineto/tree/pr3-standalone/roctracer-sync-deps. This PR was the old stacked PR1+PR2+PR3 version; restructured to roctracer-only as the first upstream submission. |
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.
Heads-up before review
1.
a0fc873shim — already dropped from the stack(PR3 was always clean here — the shim commit lived on PR2's branch.
2026-05-23 update: it's been removed from PR2 too. PR3 no longer carries
any descendant of it.)
2. Build-cleanup commits remaining on this PR
0de775d"silence pre-existing-Wunused-parameteron roctracerbackend" — pure build hygiene fix exposed by the rest of PR3.
01a6101"let caller overrideUSE_ROCPROFILER_SDKon ROCm 6.4+" —removes an unconditional override in
libkineto/CMakeLists.txtso thecaller can actually pick the roctracer backend on newer ROCm. Real
bug, should survive review.
3. Test infrastructure unification
e769860drops the#ifndef ROCTRACER_FALLBACKguards from PR2's 5inter-stream-dep tests by introducing a
SyncMapLoggertype alias.This is a nice cleanup but also a precondition for the rest of PR3 being
testable on both backends. We've validated it works (L1 unit tests on
both backends pass).
Original PR body
feat(rocm): port sync-API metadata + inter-stream deps to the roctracer backend
Problem
PR2 added inter-stream-dependency metadata under the rocprofiler-sdk
backend only. Existing PyTorch ROCm wheels still ship the legacy
roctracer backend, so until the rocprofiler-sdk wheel rolls out (and on
older ROCm releases that don't have rocprofiler-sdk), users see traces
that lack the new fields. The two backends produce visibly different
JSON for the same workload.
This PR closes that gap so a Kineto trace from either backend has the
same
hip_event/hip_stream/wait_on_*fields with identicalfield names.
Design
Same design as PR2, applied to
RoctracerLogger.cpp:g_eventMap+EventMapEntry(sorted vector, mutex-guarded).RoctracerLogger::recordEvent/resolveWait/clearEventMap, signature-identical toRocprofLogger's.api_callbackcases for the 5 sync APIs:HIP_API_ID_hipEventRecord→recordEvent+ emitrocprofEventRecordRow.HIP_API_ID_hipStreamWaitEvent→resolveWaitagainst the event'sproducer + emit
rocprofSyncRowwithROCPROF_SYNC_STREAM_WAIT_EVENT.HIP_API_ID_hipEventSynchronize→resolveWait+ emitrocprofSyncRowwithROCPROF_SYNC_EVENT_SYNCHRONIZE.HIP_API_ID_hipStreamSynchronize→ emitrocprofSyncRow(ROCPROF_SYNC_STREAM_SYNCHRONIZE).HIP_API_ID_hipDeviceSynchronize→ emitrocprofSyncRow(ROCPROF_SYNC_DEVICE_SYNCHRONIZE).The row types (
rocprofEventRecordRow,rocprofSyncRow) are already inRocLogger.hfrom PR2; this PR reuses them so the JSON shape is byte-identical between backends.
RoctracerActivity_inl.hadds the twoRuntimeActivity<T>::metadataJsontemplate specializations, copied from
RocprofActivity_inl.h. Same fieldnames, same CUPTI-parity ordering.
RocmActivityProfiler::onResetTraceDatanow callsRoctracerLogger::clearEventMap()on the roctracer code path (wasguarded with
#ifndef ROCTRACER_FALLBACKso it was previously a no-op).RocmActivityProfiler::handleRoctracerActivitydispatches the two newrow types to
handleRuntimeActivity<T>so the template specializationsget instantiated.
Tests / evidence
L1: Both unit-test runs pass:
KINETO_BACKEND=rocm USE_ROCPROFILER_SDK=ON(rocprofiler-sdk)KINETO_BACKEND=rocm USE_ROCPROFILER_SDK=OFF(roctracer)L2: PyTorch wheel rebuild against PR3, then captured
single_proc_streams.pytraces under both backends. 3-way diff (stock-roctracer / PR3-roctracer /
PR3-rocprofsdk-patched) shows identical
hip_event/hip_stream/wait_on_*field presence and resolution.L3: 4-rank DDP run on MI210 with PR3-roctracer backend; trace shows full
sync metadata, zero dangling references, matches PR2-rocprofsdk trace
field-for-field.
Tests run on both backends after this PR
The fifth commit (
a7ff5c7) drops the#ifndef ROCTRACER_FALLBACKguards from the 5 PR2 inter-stream-dep tests:
InterStreamDependencyTestStreamWaitEventFutureCorrelationEventMapClearedOnResetEventSynchronizeResolvesProducerUnresolvedWaitStillEmitsEventIdMechanism:
HIP_EVENT_RECORD_ID,HIP_STREAM_WAIT_EVENT_ID,HIP_EVENT_SYNCHRONIZE_IDmacros mirroring the existingHIP_LAUNCH_KERNELpattern. Each expands to the right SDK constantper backend.
SyncMapLoggertype alias resolving toRocprofLoggerunder rocprofsdk and
RoctracerLoggerunder roctracer. The twoclasses expose signature-identical
recordEvent/resolveWait/clearEventMap, so one test body covers both backends.The result: whatever backend the test binary is built against, these
5 tests run and verify the production lookup path.
Out of scope
approach above gets us full coverage without a second mock surface.