Skip to content

fix(amdsmi): report N/A driver date when the kernel has none - #13358

Merged
marifamd merged 1 commit into
developfrom
users/marifamd/driver-date-na
Oct 13, 2026
Merged

marifamd merged 1 commit into
developfrom
users/marifamd/driver-date-na

Conversation

@marifamd

@marifamd marifamd commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

amdsmi_get_gpu_driver_info() reports driver_date as 0 on kernels that no longer use the DRM driver date, such as the Ubuntu 6.11 kernel in an SR-IOV guest. 0 is not a date, so report it as not available instead.

Technical Details

Library (src/amd_smi/amd_smi.cc, src/amd_smi/amd_smi_utils.cc, include/amd_smi/impl/amd_smi_utils.h):

  • Move the driver date formatting into smi_amdgpu_format_driver_date(), which returns an empty string for the kernel's 0
  • amdsmi_get_gpu_driver_info() leaves driver_date empty in that case, like the other driver fields that can be unavailable

Python (py-interface/amdsmi_interface.py): no change, it already maps empty driver fields to N/A

CLI: no change, no subcommand prints the driver date

Tests:

  • SystemUnit.DriverDate* in tests/amd_smi_test/unit/system/dkms_versions_test.cc: 20150101, 0, empty, and an unexpected format
  • tests/python/unit/system/test_driver_versions.py: assert driver_date renders N/A when empty

Docs:

  • driver_date row in the Python API reference
  • CHANGELOG entry under 10.2.0 Resolved Issues

Issue Tracking

JIRA ID: ROCM-32689

Test Plan

  • amdsmitst --gtest_filter='*Unit*'
  • tests/python/unit/system/test_driver_versions.py against this build
  • amdsmi_get_gpu_driver_info() on bare metal (Navi 21, kernel 6.8) and on an SR-IOV guest (Radeon PRO V710 VF, Ubuntu 6.11 kernel)

Test Result

  • C++ unit tests: 237 passed, 18 skipped (existing), 0 failed
  • Python test passes
  • Bare metal: driver_date stays 2015/01/01 00:00
  • SR-IOV guest: driver_date was 0 with the develop build and is N/A with this change (the kernel's raw DRM date is 0)
  • pre-commit passes

- Return an empty driver_date from amdsmi_get_gpu_driver_info() when
  the kernel reports the DRM driver date as 0, so Python shows N/A
- Move the date formatting into smi_amdgpu_format_driver_date() and
  unit-test it
- Assert driver_date renders N/A in the Python empty-fields test
- Document driver_date in the Python API reference and add a CHANGELOG
  entry

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
@marifamd
marifamd requested a review from a team October 13, 2026 15:18
@github-actions github-actions Bot added documentation Improvements or additions to documentation project: amdsmi labels Oct 13, 2026
@therock-pr-bot

therock-pr-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

✅ All Policy Checks Passed

Check Status Details
📝 PR Description ✅ Pass —
⛔ Forbidden Files ✅ Pass —
🧪 Unit Test ✅ Pass —
🚫 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.

@gabrpham gabrpham 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.

Looks good to me. Approved,

@marifamd
marifamd merged commit bf03269 into develop Oct 13, 2026
138 of 145 checks passed
@marifamd
marifamd deleted the users/marifamd/driver-date-na branch October 13, 2026 20:12
marifamd added a commit that referenced this pull request Oct 13, 2026
…smi-verification-fixes

Conflicts:
- CHANGELOG.md: keep develop's driver-date entry (#13358), then this
  PR's three 10.2.0 Resolved Issues entries.

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
@systems-assistant

Copy link
Copy Markdown
Contributor

TheRock Submodule Bump Activity

Newest first

JeniferC99 pushed a commit that referenced this pull request Oct 22, 2026
## Motivation
**Before:** ``amdsmi_driver_info_t`` was 768 bytes. #11821 grew it to
1792 bytes with four new string fields, but ``AMDSMI_LIB_VERSION_MAJOR``
stayed 27 and the library stayed ``libamd_smi.so.27``.
It also made ``amdsmi_get_gpu_driver_info()`` zero ``sizeof(*info)``, so
a binary built against the old header overflows its 768-byte buffer by
1024 bytes.

**After:** the struct is 768 bytes again and
``amdsmi_get_gpu_driver_info()`` fills only ``driver_version``,
``driver_date`` and ``driver_name``. The ``driver_date`` fix from #13358
stays.

## Technical Details
**Public header** (``include/amd_smi/amdsmi.h``):
- Drop ``driver_kernel_version``, ``amdgpu_driver_version``,
``driver_build_version`` and ``driver_full_version``
- Drop the ``@details`` block on ``amdsmi_get_gpu_driver_info()``

**Library** (``src/amd_smi/amd_smi.cc``,
``src/amd_smi/amd_smi_utils.cc``,
``include/amd_smi/impl/amd_smi_utils.h``,
``src/amd_smi/amd_smi_wsl_device.cc``):
- Remove the DKMS lookup and version parsing helpers and the WSL
``driver_full_version`` copy
- Keep ``smi_amdgpu_format_driver_date()`` from #13358

**Python and Rust** (``py-interface/``, ``rust-interface/``):
- Drop the four fields from the wrappers, the Python dictionary and the
Rust getters
- Keep ``AmdsmiVramTypeHbm4``, which ``amdsmi.h`` still defines

**CLI** (``amdsmi_cli/``):
- The default banner, ``amd-smi version`` and ``amd-smi static
--driver`` read ``driver_version`` again

**Docs and example** (``CHANGELOG.md``, ``docs/``,
``example/amd_smi_drm_example.cc``):
- Remove both copies of the 10.2.0 "Added" entry (``develop`` has it
twice) and the "Changed" entry
- Restore the CLI examples and the Python API field table, keeping the
``driver_date`` row

**Tests** (``tests/``):
- Remove the DKMS, CLI and struct-layout tests that #11821 added
- Move the ``driver_date`` tests from #13358 into
``driver_date_test.cc`` and ``test_driver_date.py``, because their old
files were created by #11821

## Scope rationale
- NOT reverting #13358: the ``driver_date`` fix does not depend on the
new fields
- NOT bumping ``AMDSMI_LIB_VERSION_MAJOR``: this restores the layout
that 27.x callers already have
- NOT adding a versioned struct or a new API for the version details: a
separate change if the fields are wanted again


## JIRA ID
JIRA ID: ROCM-24167

## Test Plan
- [x] Build ``amdsmitst`` with ``-DBUILD_TESTS=ON -DBUILD_CLI=OFF``
- [x] ``amdsmitst --gtest_filter='SystemUnit.DriverDate*'`` and
``'*Unit.*'``
- [x] ``python3 -m unittest`` for ``test_driver_date.py`` and
``test_cli_static_bus_pcie.py``
- [x] ``check_test_conventions.py`` and the amdsmi ``pre-commit`` config
- [ ] GPU host, WSL build, Rust build and CLI end to end: not run

## Test Result
- ``SystemUnit.DriverDate*``: 3 passed. ``*Unit.*``: 289 passed, 0
failed
- ``test_driver_date.py``: 1 passed. ``test_cli_static_bus_pcie.py``: 4
passed
- Conventions check and ``pre-commit`` pass
- A plain ``git revert`` conflicted in 7 files with later commits
(#13358, #11075 and others), all resolved by hand

## Submission Checklist

- [ ] Look over the contributing guidelines at
https://github.com/ROCm/rocm-systems/blob/develop/CONTRIBUTING.md.

Signed-off-by: Oliveira, Daniel <daniel.oliveira@amd.com>
JeniferC99 pushed a commit that referenced this pull request Oct 28, 2026
…4489)

Cherry pick of f1e0b35 - had merge
conflicts, needs manual checking of
`projects/amdsmi/py-interface/amdsmi_wrapper.py`
JIRA ID: AIRDEL-117

--------------

**Before:** ``amdsmi_driver_info_t`` was 768 bytes. #11821 grew it to
1792 bytes with four new string fields, but ``AMDSMI_LIB_VERSION_MAJOR``
stayed 27 and the library stayed ``libamd_smi.so.27``. It also made
``amdsmi_get_gpu_driver_info()`` zero ``sizeof(*info)``, so a binary
built against the old header overflows its 768-byte buffer by 1024
bytes.

**After:** the struct is 768 bytes again and
``amdsmi_get_gpu_driver_info()`` fills only ``driver_version``,
``driver_date`` and ``driver_name``. The ``driver_date`` fix from #13358
stays.
**Public header** (``include/amd_smi/amdsmi.h``):
- Drop ``driver_kernel_version``, ``amdgpu_driver_version``,
``driver_build_version`` and ``driver_full_version``
- Drop the ``@details`` block on ``amdsmi_get_gpu_driver_info()``

**Library** (``src/amd_smi/amd_smi.cc``,
``src/amd_smi/amd_smi_utils.cc``,
``include/amd_smi/impl/amd_smi_utils.h``,
``src/amd_smi/amd_smi_wsl_device.cc``):
- Remove the DKMS lookup and version parsing helpers and the WSL
``driver_full_version`` copy
- Keep ``smi_amdgpu_format_driver_date()`` from #13358

**Python and Rust** (``py-interface/``, ``rust-interface/``):
- Drop the four fields from the wrappers, the Python dictionary and the
Rust getters
- Keep ``AmdsmiVramTypeHbm4``, which ``amdsmi.h`` still defines

**CLI** (``amdsmi_cli/``):
- The default banner, ``amd-smi version`` and ``amd-smi static
--driver`` read ``driver_version`` again

**Docs and example** (``CHANGELOG.md``, ``docs/``,
``example/amd_smi_drm_example.cc``):
- Remove both copies of the 10.2.0 "Added" entry (``develop`` has it
twice) and the "Changed" entry
- Restore the CLI examples and the Python API field table, keeping the
``driver_date`` row

**Tests** (``tests/``):
- Remove the DKMS, CLI and struct-layout tests that #11821 added
- Move the ``driver_date`` tests from #13358 into
``driver_date_test.cc`` and ``test_driver_date.py``, because their old
files were created by #11821
- NOT reverting #13358: the ``driver_date`` fix does not depend on the
new fields
- NOT bumping ``AMDSMI_LIB_VERSION_MAJOR``: this restores the layout
that 27.x callers already have
- NOT adding a versioned struct or a new API for the version details: a
separate change if the fields are wanted again
JIRA ID: ROCM-24167
- [x] Build ``amdsmitst`` with ``-DBUILD_TESTS=ON -DBUILD_CLI=OFF``
- [x] ``amdsmitst --gtest_filter='SystemUnit.DriverDate*'`` and
``'*Unit.*'``
- [x] ``python3 -m unittest`` for ``test_driver_date.py`` and
``test_cli_static_bus_pcie.py``
- [x] ``check_test_conventions.py`` and the amdsmi ``pre-commit`` config
- [ ] GPU host, WSL build, Rust build and CLI end to end: not run
- ``SystemUnit.DriverDate*``: 3 passed. ``*Unit.*``: 289 passed, 0
failed
- ``test_driver_date.py``: 1 passed. ``test_cli_static_bus_pcie.py``: 4
passed
- Conventions check and ``pre-commit`` pass
- A plain ``git revert`` conflicted in 7 files with later commits
(#13358, #11075 and others), all resolved by hand

- [ ] Look over the contributing guidelines at
https://github.com/ROCm/rocm-systems/blob/develop/CONTRIBUTING.md.

## Motivation

<!-- Explain the purpose of this PR and the goals it aims to achieve.
-->

## Technical Details

<!-- Explain the changes along with any relevant GitHub links. -->

## Issue Tracking

<!-- Include a GitHub Issue and/or JIRA ID. Do not post any full JIRA
links here. -->
<!-- GitHub issue: #1234 -->
<!-- JIRA ID: EXAMPLECOMPONENT-1234 -->

## Test Plan

<!-- Explain any relevant testing done to verify this PR. -->

## Test Result

<!-- Briefly summarize test outcomes. -->

## Submission Checklist

- [ ] Look over the contributing guidelines at
https://github.com/ROCm/rocm-systems/blob/develop/CONTRIBUTING.md.

---------

Signed-off-by: Oliveira, Daniel <daniel.oliveira@amd.com>
Co-authored-by: Daniel Oliveira <daniel.oliveira@amd.com>
Co-authored-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
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