﻿# MIGraphX offload_copy: compilation changes the host-device transfer boundary

Understand how MIGraphX offload_copy inserts input and output transfers during compilation, and compare execution timings only after identifying where application-owned transfers occur.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-migraphx-offload-copy-compiled-transfer-boundary/
Language: en

## A faster run call may simply exclude transfers

Two MIGraphX benchmarks use the same model but different compilation options. One reports a shorter execution interval after input upload moved into application setup. The result may be valid, yet it does not establish that the entire request became faster by the same amount. Identify the transfer boundary before comparing numbers. A device-resident pipeline and a host-array request can answer different performance questions even when they execute the same mathematical graph.

## The option inserts transfers during compilation

The [Python API reference](https://rocm.docs.amd.com/projects/AMDMIGraphX/en/latest/reference/MIGraphX-py.html) describes `offload_copy` as inserting input copies to offloaded memory and final-result copies back to main memory. This is a graph compilation decision, not merely a logging or benchmarking switch. Record its value with the compiled program. An application using a different boundary must provide arguments appropriate to that boundary and handle any necessary movement outside the generated program.

## Argument storage must match the chosen path

The [developer introduction](https://rocm.docs.amd.com/projects/AMDMIGraphX/en/latest/dev/dev_intro.html) discusses program arguments and offloaded GPU memory. Do not disable compiled copying and then assume an ordinary host buffer has become device storage. The [hybrid CPU and GPU guide](/journal/cpu-gpu-hybrid-architecture/) explains why the two memory domains remain distinct responsibilities. If data already resides on the device, document that pipeline rather than advertising transfer removal to callers who still submit host-resident arrays.

## Inspect the compiled interface and outputs

The [C++ API reference](https://rocm.docs.amd.com/projects/AMDMIGraphX/en/latest/reference/MIGraphX-cpp.html) describes program compilation, arguments and shape information. Check the actual parameter contract and returned result location for the selected configuration. Compare numerical outputs after making them readable by the reference path. Do not interpret the existence of an argument object as evidence that its backing data resides in the required memory domain. The integration must establish storage compatibility for the compiled program it actually invokes.

## Publish timings with their boundary

Report whether upload, compute, download and output materialization are included. The [latency diagnosis guide](/journal/triton-latency-stage-diagnosis/) supplies a useful stage-based interpretation. If transfers move outside the run call, retain a complete application measurement alongside the narrower execution measurement. This makes a genuine device-resident optimization assessable without confusing exclusion from a stopwatch interval with elimination of work. The relevant outcome is the cost of the intended pipeline, not the smallest number obtainable by changing where the timer starts.
