Skip to content

fix(hipdnn): fail fast on plan-only override execute without override enabled#8881

Merged
SamuelReeder merged 5 commits into
developfrom
users/sareeder/almiopen-2244-planonly-override-failfast
Jun 30, 2026
Merged

fix(hipdnn): fail fast on plan-only override execute without override enabled#8881
SamuelReeder merged 5 commits into
developfrom
users/sareeder/almiopen-2244-planonly-override-failfast

Conversation

@SamuelReeder

@SamuelReeder SamuelReeder commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

The frontend override execute() overload fails fast when override args are supplied to a graph that did not enable override shapes — but only for full graphs. The plan-only deserialize_compiled_plan branch skipped the override-enabled check, so misuse on a plan-only object was only caught later at the backend dispatch guard. This makes the plan-only branch fail fast in the frontend, matching the full-graph branch. Part of the overridable tensor shapes work (RFC 0008).

JIRA ID : ALMIOPEN-2244

Risk Assessment

Medium risk. Adds a read-only backend execution-plan attribute (API addition) and changes the plan-only override-execute path to reject earlier. The new rejection only fires for misuse the backend dispatch guard already rejected authoritatively, so no legitimate path changes: plan-only overrides on an override-enabled plan still execute, and full-graph behavior is unchanged. No serialization format change. Blast radius is ASIC-independent (see below), so passing PR CI is sufficient.

Testing Summary

  • Backend unit tests: new attribute round-trips through deserialize → getAttribute for both flag states; existing plan-descriptor, serialization, and enum-string suites unaffected.
  • Frontend GPU integration tests: new plan-only fail-fast regression (rejects with INVALID_VALUE and never dispatches to the provider); full override-execute suite for no regressions.
  • Commit hooks (clang-format, whitespace) on all changed files.

Testing Checklist

  • hipDNN backend unit tests - hipdnn_backend_tests --gtest_filter='TestExecutionPlanDescriptor.*:*SerializationApi*:*BackendEnumStringUtils*:*IsOverrideShapeEnabledExt*' - ASICs: gfx90a - Status: Passed (74)
  • hipDNN frontend override integration tests - hipdnn_public_frontend_tests --gtest_filter='*Override*' - ASICs: gfx90a - Status: Passed (35)
  • Commit hooks - pre-commit run --files <changed> - Status: Passed
  • PR CI - GitHub PR checks - Status: Pending

Technical Changes

  • Add read-only HIPDNN_ATTR_EXECUTION_PLAN_IS_OVERRIDE_SHAPE_ENABLED_EXT with a getAttribute case on ExecutionPlanDescriptor (mirrors ENGINE_GLOBAL_INDEX_EXT; no serialization change) plus its enum-name mapping. The attribute is required because the override-enabled flag, while already preserved across the plan round-trip in the backend (serialized into the plan flatbuffer, restored on deserialize), was unreachable from the header-only frontend: getAttribute did not surface it, deserialize_compiled_plan hard-coded it to false, and no operation-graph or engine-config descriptor is reconstructed on the plan-only path. The only no-new-attribute alternative — parsing the backend plan flatbuffer in the frontend — would couple the frontend to the backend wire format and version gate.
  • Recover the flag in deserialize_compiled_plan via a new getExecutionPlanOverrideShapeEnabled frontend helper instead of forcing false.
  • Reject override args in the plan-only branch of the override execute() overload with INVALID_VALUE, short-circuiting before any provider dispatch.
  • Add backend tests for the attribute (both flag states) and enum-name mapping, and a frontend GPU regression test for the plan-only fail-fast.

…t override enabled

The frontend override execute() overload fails fast when override args are
supplied to a graph that did not enable override shapes, but only for full
graphs. The plan-only (compiled-plan-deserialized) branch skipped the
override-enabled check, so misuse on a plan-only object was only caught later
at the backend dispatch guard.

deserialize_compiled_plan hard-coded the flag to false, so it could not be
checked as-is. The flag is preserved in the backend ExecutionPlanDescriptor
(serialized into the plan flatbuffer, restored on deserialize) but was not
reachable from the frontend: getAttribute did not surface it, and no operation
graph or engine config descriptor is reconstructed on the plan-only path. The
only no-new-attribute alternative is parsing the backend flatbuffer in the
header-only frontend, which couples it to the wire format and version gate.

Surface the flag through the existing C attribute API instead:
- Add read-only HIPDNN_ATTR_EXECUTION_PLAN_IS_OVERRIDE_SHAPE_ENABLED_EXT and a
  getAttribute case mirroring ENGINE_GLOBAL_INDEX_EXT (no serialization change).
- Recover it in deserialize_compiled_plan via a new frontend helper.
- Check it in the plan-only branch, returning INVALID_VALUE to match the
  full-graph branch and short-circuit before any provider dispatch.
@SamuelReeder SamuelReeder self-assigned this Jun 26, 2026
@SamuelReeder SamuelReeder changed the title [hipDNN] ALMIOPEN-2244 Fail fast on plan-only override execute without override enabled fix(hipdnn): fail fast on plan-only override execute without override enabled Jun 26, 2026
@therock-pr-bot

therock-pr-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

❌ PR Check — Action Required

Check Status Details
🌿 Branch Name ✅ Pass
📝 PR Title/Description ✅ Pass
Forbidden Files ✅ Pass
🧪 Unit Test ❌ Fail 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/hipdnn/backend/include/HipdnnBackendAttributeName.h, projects/hipdnn/backend/src/BackendEnumStringUtils.hpp, projects/hipdnn/backend/src/descriptors/ExecutionPlanDescriptor.cpp, projects/hipdnn/backend/tests/TestBackendEnumStringUtils.cpp, projects/hipdnn/backend/tests/descriptors/TestExecutionPlanDescriptor.cpp (+4 more); no test file found
🔎 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

  • ❌ Unit Test

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:

  • ❌ Unit Test

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

@SamuelReeder

SamuelReeder commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

I think therock-pr-bot expects a different test name format than ours. I could add additional tests but it will not fix the warning for the time-being.

@SamuelReeder SamuelReeder marked this pull request as ready for review June 29, 2026 15:25
@SamuelReeder SamuelReeder requested a review from a team as a code owner June 29, 2026 15:25
Comment thread projects/hipdnn/tests/frontend/IntegrationOverrideExecute.cpp
Comment thread projects/hipdnn/tests/frontend/IntegrationOverrideExecute.cpp
Comment thread projects/hipdnn/tests/frontend/IntegrationOverrideExecute.cpp

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

Some minor clean-up, and testing improvements, but approving.

@codecov-commenter

codecov-commenter commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.61905% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../hipdnn/frontend/include/hipdnn_frontend/Graph.hpp 96.43% 0 Missing and 1 partial ⚠️

❌ Your project status has failed because the head coverage (76.92%) 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    #8881      +/-   ##
===========================================
- Coverage    71.34%   71.32%   -0.02%     
===========================================
  Files         2613     2613              
  Lines       408997   409193     +196     
  Branches     61114    61118       +4     
===========================================
+ Hits        291775   291817      +42     
- Misses       95825    95977     +152     
- Partials     21397    21399       +2     
Flag Coverage Δ *Carryforward flag
TensileLite 76.98% <ø> (ø) Carriedforward from e76e5aa
hipBLAS 90.81% <ø> (ø) Carriedforward from e76e5aa
hipBLASLt 41.36% <ø> (ø) Carriedforward from e76e5aa
hipCUB 82.68% <ø> (ø) Carriedforward from e76e5aa
hipDNN 86.53% <97.62%> (-0.27%) ⬇️
hipFFT 50.17% <ø> (ø) Carriedforward from e76e5aa
hipRAND 76.12% <ø> (ø) Carriedforward from e76e5aa
hipSOLVER 69.18% <ø> (ø) Carriedforward from e76e5aa
hipSPARSE 86.55% <ø> (ø) Carriedforward from e76e5aa
rocBLAS 48.08% <ø> (ø) Carriedforward from e76e5aa
rocFFT 46.30% <ø> (ø) Carriedforward from e76e5aa
rocRAND 57.07% <ø> (ø) Carriedforward from e76e5aa
rocSOLVER 76.92% <ø> (ø) Carriedforward from e76e5aa
rocSPARSE 72.37% <ø> (ø) Carriedforward from e76e5aa
rocThrust 91.36% <ø> (ø) Carriedforward from e76e5aa

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
...ects/hipdnn/backend/src/BackendEnumStringUtils.hpp 98.84% <100.00%> (+0.20%) ⬆️
...ackend/src/descriptors/ExecutionPlanDescriptor.cpp 85.48% <100.00%> (+0.37%) ⬆️
...hipdnn_frontend/detail/DescriptorUnpackHelpers.hpp 84.31% <100.00%> (-0.17%) ⬇️
.../hipdnn/frontend/include/hipdnn_frontend/Graph.hpp 86.16% <96.43%> (+0.19%) ⬆️

... and 5 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.

@SamuelReeder SamuelReeder merged commit 84dc26e into develop Jun 30, 2026
37 of 38 checks passed
@SamuelReeder SamuelReeder deleted the users/sareeder/almiopen-2244-planonly-override-failfast branch June 30, 2026 05:37
JP-Fernando pushed a commit that referenced this pull request Jul 1, 2026
… enabled (#8881)

## Summary

The frontend override `execute()` overload fails fast when override args
are supplied to a graph that did not enable override shapes — but only
for full graphs. The plan-only
[deserialize_compiled_plan](https://github.com/ROCm/rocm-libraries/blob/f1230db5ef05ba6cf6413741a1b58b6a80473a8a/projects/hipdnn/frontend/include/hipdnn_frontend/Graph.hpp#L1571)
branch skipped the override-enabled check, so misuse on a plan-only
object was only caught later at the backend dispatch guard. This makes
the plan-only branch fail fast in the frontend, matching the full-graph
branch. Part of the overridable tensor shapes work ([RFC
0008](https://github.com/ROCm/rocm-libraries/blob/develop/projects/hipdnn/docs/rfcs/0008_OverridableTensorShapesDesign.md)).

JIRA ID : ALMIOPEN-2244

## Risk Assessment

Medium risk. Adds a read-only backend execution-plan attribute (API
addition) and changes the plan-only override-execute path to reject
earlier. The new rejection only fires for misuse the backend dispatch
guard already rejected authoritatively, so no legitimate path changes:
plan-only overrides on an override-enabled plan still execute, and
full-graph behavior is unchanged. No serialization format change. Blast
radius is ASIC-independent (see below), so passing PR CI is sufficient.

## Testing Summary

- Backend unit tests: new attribute round-trips through deserialize →
`getAttribute` for both flag states; existing plan-descriptor,
serialization, and enum-string suites unaffected.
- Frontend GPU integration tests: new plan-only fail-fast regression
(rejects with `INVALID_VALUE` and never dispatches to the provider);
full override-execute suite for no regressions.
- Commit hooks (clang-format, whitespace) on all changed files.

## Testing Checklist

- [x] hipDNN backend unit tests - `hipdnn_backend_tests
--gtest_filter='TestExecutionPlanDescriptor.*:*SerializationApi*:*BackendEnumStringUtils*:*IsOverrideShapeEnabledExt*'`
- ASICs: gfx90a - Status: Passed (74)
- [x] hipDNN frontend override integration tests -
`hipdnn_public_frontend_tests --gtest_filter='*Override*'` - ASICs:
gfx90a - Status: Passed (35)
- [x] Commit hooks - `pre-commit run --files <changed>` - Status: Passed
- [ ] PR CI - GitHub PR checks - Status: Pending

## Technical Changes

- Add read-only
`HIPDNN_ATTR_EXECUTION_PLAN_IS_OVERRIDE_SHAPE_ENABLED_EXT` with a
`getAttribute` case on `ExecutionPlanDescriptor` (mirrors
`ENGINE_GLOBAL_INDEX_EXT`; no serialization change) plus its enum-name
mapping. The attribute is required because the override-enabled flag,
while already preserved across the plan round-trip in the backend
(serialized into the plan flatbuffer, restored on deserialize), was
unreachable from the header-only frontend: `getAttribute` did not
surface it, `deserialize_compiled_plan` hard-coded it to `false`, and no
operation-graph or engine-config descriptor is reconstructed on the
plan-only path. The only no-new-attribute alternative — parsing the
backend plan flatbuffer in the frontend — would couple the frontend to
the backend wire format and version gate.
- Recover the flag in `deserialize_compiled_plan` via a new
`getExecutionPlanOverrideShapeEnabled` frontend helper instead of
forcing `false`.
- Reject override args in the plan-only branch of the override
`execute()` overload with `INVALID_VALUE`, short-circuiting before any
provider dispatch.
- Add backend tests for the attribute (both flag states) and enum-name
mapping, and a frontend GPU regression test for the plan-only fail-fast.
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.

3 participants