Skip to content

fix(hipdnn): expose python error code bindings#9290

Open
tvy-amd wants to merge 1 commit into
developfrom
user/tvy/almiopen-2257-update-python-bindings-missing-error-codes
Open

fix(hipdnn): expose python error code bindings#9290
tvy-amd wants to merge 1 commit into
developfrom
user/tvy/almiopen-2257-update-python-bindings-missing-error-codes

Conversation

@tvy-amd

@tvy-amd tvy-amd commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Exposes every hipdnn_frontend::ErrorCode value through the Python hipdnn.ErrorCode nanobind enum.
  • Adds a CPU-only drift-prevention pytest that derives expected enum names from frontend/include/hipdnn_frontend/Error.hpp and verifies each one is usable with hipdnn.Error.

Risk assessment

  • Low risk: binding-only enum exposure; no C++ enum, backend status, provider, FlatBuffers, or execution-path changes.
  • Main risk is stale or incomplete enum parity; covered by the new source-header-derived Python test.

Testing summary

  • uvx --system-certs pre-commit run --files projects/hipdnn/python/hipdnn_frontend/test/test_error_paths.py projects/hipdnn/python/src/types_bindings.cpp — passed.
  • Static enum parity check compared frontend/include/hipdnn_frontend/Error.hpp against python/src/types_bindings.cpp — passed.
  • cmake -B build-superbuild -GNinja -DROCM_LIBS_ENABLE_COMPONENTS="hipdnn;miopen-provider" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/rocm-clang.cmake -DCMAKE_INSTALL_PREFIX=/home/tvy/dev/WIP/worktrees/rocm-libraries/ALMIOPEN-2257/superbuild/install — blocked locally: /opt/rocm/lib/llvm/bin is absent on this workstation.
  • pytest red/green run was not available before environment setup because the workstation had no pytest command and no built hipdnn_frontend_python extension.

Testing checklist

  • Pre-commit on changed files
  • Static enum parity check
  • Local superbuild
  • Python binding pytest against rebuilt extension

Technical changes

  • projects/hipdnn/python/src/types_bindings.cpp: adds missing ErrorCode enum values to the Python binding.
  • projects/hipdnn/python/hipdnn_frontend/test/test_error_paths.py: adds TestErrorCodeBindings to prevent future C++/Python enum drift.

JIRA ID: ALMIOPEN-2257

@therock-pr-bot

therock-pr-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

❌ PR Check — Action Required

Check Status Details
🌿 Branch Name ❌ Fail Branch name does not match allowed patterns.
Branch: user/tvy/almiopen-2257-update-python-bindings-missing-error-codes
Allowed patterns:
- ^users\/[A-Za-z0-9][A-Za-z0-9\-]*\/.+
- ^shared\/.+
- ^[A-Za-z0-9][A-Za-z0-9\-_]*$
- ^dependabot\/.+
- ^revert-[0-9]+-.+
📝 PR Title/Description ✅ Pass
Forbidden Files ✅ Pass
🧪 Unit Test ✅ Pass
🔎 pre-commit ✅ Pass
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled

⚠️ 1 policy check(s) failed. Please address the issues above before this PR can be Reviewed.

🚫 Please fix the failed policies

  • ❌ Branch Name

The Not ready to Review label was added to this PR. Once all policies pass, the label is removed automatically.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

@therock-pr-bot

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ Branch Name

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



def _error_code_names_from_header() -> list[str]:
error_header = _hipdnn_project_root() / "frontend/include/hipdnn_frontend/Error.hpp"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This may be harder to do later when the bindings move out, but for now this is the best we got for making sure the bindings don't get out of sync with the cpp

@tvy-amd tvy-amd marked this pull request as ready for review July 10, 2026 21:21
@tvy-amd tvy-amd requested a review from a team as a code owner July 10, 2026 21:21
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

❌ Your project status has failed because the head coverage (76.84%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #9290   +/-   ##
========================================
  Coverage    65.07%   65.07%           
========================================
  Files         2685     2685           
  Lines       422262   422262           
  Branches     62741    62741           
========================================
+ Hits        274750   274754    +4     
+ Misses      126793   126791    -2     
+ Partials     20719    20717    -2     
Flag Coverage Δ *Carryforward flag
TensileLite 35.05% <ø> (ø) Carriedforward from a2799c7
hipBLAS 90.81% <ø> (ø) Carriedforward from a2799c7
hipBLASLt 34.69% <ø> (ø) Carriedforward from a2799c7
hipCUB 82.68% <ø> (ø) Carriedforward from a2799c7
hipDNN 86.13% <ø> (+0.01%) ⬆️
hipFFT 50.88% <ø> (ø) Carriedforward from a2799c7
hipRAND 76.12% <ø> (ø) Carriedforward from a2799c7
hipSOLVER 69.18% <ø> (ø) Carriedforward from a2799c7
hipSPARSE 86.10% <ø> (ø) Carriedforward from a2799c7
rocBLAS 47.91% <ø> (ø) Carriedforward from a2799c7
rocFFT 51.65% <ø> (ø) Carriedforward from a2799c7
rocRAND 57.02% <ø> (ø) Carriedforward from a2799c7
rocSOLVER 76.84% <ø> (ø) Carriedforward from a2799c7
rocSPARSE 72.37% <ø> (ø) Carriedforward from a2799c7
rocThrust 91.36% <ø> (ø) Carriedforward from a2799c7

*This pull request uses carry forward flags. Click here to find out more.
see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants