Skip to content

HRX: libhip_logging writes no output despite HIP_LOG_FILE/HIP_LOG_LEVEL #411

Closed

Description

@bong-water-water-bong

HRX: libhip_logging never writes its log file

The logging interceptor in HRX's passthrough set (libhip_logging.so) loads and forwards HIP
calls correctly, but produces no output — no log file and nothing on stderr — even when its
documented environment variables are set.

Repro

export HIP_PASSTHROUGH_BACKEND_LIB=<path>/libamdhip64.so.7
export HIP_PASSTHROUGH_INTERCEPTOR=<path>/libhip_logging.so
export HIP_LOG_FILE=/tmp/hip.log
export HIP_LOG_LEVEL=2          # 2 = log calls (documented default)
LD_LIBRARY_PATH=<passthrough>:<backend> ./any_hip_program

Observed:

Check Result
program runs correctly yes — forwarding is transparent
/tmp/hip.log created no (file does not exist)
anything on stderr with HIP_LOG_LEVEL=2 nothing
same run omitting HIP_LOG_FILE (documented default = stderr) nothing

What is known

  • The interceptor's ABI is present and correct: the library exports
    hip_interceptor_init, hip_interceptor_shutdown, and hip_interceptor_get_log_fn.
  • The variables are read: HIP_LOG_FILE at libhrx/src/passthrough/hip_logging.c:569 and
    HIP_LOG_LEVEL at :580.
  • The proxy loads it correctly with dlopen(..., RTLD_NOW | RTLD_LOCAL) and calls
    hip_interceptor_init with the real function table
    (libhrx/src/passthrough/hip_intercept.c:143,146).
  • Loading the interceptor does not break anything — calls still reach the backend.

So init appears to succeed but logging is never emitted. Possible causes worth checking first:
the interceptor table returned by hip_interceptor_init may not be replacing the real table
(silent fallthrough to the unwrapped path), or the log sink is initialised lazily and never
reached.

Impact

Low — this is a diagnostic tool, not a runtime path. But libhip_logging is the documented way
to trace HIP calls, and it currently gives the user no signal at all that it is (or is not)
working: a silent no-output run looks identical to "the program made no HIP calls".
Failing loudly (or writing a header line on init) would be enough to make it diagnosable.

Note

:569/:580 are the observed line numbers; treat them as approximate if the file has moved.

Activity

  1. bong-water-water-bong commented on Oct 13, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Correction — this is NOT a defect, and the report is withdrawn

    I filed this after running the interceptor incorrectly. My test never loaded the proxy, so
    the interceptor was never invoked and no output was ever going to appear.

    Two mistakes on my side:

    1. The proxy was not preloaded. I placed libhip_intercept.so on LD_LIBRARY_PATH, but the
      test program is linked against libamdhip64.so.7, so the dynamic linker satisfied its HIP
      symbols directly from the real library. The interceptor was never in the call path at all
      (ldd confirmed: libamdhip64.so.7 => …/libamdhip64.so.7).

    2. Wrong variable name. hip_intercept.c reads the interceptor path from
      HIP_INTERCEPTION_LIBRARY, while the README documents HIP_PASSTHROUGH_INTERCEPTOR.
      Following the README selects nothing.

    It works when invoked correctly

    LD_PRELOAD=<...>/libhip_intercept.so \
    HIP_PASSTHROUGH_BACKEND_LIB=<...>/libamdhip64.so.7 \
    HIP_INTERCEPTION_LIBRARY=<...>/libhip_logging.so \
    HIP_LOG_FILE=/tmp/hiplog.log HIP_LOG_LEVEL=2 \
      ./any_hip_program
    

    produces:

    [315379.952566] HIP Logging initialized (level=2)
    [315380.015274] HIP Logging shutting down
    [315379.981198] hipStreamCreate() -> stream=0x634e960efa00, ret=0
    [315379.981275] hipMallocManaged(size=4096, flags=0x1) -> ptr=0x634e960f4000, ret=0
    [315379.981278] hipPointerGetAttribute() -> 0
    [315379.981279] hipStreamAttachMemAsync() -> 0
    [315379.981283] hipFree(0x634e960f4000) -> 0
    [315379.981288] hipStreamDestroy(stream=0x634e960efa00) -> 0
    [315379.981489] hipMemset(dst=0x774aa8400000, value=0x11, size=8192) -> 0
    

    Every HIP call is logged with a timestamp and return code. libhip_buffer_tracer likewise works
    (it reported Total kernels traced: 0, Total buffers tracked: 0, and logged each
    hipMalloc/hipMemset with pointers).

    The one real finding that survives

    The documented environment variable does not match the code. hip_intercept.c reads
    HIP_INTERCEPTION_LIBRARY; the passthrough README documents HIP_PASSTHROUGH_INTERCEPTOR. A
    user following the README gets a silently un-instrumented run with no warning — which is exactly
    what happened to me and is why I misdiagnosed this as a library defect.

    Suggestion: read both names (the documented one taking precedence), or correct the README.

    Closing as not a bug. Apologies for the noise — the failure was in my test harness, not in
    HRX.

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