Skip to content

[hipDNN] Ragged tensor frontend, backend and schema#8728

Open
jerehartAMD wants to merge 6 commits into
developfrom
users/jerehart/ragged-tensor-frontend-and-schema
Open

[hipDNN] Ragged tensor frontend, backend and schema#8728
jerehartAMD wants to merge 6 commits into
developfrom
users/jerehart/ragged-tensor-frontend-and-schema

Conversation

@jerehartAMD

Copy link
Copy Markdown
Contributor

Motivation

This PR is based on RFC 0014, adding in ragged tensor support to the hipDNN frontend, backend and flatbuffer schema. It introduces the isRaggedTensorEnabled parameter to graphs to reject plugins without ragged tensor support.

In addition, it adds the alignment parameter to TensorAttributes, setting byte alignment requirements for

Technical Details

  • Schemas: tensor_attributes.fbs gains ragged_offset_tensor_uid (null = non-ragged) and alignment (default 16); graph.fbs gains is_ragged_tensor_enabled; execution_plan.fbs gains tensor_alignments[]
    (parallel to tensor_uids). All additive/defaulted ⇒ wire-compatible.
  • C-API attributes: ..._IS_RAGGED_TENSOR_ENABLED_EXT (610), ..._TENSOR_BYTE_ALIGNMENT (1308), ..._TENSOR_RAGGED_OFFSET_DESC (1309); wired through GraphDescriptor and TensorDescriptor.
  • Frontend: TensorAttributes gets set/get_ragged_offset, has_ragged_offset, set/get_alignment (validate rejects alignment < 1); Graph auto-detects the ragged flag by scanning node tensors at build time.
  • Plugin versioning: engine ABI minor bumped 1→2; ragged graphs require plugin ≥ 1.2.0, override graphs ≥ 1.1.0, else baseline. Below-floor plugins filtered from the applicable set.
  • Alignment enforcement: executeOpGraph checks each device pointer against the plan's per-UID alignment before dispatch (BAD_PARAM on violation); skips null pointers and unrecorded UIDs.
  • Plan back-compat fix: PLAN_SERIALIZATION_VERSION 1→2; deserialize now accepts any known version and requires tensor_alignments only for v2+ (v1 plans load with empty alignments). Fixes the two deserialize
    regressions.
  • JSON: round-trips the new fields, defaulting alignment to 16.

Unlike the ragged surface, alignment enforcement is not gated behind a feature flag — it runs on every executeOpGraph. Every tensor now carries a default alignment of 16 bytes, so any supplied device
pointer that isn't 16-byte aligned will fail execute with HIPDNN_STATUS_BAD_PARAM. Reviewers should confirm no in-tree path relies on sub-16-byte-aligned buffers.

Note: This PR can be updated to also give alignment its own graph enablement flag, if that's desired

Compatibility

All schema additions are defaulted/additive (no ABI break); plan format is now version-aware. Existing plugins keep serving non-ragged/non-override graphs; ragged graphs require a 1.2.0+ plugin.

Test Plan

~1,000+ lines added: unit coverage for descriptor plumbing, alignment enforcement, ragged version gating, and plan round-trip (incl. legacy); frontend and JSON round-trip tests; and a new integration test
that lowers a ragged graph through the real backend and asserts the flag lands in the serialized image.

Test Result

Old and new tests pass

Submission Checklist

@jerehartAMD jerehartAMD requested a review from a team as a code owner June 23, 2026 18:15
@codecov-commenter

codecov-commenter commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.23506% with 22 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../hipdnn/frontend/include/hipdnn_frontend/Graph.hpp 66.67% 7 Missing and 3 partials ⚠️
...ects/hipdnn/backend/src/BackendEnumStringUtils.hpp 0.00% 3 Missing and 3 partials ⚠️
...ipdnn/backend/src/descriptors/TensorDescriptor.cpp 95.65% 1 Missing and 1 partial ⚠️
...backend/src/plugin/EnginePluginResourceManager.cpp 95.35% 0 Missing and 2 partials ⚠️
...clude/hipdnn_frontend/detail/DescriptorHelpers.hpp 80.00% 0 Missing and 1 partial ⚠️
...end/include/hipdnn_frontend/detail/GraphPacker.hpp 85.71% 0 Missing and 1 partial ⚠️

❌ Your project status has failed because the head coverage (77.89%) 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    #8728      +/-   ##
===========================================
+ Coverage    71.27%   71.43%   +0.16%     
===========================================
  Files         2613     2612       -1     
  Lines       409461   407441    -2020     
  Branches     61203    60802     -401     
===========================================
- Hits        291826   291041     -785     
+ Misses       96184    95103    -1081     
+ Partials     21451    21297     -154     
Flag Coverage Δ *Carryforward flag
TensileLite 76.83% <ø> (+0.16%) ⬆️ Carriedforward from 34b245e
hipBLAS 90.81% <ø> (ø) Carriedforward from 34b245e
hipBLASLt 41.36% <ø> (-0.01%) ⬇️ Carriedforward from 34b245e
hipCUB 82.68% <ø> (ø) Carriedforward from 34b245e
hipDNN 86.54% <91.24%> (+0.02%) ⬆️
hipFFT 50.79% <ø> (+0.62%) ⬆️ Carriedforward from 34b245e
hipRAND 76.12% <ø> (ø) Carriedforward from 34b245e
hipSOLVER 69.18% <ø> (ø) Carriedforward from 34b245e
hipSPARSE 86.55% <ø> (ø) Carriedforward from 34b245e
rocBLAS 48.08% <ø> (ø) Carriedforward from 34b245e
rocFFT 47.22% <ø> (+0.93%) ⬆️ Carriedforward from 34b245e
rocRAND 57.07% <ø> (ø) Carriedforward from 34b245e
rocSOLVER 77.89% <ø> (+0.97%) ⬆️ Carriedforward from 34b245e
rocSPARSE 72.37% <ø> (ø) Carriedforward from 34b245e
rocThrust 91.34% <ø> (-0.01%) ⬇️ Carriedforward from 34b245e

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

Files with missing lines Coverage Δ
...ackend/src/descriptors/ExecutionPlanDescriptor.cpp 86.38% <100.00%> (+1.26%) ⬆️
...hipdnn/backend/src/descriptors/GraphDescriptor.cpp 92.89% <100.00%> (+0.42%) ⬆️
...de/hipdnn_flatbuffers_sdk/utilities/json/Graph.hpp 90.59% <100.00%> (+0.17%) ⬆️
...latbuffers_sdk/utilities/json/TensorAttributes.hpp 55.33% <100.00%> (+7.68%) ⬆️
...de/hipdnn_frontend/attributes/TensorAttributes.hpp 100.00% <100.00%> (ø)
...sdk/include/hipdnn_plugin_sdk/engine_api_version.h 100.00% <ø> (ø)
...clude/hipdnn_frontend/detail/DescriptorHelpers.hpp 88.54% <80.00%> (-0.28%) ⬇️
...end/include/hipdnn_frontend/detail/GraphPacker.hpp 88.30% <85.71%> (-0.21%) ⬇️
...ipdnn/backend/src/descriptors/TensorDescriptor.cpp 87.60% <95.65%> (+0.83%) ⬆️
...backend/src/plugin/EnginePluginResourceManager.cpp 83.60% <95.35%> (+0.67%) ⬆️
... and 2 more

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

@therock-pr-bot

therock-pr-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown

❌ PR Check — Action Required

Check Status Details
🌿 Branch Name ✅ Pass
📝 PR Title/Description ❌ Fail Error: Title does not follow Conventional Commits style.
Expected: start with a valid type (feat, fix, docs, …).
Desired format: type(optional-scope): short description
───
Error: PR description must reference a JIRA ID, ISSUE ID, or a GitHub closing keyword.
Expected: include a JIRA ID / ISSUE ID line (separator : or -, or omitted; value may be a JIRA key, a number with/without #, or a link), OR a closing keyword + issue reference. Accepted examples:
JIRA ID : TESTAUTO-6039
JIRA ID - #330
JIRA ID #330
ISSUE ID : TESTUTO-3334
ISSUE ID #3334
ISSUE ID - TESTAUTO-3433
ISSUE ID : https://github.com/<org_name>/<repo_name>/issues/1234
Closes #10
Fixes octo-org/octo-repo#100
Resolves: #123
#123
https://github.com/<org_name>/<repo_name>/issues/123
Current: no valid JIRA/ISSUE/closing-keyword reference found
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/src/descriptors/ExecutionPlanDescriptor.hpp, projects/hipdnn/backend/src/descriptors/GraphDescriptor.cpp (+25 more); no test file found
🔎 pre-commit ✅ Pass
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled

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

🚫 Please fix the failed policies

  • ❌ PR Title/Description
  • ❌ 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:

  • ❌ PR Title/Description
  • ❌ Unit Test

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

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