Repository navigation
Add hipObjGetVersion(), and take the docs version from CMake - #251
Merged
Merged
Conversation
Add hipObjGetVersion(), which returns the running library's major, minor, and patch version as numbers, like hipFile's hipFileGetVersion(). A NULL argument skips that part, and it doesn't need hipObjInit(). A program can compare the numbers with the HIPOBJ_VERSION_* macros to check that the library it loaded can be used with the header it was compiled with, without parsing hipObjGetVersionString()'s text. The new get-version example shows how. It prints both versions and exits with status 1 if they're incompatible. It's installed with the other examples, and it needs no GPU, so ctest runs it as hipobj-example-get-version. The tests check the values against the header, every combination of NULL arguments, agreement with hipObjGetVersionString(), calls before, during, and after initialization, and calls from a callback and from many threads. Other versioning changes: - HIPOBJ_LIBRARY_VERSION is no longer a cache variable. A cache entry is written only on the first configure, so a version bump didn't reach an existing build directory: the soname, packages, and docs kept the old version while the header had the new one. - docs/conf.py takes its version from CMake (@PROJECT_VERSION@) instead of a hardcoded copy. - Comments in CMakeLists.txt say that the version must match the header's macros, which hipobj-install checks, and that the soname has only the major version, so minor and patch releases must not break the ABI, except while the major version is 0. Co-Authored-By: Claude <noreply@anthropic.com>
derobins
requested review from
akolliasAMD,
gaoikawa,
jordan-turbofish,
kurtmcmillan,
riley-dixon,
sbates130272 and
zbyrne
as code owners
October 17, 2026 21:09
Contributor
Security scan found no critical or high findings on lines changed by this pull requestView the security scan run for complete reports. “New” means the finding is located in a changed file on an added or modified line; it is not a base-versus-head findings delta. |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
Static review found only a minor changelog omission and no blocking correctness issues; builds and tests were not run.
1 open issue
What changed in this PR
Adds numeric runtime version queries to hipObject and keeps build and documentation versions synchronized.
Changes:
- Adds
hipObjGetVersion()with nullable outputs and no initialization requirement. - Adds a compatibility-check example and API/concurrency tests.
- Removes cached library versioning and derives the documentation version from CMake.
| File | Description |
|---|---|
| test/unit/test-thread-safety.cpp | Tests concurrent and callback version queries. |
| test/unit/test-api-args.cpp | Tests values, null arguments, and initialization independence. |
| test/install/run-package-test.cmake | Checks example packaging. |
| test/install/run-install-test.cmake | Clarifies why installed examples aren't run. |
| src/hipobj.cpp | Implements numeric version queries. |
| include/hipobj.h | Declares and documents the API. |
| examples/README.md | Documents the compatibility example. |
| examples/get-version.cpp | Demonstrates runtime compatibility checks. |
| examples/CMakeLists.txt | Builds and registers the example test. |
| examples/CMakeLists.install.cmake | Builds the installed example as C++11. |
| docs/conf.py | Uses CMake's project version. |
| docs/architecture.rst | Lists the new initialization-independent API. |
| CMakeLists.txt | Removes version caching and explains ABI expectations. |
| cmake/HIPOBJInstall.cmake | Installs the new example source. |
| cmake/HIPOBJDocumentation.cmake | Updates the configuration comment. |
| CHANGELOG.md | Announces the API and example. |
Review effort: Balanced
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.

Add hipObjGetVersion(), which returns the running library's major, minor, and patch version as numbers, like hipFile's hipFileGetVersion(). A NULL argument skips that part, and it doesn't need hipObjInit(). A program can compare the numbers with the HIPOBJ_VERSION_* macros to check that the library it loaded can be used with the header it was compiled with, without parsing hipObjGetVersionString()'s text.
The new get-version example shows how. It prints both versions and exits with status 1 if they're incompatible. It's installed with the other examples, and it needs no GPU, so ctest runs it as hipobj-example-get-version. The tests check the values against the header, every combination of NULL arguments, agreement with hipObjGetVersionString(), calls before, during, and after initialization, and calls from a callback and from many threads.
Other versioning changes: