Skip to content

[Feature Request] Capability Snapshot + Typed Query Wrappers + Query Count Hardening #52

Description

@k8ika0s

Proposed PR branch: qe/issue-13-capability-matrix-and-query-safety

Category: Feature Request (API ergonomics + safety hardening)

Problem

  • Integrators need a consolidated capability snapshot at startup.
  • Varargs query APIs are harder to bind safely.
  • Query count handling must be hardened (reject malformed / non-positive counts).

Justification / why this is needed

  • Frameworks commonly need a single “capability snapshot” at init to decide
    which ops/types/layouts to enable or fall back to CPU.
  • Typed wrappers reduce misuse and help bindings avoid varargs entirely.
  • Count hardening prevents out-of-bounds reads when inputs are malformed.

Proposed change

  • Add zdnn_get_capability_matrix(...).
  • Add typed wrappers:
    • zdnn_is_nnpa_function_installed_list(...)
    • zdnn_is_nnpa_parmblk_fmt_installed_list(...)
  • Harden varargs count bounds and add safety regressions.

Acceptance criteria

  • Capability snapshot validates buffer alignment/size and returns a stable struct.
  • Typed wrappers match varargs behavior for equivalent inputs.
  • Query rejects non-positive/malformed counts and never reads out of bounds.
  • Tests cover snapshot API + wrappers + count hardening.

Test plan

  • make test (expects:
    • tests/testDriver_capability_matrix_api.c
    • tests/testDriver_query_typed_wrappers.c
    • tests/testDriver_query_count_safety.c)

References

  • Baseline report: artifacts/FINAL_BASELINE_ENHANCEMENT_REPORT.md shows
    query count safety regressions failing on baseline+regtests and passing in enhanced.
  • Key files: zdnn/query.c, zdnn/zdnn.h, zdnn/zdnn.map, tests above.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions