﻿# ROCTx ranges: ending a host annotation does not prove GPU work has completed

Use ROCTx push/pop and start/stop ranges with explicit thread scope and completion meaning, correlating host annotations with device records instead of treating them as automatic GPU timers.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-roctx-host-range-asynchronous-gpu-completion/
Language: en

## Name what the annotation encloses

The [ROCTx usage guide](https://rocm.docs.amd.com/projects/rocprofiler-sdk/en/latest/how-to/using-rocprofiler-sdk-roctx.html) presents markers and ranges for annotating application tasks. A range around a launch loop can describe host submission, while another range might deliberately include waiting for completion. Both can be useful, but they answer different timing questions. Choose a name that expresses the boundary rather than labeling every host scope as total GPU processing time.

## Select the correct range lifetime mechanism

The guide distinguishes nested thread-local push/pop ranges from start/stop ranges identified by a returned handle, which can span threads. Use the mechanism matching application ownership. Popping a nested range on a different worker is not equivalent to stopping a process range with its identity. For asynchronous task systems, preserve the range handle through handoff and define which completion event ends the application task being annotated.

## Keep API return separate from device completion

The [callback tracing reference](https://rocm.docs.amd.com/projects/rocprofiler-sdk/en/latest/api-reference/callback_services.html) describes host operation entry and exit observations. Ending an annotation after a launch call returns establishes that the host scope ended, not that every submitted kernel finished. If measuring completed end-to-end work, include the appropriate completion boundary intentionally. Adding synchronization changes the measured execution pattern, so distinguish a diagnostic completed-work interval from an otherwise overlapped throughput experiment.

## Correlate with actual device activity records

The [buffered tracing guide](https://rocm.docs.amd.com/projects/rocprofiler-sdk/en/latest/api-reference/buffered_services.html) describes asynchronous activity record delivery and record types. Use the device timestamps and relevant identities to understand where submitted work actually executed relative to the host annotation. A GPU activity outside the visible host range can be expected for asynchronous submission. Conversely, a long range with little device activity may include CPU preparation or waiting rather than slow kernel execution.

## Validate annotation meaning before comparing models

Trace a small task with a clearly separated submission and completion stage. Confirm that the chosen range mechanism survives thread handoffs and that its name matches the intended application boundary. The existing [profiling-method guide](/journal/learn-gpu-profiler-sampling-instrumentation/) and [stream-dependency guide](/journal/learn-stream-ordering-dependencies/) support related context. Report annotation semantics with performance results so a shorter host range is not mistaken for lower completed GPU latency, and a deliberately synchronized measurement is not presented as unchanged concurrent application behavior.
