Repository navigation
fix(clr): set HIP last error in hipAmdFileRead/Write - #14863
Conversation
✅ All Policy Checks Passed
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
7c4e957 to
f8d3ce1
Compare
mangupta
left a comment
There was a problem hiding this comment.
🤖 AI-assisted pre-review (for @mangupta)
[SUGGESTION] No CHANGELOG entry for hipAmdFileRead/Write now updating the HIP last error
hipAmdFileRead and hipAmdFileWrite are public, exported APIs. After this change, their failures show up in hipGetLastError and hipPeekAtLastError, and their successes go through HIP_RETURN. Applications that check the last error after calling these APIs will see different results. The PR updates the doxygen @returns lists but adds no projects/clr/CHANGELOG.md entry.
Suggested fix: Add a short entry to the projects/clr/CHANGELOG.md resolved-issues or changes section. It should say that hipAmdFileRead and hipAmdFileWrite now set the thread-local last error, so hipGetLastError and hipPeekAtLastError report their failures.
[SUGGESTION] New last-error invariant has unit tests but no contract test or uncovered_apis rationale
The PR adds a public API invariant: a failure from hipAmdFileRead or hipAmdFileWrite is recorded as the last error. It covers this only with unit tests in catch/unit/device. It adds no catch/contract test with an @asserts: API - invariant annotation and no rationale in catch/contract/uncovered_apis.txt, and it does not regenerate TEST_PLAN.md.
Suggested fix: Add a catch/contract test that asserts hipAmdFileRead - failure is reported by hipGetLastError (and the same for hipAmdFileWrite). Alternatively, add or update the entry in uncovered_apis.txt with a concrete reason, such as needing AIS hardware. Then regenerate TEST_PLAN.md.
f8d3ce1 to
ee9636f
Compare
|
@mangupta Replies to the two findings in the review summary: CHANGELOG entry: Contract test / |
ee9636f to
d4e7e6b
Compare
|
🤖 AI-assisted pre-review (for @mangupta) Re-reviewed the updated head ( |
hipAmdFileRead/hipAmdFileWrite returned with a plain `return`, so hipGetLastError/hipPeekAtLastError never saw their failures. Return through HIP_RETURN_NOLOG, as the other internal entry points do, so the thread-local last error is updated without adding API log output. Changes: - hip_storage.cpp: replace the plain returns with HIP_RETURN_NOLOG - hip_storage.h: add @returns to both declarations - hip-tests: add Unit_hipAmdFileIo_* (invalid fd, null device pointer, valid args error-state consistency, write/read round trip) to DeviceTest; the round trip needs AIS-capable hardware and is disabled pending triage (AIRUNTIME-2892) AIRUNTIME-3128 🤖 Claude Code 🤖
d4e7e6b to
46806a4
Compare
## Motivation `hipAmdFileRead`/`hipAmdFileWrite` are the internal entry points hipFile uses (via `hipGetProcAddress`) for AIS file I/O. They returned `hipError_t` with a plain `return` instead of going through the HIP error-state macros, so failures never reached the thread-local last-error state. hipFile returns -5011 on HIP runtime errors and expects callers to read the details with `hipPeekAtLastError`, which currently reports nothing. ## Technical Details - **hip_storage.cpp:** replace the plain returns with `HIP_RETURN_NOLOG` (as the other internal entry points do) so these functions update the last error without adding API log output. Error codes are unchanged. - **hip_storage.h:** add `@returns` to the two declarations. - **hip-tests:** add `Unit_hipAmdFileIo_*` to DeviceTest (Linux): invalid fd, null device pointer, valid-args error-state consistency, and a write/read round trip. The round trip needs AIS-capable hardware and is disabled on all targets pending triage (AIRUNTIME-2892). ## Issue Tracking JIRA ID: AIRUNTIME-3128 ## Test Plan - Built hip-clr and hip-tests in TheRock on Linux (gfx1030, RX 6800 XT, no AIS support). - Ran the enabled `Unit_hipAmdFileIo_*` tests with `HIP_TEST_STRICT_LAST_ERROR=1`. ## Test Result - The three enabled `Unit_hipAmdFileIo_*` tests pass in strict last-error mode. `Unit_hipAmdFileIo_Positive_WriteRead` is tagged `[disabled]`; the AIS success path was not exercised locally. ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/rocm-systems/blob/develop/CONTRIBUTING.md. [rocm-systems] ROCm/rocm-systems#14863 (commit b4c53da)
TheRock Submodule Bump ActivityNewest first
|
Motivation
hipAmdFileRead/hipAmdFileWriteare the internal entry points hipFile uses (viahipGetProcAddress) for AIS file I/O. They returnedhipError_twith a plainreturninstead of going through the HIP error-state macros, so failures never reached the thread-local last-error state. hipFile returns -5011 on HIP runtime errors and expects callers to read the details withhipPeekAtLastError, which currently reports nothing.Technical Details
HIP_RETURN_NOLOG(as the other internal entry points do) so these functions update the last error without adding API log output. Error codes are unchanged.@returnsto the two declarations.Unit_hipAmdFileIo_*to DeviceTest (Linux): invalid fd, null device pointer, valid-args error-state consistency, and a write/read round trip. The round trip needs AIS-capable hardware and is disabled on all targets pending triage (AIRUNTIME-2892).Issue Tracking
JIRA ID: AIRUNTIME-3128
Test Plan
Unit_hipAmdFileIo_*tests withHIP_TEST_STRICT_LAST_ERROR=1.Test Result
Unit_hipAmdFileIo_*tests pass in strict last-error mode.Unit_hipAmdFileIo_Positive_WriteReadis tagged[disabled]; the AIS success path was not exercised locally.Submission Checklist
🤖 Claude Code 🤖