Repository navigation
debug(hip-tests): targeted workflow to reproduce prefetch flake (issue 8271) - #11750
Closed
anugodavar wants to merge 4 commits into
Closed
anugodavar wants to merge 4 commits into
anugodavar wants to merge 4 commits into
Conversation
Add a manually-triggered workflow that runs only the two intermittently failing prefetch tests on gfx94X-dcgpu in parallel to increase the probability of catching the failure: - Unit_hipMemPrefetchAsync_Basic_AllDevices - Unit_hipMemPrefetchBatchAsync_SingleOperationSingleLocation Also add HIP_TESTS_REGEX env var support to run_hiptests.py so ctest can be filtered to a targeted subset of tests for focused debugging. Issue: ROCm/TheRock#8271 Co-Authored-By: Claude <noreply@anthropic.com>
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
…tigation Enable AMD_LOG_LEVEL=3 (info) with AMD_LOG_MASK=0x123 to capture: - LOG_API (0x001): hipMemPrefetchAsync/hipStreamSynchronize call traces - LOG_CMD (0x002): stream command dispatch and barrier packets - LOG_SIG (0x020): signal creation and completion lifecycle - LOG_COPY (0x100): hsa_amd_svm_prefetch_async dispatch and completion This will show whether the prefetch signal is being waited on correctly and whether the migration actually completes before the CPU reads. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The workflow setup is broken and lacks required GPU-isolation configuration.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds a manual, repeatable workflow to reproduce the hipMemPrefetchAsync flake and supports targeted HIP test selection.
Changes:
- Adds configurable parallel
gfx942debugging workflow. - Adds
HIP_TESTS_REGEXsupport to the HIP test runner.
File summaries
| File | Summary |
|---|---|
projects/hip-tests/catch/packaging/run_hiptests.py |
Adds regex-based CTest filtering. |
.github/workflows/debug-prefetch-flake.yml |
Adds repeated prefetch-flake test jobs. Critical (3 votes): checkout/setup paths prevent execution. Moderate (1 vote): missing GPU-isolation environment configuration. |
Review details
Suppressed comments (5)
.github/workflows/debug-prefetch-flake.yml:113
- Only
prejob/build_toolsis fetched above, and the subsequent checkout is rocm-systems, so./build_tools/github_actions/cleanup_processes.shdoes not exist at the workspace root. Because this step runs withalways(), every job will fail during cleanup even after a successful test run. Use the fetched tools path (or explicitly check out build_tools at the root).
run: |
.github/workflows/debug-prefetch-flake.yml:77
- The setup action's
FETCH_ARTIFACT_ARGSinput defaults to empty, while the hip-tests configuration requires--teststo download the catch test package. Without that argument,build/share/hip/catch_testsis not provisioned and the following test command cannot run the requested tests.
.github/workflows/debug-prefetch-flake.yml:108 - This invokes
run_hiptests.pyfrom the source tree, butderive_rocm_path()only accepts an installed.../share/hip/catch_testslayout. SinceROCM_PATHis not set here, the script raises before CTest starts; point it at the unpacked ROCm root (or invoke the installed copy).
print("(query skipped - check rocminfo output above)")
.github/workflows/debug-prefetch-flake.yml:41
- This runner is an OSSCI MIXXX GPU runner, for which the repository's other containerized GPU workflows pass
/etc/podinfo/gha-gpu-isolation-settings(for example,rocprofiler-systems-continuous-integration.yml:160-168). Omitting that env file can run the matrix jobs without the required GPU-isolation configuration. Add the env-file option to this container.
options: "--ipc host --user 0:0 --ulimit memlock=-1:-1 --ulimit nofile=1048576:1048576 --security-opt seccomp=unconfined --group-add video --device /dev/kfd --device /dev/dri -e ROCR_VISIBLE_DEVICES -e KUBE_CPU_REQUEST"
.github/workflows/debug-prefetch-flake.yml:102
- The diagnostic step claims the SVM query is skipped, but it still loads
libhsa-runtime64.so.1. The no-ROCm image only receives the ROCm libraries under the unpackedbuildtree, and no library path is configured for this standalone Python process, so this can raiseOSErrorand abort the workflow before the tests. Remove the unused library load.
echo ""
echo "=== Large BAR (BAR0 size per GPU) ==="
for f in /sys/class/drm/card*/device/resource; do
awk 'NR==1{s=strtonum($1);e=strtonum($2);if(e>s)printf " %s BAR0: %d MB\n",FILENAME,(e-s+1)/1024/1024}' "$f"
done
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+68
to
+69
| - name: Checkout repository | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
Two fixes: 1. Rewrite workflow to reuse therock-test-component.yml properly, matching the exact container/runner setup as failing CI runs. 2. Lower AMD_LOG_LEVEL from 7 to 3 (LOG_INFO): the installed release binary compiles out LOG_DEBUG (level 4) paths via compile-time AMD_LOG_LEVEL=0 macro — level 3 is the highest that produces output. Co-Authored-By: Claude <noreply@anthropic.com>
AMD_LOG_LEVEL env var only enables LOG_INFO (level 3) in the installed release binary because the ClPrint check for LOG_DEBUG paths is compiled against a separate internal variable instance that the env-var path does not reach. hipExtEnableLogging() writes to the correct internal variable. Build a tiny LD_PRELOAD shim (enable_hip_log.so) that calls hipExtSetLoggingParams(4, ...) + hipExtEnableLogging() via a constructor, injecting it automatically when HIP_TESTS_REGEX is set. This surfaces: - HSA prefetch async dev_ptr / completion_signal values - Host wait on completion_signal - Full API call traces for hipMemPrefetchAsync/hipStreamSynchronize Verified locally: LD_PRELOAD shim produces full level-4 log output including the prefetch dispatch and signal-wait entries. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a manually-triggered workflow and a
HIP_TESTS_REGEXenv var to reproduce the intermittenthipMemPrefetchAsyncfailures reported in ROCm/TheRock#8271.Failing tests:
Unit_hipMemPrefetchAsync_Basic_AllDevices—42 == 0(value mismatch at index 0)Unit_hipMemPrefetchBatchAsync_SingleOperationSingleLocation—false == trueRoot cause hypothesis:
hipMemPrefetchAsyncdispatcheshsaKmtSVMSetAttr(HSA_SVM_ATTR_PREFETCH_LOC)on a CPU signal-handler thread. The kernel'smigrate_pages()can silently fail to migrate some pages (due to concurrent access or memory pressure during parallel CTest execution). With XNACK disabled, a CPU read of an unmapped GPU-resident page returns stale/zero data instead of faulting and retrying. The failure is intermittent because migration only sometimes succeeds.Changes:
.github/workflows/debug-prefetch-flake.yml— newworkflow_dispatchworkflow that runs only the two failing tests ongfx942CSP runners, with a configurable repeat count (5–30 parallel matrix jobs) to stress the flakeprojects/hip-tests/catch/packaging/run_hiptests.py— addsHIP_TESTS_REGEXenv var support soctest --tests-regexcan target a specific subset without modifying test sourceHow to use:
gfx94X-dcgpuCI run42 == 0orfalse == truefailures🤖 Generated with Claude Code