Skip to content

fix(rocprofiler-sdk): skip HIP visibility matching for ROCR-hidden agents - #12951

Merged
venkat1361 merged 1 commit into
developfrom
users/bewelton/aiprofsdk-1169-visibility-warning
Oct 27, 2026
Merged

venkat1361 merged 1 commit into
developfrom
users/bewelton/aiprofsdk-1169-visibility-warning

Conversation

@bwelton

@bwelton bwelton commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Summary

HIP_VISIBLE_DEVICES indexes the list of devices ROCR exposes, but rocprofiler-sdk matched HIP tokens against the absolute GPU ordinal for agents hidden by ROCR_VISIBLE_DEVICES. Any process setting both variables (e.g. ROCR_VISIBLE_DEVICES=4 HIP_VISIBLE_DEVICES=0) logged a spurious warning naming an unrelated agent:

Attempt to enable hip visibility for agent-2 which is not visible to HSA (ROCR)

This breaks PyTorch's dynamo/test_logging.py::LoggingTests::test_logs_out (AIPYTORCH-1297) because of the unexpected stderr output.

Changes

  • agent.cpp: when ROCR_VISIBLE_DEVICES is set and does not include the agent, mark it invisible to HSA and HIP and return before the HIP_VISIBLE_DEVICES / CUDA_VISIBLE_DEVICES / GPU_DEVICE_ORDINAL matching. HIP (rocclr/device/rocm/rocdevice.cpp) only enumerates agents returned by hsa_iterate_agents, so a ROCR-hidden agent can never be HIP-visible. The resulting visibility values are unchanged; only the false warning is removed.
  • tests/agent.cpp: new agent_visibility_rocr_hip_stacked test covering the ticket's table (ROCR unset / HIP=4, ROCR=3,4 HIP=1, ROCR=4,5 HIP=0, ROCR=4 HIP=4). It checks both the per-agent HSA/HIP/RCCL/rocDecode visibility and that the warning is not emitted. It uses the warning that get_gpu_agents() always logs as a positive control, so the test cannot pass just because stderr capture failed.

Testing

On an 8x MI325X (gfx942) host, standalone rocprofiler-sdk build against TheRock 10.1.0a20260910:

  • Build rocprofiler-sdk-lib-tests (RelWithDebInfo): clean, 0 warnings.
  • Fail-first: with the agent.cpp change reverted, agent_visibility_rocr_hip_stacked fails on exactly the ROCR=3,4 HIP=1 and ROCR=4,5 HIP=0 cases, with the not visible to HSA warning for agents 4/5/6. With the fix it passes.
  • ctest -R '^unit\.(rocprofiler_lib|agent_mapping|parse_gfx_target_version|contexts|enum_string|hsa|LateStartTest|queue_controller|queue_interposition|hsa_barrier)\.': every test whose binary was built passes, except unit.rocprofiler_lib.agent. It fails identically without this change (product_name "unknown" vs empty device_mkt_name on this host's runtime).
  • AddressSanitizer and UndefinedBehaviorSanitizer builds: rocprofiler_lib.agent_visibility* + agent_abi pass with zero sanitizer reports.

Tracking

JIRA ID : AIPROFSDK-1169

@therock-pr-bot

therock-pr-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ⚠️ Warning Error: Source/code files changed without an accompanying unit test.
Expected: add at least one test file named like test_<name>.py / test_<name>.cpp (or <name>_test.*).
Current: code file(s) changed: projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/agent.cpp, projects/rocprofiler-sdk/source/lib/rocprofiler-sdk/tests/agent.cpp; no test file found
🚫 Draft PR 🔜 To Be Enabled —
🚩 Feature Flag 🔜 To Be Enabled —
📊 Code Coverage 🔜 To Be Enabled —

🎉 All policy checks passed!

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

🙋 Wish to Override Policy?

…ents

HIP_VISIBLE_DEVICES indexes the ROCR-visible device list, but agents hidden
by ROCR_VISIBLE_DEVICES were matched against HIP tokens using their absolute
GPU ordinal. Any process setting both variables (e.g. ROCR=4 HIP=0) warned
'Attempt to enable hip visibility for agent-N which is not visible to HSA'
for an unrelated agent. Mark ROCR-hidden agents invisible to HSA and HIP
without consulting the HIP-family variables.

Fixes AIPROFSDK-1169
@venkat1361
venkat1361 force-pushed the users/bewelton/aiprofsdk-1169-visibility-warning branch from 3afd834 to 99adfe7 Compare October 27, 2026 16:04
@venkat1361
venkat1361 merged commit 795e66d into develop Oct 27, 2026
122 of 127 checks passed
@venkat1361
venkat1361 deleted the users/bewelton/aiprofsdk-1169-visibility-warning branch October 27, 2026 22:50
@systems-assistant

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants