Skip to content

ci(hipfile): Add a test that hipfile.h is valid C11 and C++11 - #13862

Merged
derobins merged 1 commit into
developfrom
users/derobins/check_hipfile_h_c11
Oct 21, 2026
Merged

derobins merged 1 commit into
developfrom
users/derobins/check_hipfile_h_c11

Conversation

@derobins

@derobins derobins commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

The hipfile.h header needs to hew to C11/C++11 and nothing tests that this doesn't drift.

Technical Details

hipfile.h is compiled as C11 and C++11 with -Wall -Wextra -Werror -pedantic. It's included first in its own C source file to check that it compiles on its own, and every macro it defines is used. The source is compiled as C, and as C++ from a copy CMake makes in the build directory. The objects are never linked, so a failure breaks the build.

This found that hipfile.h uses struct timespec without including <time.h>. In C, the struct was declared only inside the parameter list of hipFileBatchIOGetStatus(), so it didn't match the struct timespec from <time.h>. hipfile.h now includes <time.h>.

Issue Tracking

JIRA ID: ROCM-28534

Test Plan

CI passes

Test Result

Success

Submission Checklist

@derobins
derobins requested review from a team as code owners October 20, 2026 22:09
Copilot AI balanced review requested due to automatic review settings October 20, 2026 22:09
@therock-pr-bot

therock-pr-bot Bot commented Oct 20, 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/hipfile/include/hipfile.h, projects/hipfile/test/header/header-check.c; 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?

@therock-pr-bot

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ PR Description

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are focused, and no unresolved correctness or integration issues were identified.

No open issues 🎉

What changed in this PR

Adds compile-only checks to keep hipfile.h self-contained and compatible with C11 and C++11.

Changes:

  • Compiles the header and exercises its macros with strict warnings.
  • Enables the checks for AMD-detail builds.
  • Adds the missing <time.h> include and documents the fix.
File Description
projects/​hipfile/​test/​header/​header-check.c Includes the header first and exercises its macros.
projects/​hipfile/​test/​header/​CMakeLists.txt Configures strict C11 and C++11 compilation checks.
projects/​hipfile/​test/​CMakeLists.txt Enables header checks for AMD-detail builds.
projects/​hipfile/​include/​hipfile.h Includes <time.h> for struct timespec.
projects/​hipfile/​CHANGELOG.md Documents the C compatibility fix.

Review effort: Balanced

@derobins
derobins force-pushed the users/derobins/check_hipfile_h_c11 branch from 14e13b6 to f668315 Compare October 20, 2026 22:24
@derobins derobins changed the title Add a test that hipfile.h is valid C11 and C++11 ci(hipfile): Add a test that hipfile.h is valid C11 and C++11 Oct 20, 2026
hipfile.h is compiled as C11 and C++11 with -Wall -Wextra -Werror
-pedantic. It's included first in its own C source file to check that it
compiles on its own, and every macro it defines is used. The source is
compiled as C, and as C++ from a copy CMake makes in the build
directory. The objects are never linked, so a failure breaks the build.

This found that hipfile.h uses struct timespec without including
<time.h>. In C, the struct was declared only inside the parameter list
of hipFileBatchIOGetStatus(), so it didn't match the struct timespec
from <time.h>. hipfile.h now includes <time.h>.

Co-Authored-By: Claude <noreply@anthropic.com>
@derobins
derobins force-pushed the users/derobins/check_hipfile_h_c11 branch from f668315 to 3b75455 Compare October 21, 2026 16:25
@derobins
derobins merged commit caa0947 into develop Oct 21, 2026
208 of 209 checks passed
@derobins
derobins deleted the users/derobins/check_hipfile_h_c11 branch October 21, 2026 17:20
@systems-assistant

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

pmoutsias-amd added a commit that referenced this pull request Nov 5, 2026
…branch to the (Unreleased) hipFile 0.7.0 section (#14918)

These 4 CHANGELOG entries sit in release sections, but the code was
merged to develop after the `rocm-systems` commit that TheRock
`release/therock-10.2` pins (`ded49fd`), and is not in that commit. This
moves them into `## (Unreleased) hipFile 0.7.0`, under the matching
subsections.

- #13473 (merged 2026-10-15,
and its merge commit is not in `ded49fd`), moved from the `hipFile 0.6.0
for ROCm 10.2.0` section:
> * MD and LVM software RAID arrays running pass-through personalities
whose member devices are all local NVMe are now fastpath capable, and
`ais-check` reports them as such.
- #13473 (merged 2026-10-15,
and its merge commit is not in `ded49fd`), moved from the `hipFile 0.6.0
for ROCm 10.2.0` section:
> * `ais-check` no longer reports an LVM parity RAID logical volume
(`raid4`, `raid5`, `raid6`) as fastpath capable.
- #13657 (merged 2026-10-16,
and its merge commit is not in `ded49fd`), moved from the `hipFile 0.6.0
for ROCm 10.2.0` section:
> * Per-GPU I/O statistics are now attributed to the GPU that owns the
I/O buffer instead of the caller's active HIP device. Previously,
`hipFileGetStatsL3()` and `ais-stats` could report counters against the
wrong GPU when the active device differed from the buffer's device.
- #13862 (merged 2026-10-21,
and its merge commit is not in `ded49fd`), moved from the `hipFile 0.6.0
for ROCm 10.2.0` section:
> * `hipfile.h` now includes `<time.h>`, which declares the `struct
timespec` used by `hipFileBatchIOGetStatus()`. Previously, C code that
included `<time.h>` after `hipfile.h` got an incompatible pointer type
error or warning when passing a `struct timespec *` to
`hipFileBatchIOGetStatus()`.

Only the CHANGELOG is changed. Version macros are left to the component
owners.

JIRA ID : AIROCDOC-4467
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.

5 participants