Skip to content
This repository was archived by the owner on Oct 19, 2026. It is now read-only.
This repository was archived by the owner on Oct 19, 2026. It is now read-only.

[Issue]: hipGraphAddMemFreeNode returns hipErrorInvalidValue on a graph from an active stream capture #6701

Closed as not planned

Description

@zhihuidu-amd

Problem Description

hipGraphAddMemFreeNode returns hipErrorInvalidValue when the graph being
added to came from an active stream capture. The identical call on a
hand-built graph succeeds.

The graph's origin is the only variable that changes the outcome. Dependency
count, dependency identity, and whether the matching hipGraphAddMemAllocNode
is present all turn out to be irrelevant.

Operating System

Ubuntu 24.04 (container rocm/dev-ubuntu-24.04:7.2-complete)

CPU

AMD EPYC (MI300X node)

GPU

AMD Instinct MI300X (gfx942, sramecc+, xnack-)

ROCm Version

ROCm 7.2

Steps to Reproduce

  1. hipStreamBeginCapture(stream, hipStreamCaptureModeRelaxed)
  2. During the capture, obtain the capturing graph via
    hipStreamGetCaptureInfo.
  3. Call hipGraphAddMemFreeNode(&node, graph, deps, nDeps, ptr) on that graph.

Observed: hipErrorInvalidValue (error 1, "invalid argument").
Expected: the node is added, as it is for a graph not obtained from a capture.

Evidence

Four cases, each in its own process, differing only as shown:

graph origin dependencies result
hand-built MemFree depends on MemAlloc success
hand-built zero dependencies success
active stream capture frontier dependencies hipErrorInvalidValue
active stream capture zero dependencies hipErrorInvalidValue

Supporting state at the time of the failing calls:

  • hipDeviceAttributeMemoryPoolsSupported = 1
  • hipMallocAsync during the same capture succeeds and returns a valid pointer
  • capture info is healthy: status=1, ndeps=1

Two explanations we checked and ruled out

Both looked likely from reading the source, and both are wrong:

  • A missing or mismapped hipGraphAddMemFreeNode binding. The mapping is
    present and the same call succeeds twice in the hand-built cases.
  • An empty-dependency-list edge case. Zero dependencies succeeds standalone
    and fails inside capture, so the dependency count is not the variable.

Impact

The caller cannot distinguish this from a genuine argument error, so the usual
recovery is to drop the allocation from its own tracking while the graph still
owns it. Accumulated over a test suite that exercises this path, that was enough
to terminate the process.

A caller can work around it by deferring the free until after the capture ends,
at the cost of the graph retaining the allocation and a larger memory footprint.

Activity

  1. zhihuidu-amd commented on Oct 14, 2026

    @zhihuidu-amd
    Author

    Duplicate of ROCm/TheRock#9295, which reports the same behaviour and was filed first. Closing this one; I have moved the extra probe data onto ROCm/TheRock#9295. Apologies for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions