Skip to content

Sparse-aware PCM utility migration#602

Draft
vedika-saravanan wants to merge 5 commits into
NVIDIA:mainfrom
vedika-saravanan:pcm-utils
Draft

Sparse-aware PCM utility migration#602
vedika-saravanan wants to merge 5 commits into
NVIDIA:mainfrom
vedika-saravanan:pcm-utils

Conversation

@vedika-saravanan

@vedika-saravanan vedika-saravanan commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds sparse-aware paths for the round-agnostic PCM utilities:

  • reorder_pcm_columns
  • shuffle_pcm_columns
  • pcm_to_sparse_vec
  • pcm_to_sparse_string

The C++ API now has sparse_binary_matrix overloads for those utilities. The Python bindings also accept scipy sparse inputs for the Python-exposed functions (reorder_pcm_columns, shuffle_pcm_columns, and pcm_to_sparse_vec) without materializing a dense cudaqx::tensor.

This intentionally avoids utilities that depend on a fixed scalar num_syndromes_per_round, since those APIs are expected to change for variable syndrome counts per round.

Related: #582

Runtime / performance impact

Avoids dense cudaqx::tensor<uint8_t> allocation for the covered sparse utility paths when callers provide sparse_binary_matrix in C++ or scipy sparse matrices in Python.

Self-review checklist

Please confirm each item before requesting review. Check [x] or strike
through and explain.

Before requesting review

  • I reviewed my own full diff in GitHub or my editor.
  • PR is in Draft if it is not yet ready for review.
  • Temporary / debugging changes have been removed.
  • Local test logs reviewed; no unexplained warnings or errors.
    Local C++ tests not run: cmake is unavailable in this shell.
  • CI logs reviewed; no unexplained warnings or errors.
    Pending CI.
  • Full CI has been run.
    Pending CI.

Scope and size

  • PR is under ~1000 lines, or an exception is justified in the description.
  • Refactoring-only changes are isolated in their own PR(s).
  • No existing tests were disabled or modified just to make this PR pass
    (if so, an issue has been raised).

Tests

  • New functionality has new tests.
  • Tests fail if the new functionality is broken (including crashes), not
    just when it is missing.
  • Negative tests added where exceptions are expected.
    N/A: the new sparse utility paths are covered by positive/equivalence tests; no new expected exception paths are introduced for those sparse paths.
  • Truth data added where simple EXPECT_* / assert checks are
    insufficient for algorithmic correctness.
    N/A: dense-vs-sparse equivalence and explicit expected sparse encodings are covered with direct checks.
  • CI runtime impact considered; team notified if significant.

Documentation

  • Public-facing APIs have Doxygen docs.
  • User-visible behavior changes have public docs, or a follow-up is
    tracked.

Code style

  • Naming follows the existing convention (snake_case vs camelCase) for
    the area being modified.

Dependencies

  • No new third-party dependencies, or the team has been notified and
    OSRB tickets filed.

Signed-off-by: vedika-saravanan <vsaravanan@nvidia.com>
Signed-off-by: vedika-saravanan <vsaravanan@nvidia.com>
@vedika-saravanan vedika-saravanan marked this pull request as ready for review June 10, 2026 22:08
@vedika-saravanan vedika-saravanan marked this pull request as draft June 10, 2026 22:12
Signed-off-by: vedika-saravanan <vsaravanan@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant