﻿# ROCprofiler-SDK correlation: delayed record delivery is not GPU execution order

Connect ROCprofiler-SDK host API callbacks to asynchronous GPU activities with correlation identities and timestamps, avoiding thread-local request attribution at delayed delivery time.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-rocprofiler-correlation-record-delivery-not-event-order/
Language: en

## Separate submission from device activity

The [callback tracing guide](https://rocm.docs.amd.com/projects/rocprofiler-sdk/en/latest/api-reference/callback_services.html) describes callbacks on the CPU thread around traced operations. A host API duration is not automatically a GPU kernel duration. The API can submit asynchronous work whose execution begins or ends later. Preserve the operation domain and record type when building a timeline instead of assigning one timestamp interval to every activity associated with the same application function.

## Expect buffered records to arrive later

The [buffered-services guide](https://rocm.docs.amd.com/projects/rocprofiler-sdk/en/latest/api-reference/buffered_services.html) describes batched delivery on internal background threads and explicit flushing. Callback arrival order therefore cannot stand in for the event timestamps or the submitting thread's control flow. Join records using their documented identities and timing fields. A late flush can reveal earlier device work without indicating that the GPU performed that work only at the moment the tool received it.

## Capture application attribution at the right boundary

The [external-correlation reference](https://rocm.docs.amd.com/projects/rocprofiler-sdk/en/latest/api-reference/rocprofiler-sdk_api/modules/external_correalation.html) describes thread-local push/pop context and an experimental request service for selecting external identities. Treat those mechanisms according to their exact timing and supported API status. Do not attach an incoming buffered record to whatever application request happens to be current on the delivery thread. That thread can be unrelated to the original submitter and can run after its request scope ended.

## Preserve metadata needed by delayed consumers

A tool may need operation names, code-object information or application mappings when consuming asynchronous records. Keep the required data alive until all relevant buffered records have been handled. The callback guide explicitly discusses payload lifetime and retaining code-object information for later records. Copy the needed metadata within its valid lifetime instead of retaining a pointer whose callback-local contents will no longer be valid during deferred processing.

## Validate a small overlapping workload

Trace deliberately overlapping submissions from separate application scopes and verify attribution before collecting a large model run. Inspect dropped-record information and flush boundaries before interpreting an absent event as idle hardware. The existing [profiling-method guide](/journal/learn-gpu-profiler-sampling-instrumentation/) and [software reproducibility guide](/journal/software-stack-reproducibility/) support related context. A useful timeline distinguishes host submission, device execution, record delivery and application identity, allowing performance conclusions to follow the measured events rather than the tool's processing schedule.
