Skip to content

[Tensornet] Fix adjoint handling of non-unitary ops#4433

Merged
1tnguyen merged 5 commits intoNVIDIA:mainfrom
1tnguyen:tnguyen/tensornet-fix
May 4, 2026
Merged

[Tensornet] Fix adjoint handling of non-unitary ops#4433
1tnguyen merged 5 commits intoNVIDIA:mainfrom
1tnguyen:tnguyen/tensornet-fix

Conversation

@1tnguyen
Copy link
Copy Markdown
Collaborator

@1tnguyen 1tnguyen commented May 1, 2026

Previously, we had a special code handling the adjoint of projector tensors (used to construct tensor network state from state vector data). This turned out to be a workaround for an unknown bug, which has now been fixed.

Hence, remove the workaround code block. Also, guard against the cutensornet fixed version, which should have been updated in #4342.

Also, extend the test to cover more cases beyond the simple bell state.

Signed-off-by: Thien Nguyen <thiennguyen@nvidia.com>
@1tnguyen 1tnguyen requested review from cabreraam and sacpis May 1, 2026 19:21
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

CI Summary — ✅ passed

Run #25296114763 · trigger merge_group · ✅ 13 · ⏩ 0 · ❌ 0 · ⛔ 0

Top-level jobs (13)
Job Result
binaries ✅ success
build_and_test ✅ success
config_devdeps ✅ success
config_source_build ✅ success
config_wheeldeps ✅ success
devdeps ✅ success
docker_image ✅ success
gen_code_coverage ✅ success
metadata ✅ success
python_metapackages ✅ success
python_wheels ✅ success
source_build ✅ success
wheeldeps ✅ success
All sub-jobs (188) — every matrix leg, with links
Job Status Link
Build and test (amd64, clang16, openmpi) / Dev environment (Debug) ✅ success view
Build and test (amd64, clang16, openmpi) / Dev environment (Python) ✅ success view
Build and test (amd64, gcc11, openmpi) / Dev environment (Debug) ✅ success view
Build and test (amd64, gcc11, openmpi) / Dev environment (Python) ✅ success view
Build and test (amd64, gcc12, openmpi) / Dev environment (Debug) ✅ success view
Build and test (amd64, gcc12, openmpi) / Dev environment (Python) ✅ success view
Build and test (arm64, clang16, openmpi) / Dev environment (Debug) ✅ success view
Build and test (arm64, clang16, openmpi) / Dev environment (Python) ✅ success view
Build and test (arm64, gcc11, openmpi) / Dev environment (Debug) ✅ success view
Build and test (arm64, gcc11, openmpi) / Dev environment (Python) ✅ success view
Build and test (arm64, gcc12, openmpi) / Dev environment (Debug) ✅ success view
Build and test (arm64, gcc12, openmpi) / Dev environment (Python) ✅ success view
CI Summary ❔ in_progress view
Configure build (devdeps) ✅ success view
Configure build (source_build) ✅ success view
Configure build (wheeldeps) ✅ success view
Create CUDA Quantum installer (amd64, 12.6) / Build CUDA Quantum assets ✅ success view
Create CUDA Quantum installer (amd64, 12.6) / Minimal OpenMPI installation ✅ success view
Create CUDA Quantum installer (amd64, 12.6) / Prepare cache clean-up ✅ success view
Create CUDA Quantum installer (amd64, 12.6) / Prepare validation ✅ success view
Create CUDA Quantum installer (amd64, 12.6) / Staging ⏩ skipped view
Create CUDA Quantum installer (amd64, 12.6) / Validate installer (debian:12) ✅ success view
Create CUDA Quantum installer (amd64, 12.6) / Validate installer (fedora:42) ✅ success view
Create CUDA Quantum installer (amd64, 12.6) / Validate installer (opensuse/leap:15.5) ✅ success view
Create CUDA Quantum installer (amd64, 12.6) / Validate installer (redhat/ubi9:9.6) ✅ success view
Create CUDA Quantum installer (amd64, 12.6) / Validate installer (ubuntu:22.04) ✅ success view
Create CUDA Quantum installer (amd64, 13.0) / Build CUDA Quantum assets ✅ success view
Create CUDA Quantum installer (amd64, 13.0) / Minimal OpenMPI installation ✅ success view
Create CUDA Quantum installer (amd64, 13.0) / Prepare cache clean-up ✅ success view
Create CUDA Quantum installer (amd64, 13.0) / Prepare validation ✅ success view
Create CUDA Quantum installer (amd64, 13.0) / Staging ⏩ skipped view
Create CUDA Quantum installer (amd64, 13.0) / Validate installer (debian:12) ✅ success view
Create CUDA Quantum installer (amd64, 13.0) / Validate installer (fedora:42) ✅ success view
Create CUDA Quantum installer (amd64, 13.0) / Validate installer (opensuse/leap:15.5) ✅ success view
Create CUDA Quantum installer (amd64, 13.0) / Validate installer (ubuntu:22.04) ✅ success view
Create CUDA Quantum installer (arm64, 12.6) / Build CUDA Quantum assets ✅ success view
Create CUDA Quantum installer (arm64, 12.6) / Minimal OpenMPI installation ✅ success view
Create CUDA Quantum installer (arm64, 12.6) / Prepare cache clean-up ✅ success view
Create CUDA Quantum installer (arm64, 12.6) / Prepare validation ✅ success view
Create CUDA Quantum installer (arm64, 12.6) / Staging ⏩ skipped view
Create CUDA Quantum installer (arm64, 12.6) / Validate installer (redhat/ubi9:9.6) ✅ success view
Create CUDA Quantum installer (arm64, 12.6) / Validate installer (ubuntu:22.04) ✅ success view
Create CUDA Quantum installer (arm64, 13.0) / Build CUDA Quantum assets ✅ success view
Create CUDA Quantum installer (arm64, 13.0) / Minimal OpenMPI installation ✅ success view
Create CUDA Quantum installer (arm64, 13.0) / Prepare cache clean-up ✅ success view
Create CUDA Quantum installer (arm64, 13.0) / Prepare validation ✅ success view
Create CUDA Quantum installer (arm64, 13.0) / Staging ⏩ skipped view
Create CUDA Quantum installer (arm64, 13.0) / Validate installer (ubuntu:22.04) ✅ success view
Create Docker images (amd64) / Documentation ✅ success view
Create Docker images (amd64) / Metadata ✅ success view
Create Docker images (amd64) / Prepare cache clean-up ✅ success view
Create Docker images (amd64) / Staging ⏩ skipped view
Create Docker images (amd64) / Validation ✅ success view
Create Docker images (amd64) / cuda-quantum (release) ✅ success view
Create Docker images (amd64) / cuda-quantum-dev (debug) ✅ success view
Create Docker images (amd64) / open-mpi ⏩ skipped view
Create Docker images (arm64) / Documentation ⏩ skipped view
Create Docker images (arm64) / Metadata ✅ success view
Create Docker images (arm64) / Prepare cache clean-up ✅ success view
Create Docker images (arm64) / Staging ⏩ skipped view
Create Docker images (arm64) / Validation ✅ success view
Create Docker images (arm64) / cuda-quantum (release) ✅ success view
Create Docker images (arm64) / cuda-quantum-dev (debug) ✅ success view
Create Docker images (arm64) / open-mpi ⏩ skipped view
Create Python metapackages / Build Python metapackages ✅ success view
Create Python metapackages / Test Python metapackages (12.6, 3.11) ✅ success view
Create Python metapackages / Test Python metapackages (12.6, 3.13) ✅ success view
Create Python metapackages / Test Python metapackages (13.0, 3.11) ✅ success view
Create Python metapackages / Test Python metapackages (13.0, 3.13) ✅ success view
Create Python metapackages / Test Python metapackages (3.11) ✅ success view
Create Python metapackages / Test Python metapackages (3.13) ✅ success view
Create Python wheels (amd64, 3.11, 12.6) / Build Python 3.11 wheel ✅ success view
Create Python wheels (amd64, 3.11, 12.6) / Prepare validation ✅ success view
Create Python wheels (amd64, 3.11, 12.6) / Staging ⏩ skipped view
Create Python wheels (amd64, 3.11, 12.6) / Validate wheel (debian:12) ✅ success view
Create Python wheels (amd64, 3.11, 12.6) / Validate wheel (debian:12, --user) ✅ success view
Create Python wheels (amd64, 3.11, 12.6) / Validate wheel (fedora:42) ✅ success view
Create Python wheels (amd64, 3.11, 12.6) / Validate wheel (fedora:42, --user) ✅ success view
Create Python wheels (amd64, 3.11, 12.6) / Validate wheel (redhat/ubi8:8.10) ✅ success view
Create Python wheels (amd64, 3.11, 12.6) / Validate wheel (redhat/ubi8:8.10, --user) ✅ success view
Create Python wheels (amd64, 3.11, 12.6) / Validate wheel (redhat/ubi9:9.6) ✅ success view
Create Python wheels (amd64, 3.11, 12.6) / Validate wheel (redhat/ubi9:9.6, --user) ✅ success view
Create Python wheels (amd64, 3.11, 12.6) / Validate wheel (ubuntu:22.04) ✅ success view
Create Python wheels (amd64, 3.11, 12.6) / Validate wheel (ubuntu:22.04, --user) ✅ success view
Create Python wheels (amd64, 3.11, 13.0) / Build Python 3.11 wheel ✅ success view
Create Python wheels (amd64, 3.11, 13.0) / Prepare validation ✅ success view
Create Python wheels (amd64, 3.11, 13.0) / Staging ⏩ skipped view
Create Python wheels (amd64, 3.11, 13.0) / Validate wheel (debian:12) ✅ success view
Create Python wheels (amd64, 3.11, 13.0) / Validate wheel (debian:12, --user) ✅ success view
Create Python wheels (amd64, 3.11, 13.0) / Validate wheel (fedora:42) ✅ success view
Create Python wheels (amd64, 3.11, 13.0) / Validate wheel (fedora:42, --user) ✅ success view
Create Python wheels (amd64, 3.11, 13.0) / Validate wheel (redhat/ubi8:8.10) ✅ success view
Create Python wheels (amd64, 3.11, 13.0) / Validate wheel (redhat/ubi8:8.10, --user) ✅ success view
Create Python wheels (amd64, 3.11, 13.0) / Validate wheel (redhat/ubi9:9.6) ✅ success view
Create Python wheels (amd64, 3.11, 13.0) / Validate wheel (redhat/ubi9:9.6, --user) ✅ success view
Create Python wheels (amd64, 3.11, 13.0) / Validate wheel (ubuntu:22.04) ✅ success view
Create Python wheels (amd64, 3.11, 13.0) / Validate wheel (ubuntu:22.04, --user) ✅ success view
Create Python wheels (amd64, 3.13, 12.6) / Build Python 3.13 wheel ✅ success view
Create Python wheels (amd64, 3.13, 12.6) / Prepare validation ✅ success view
Create Python wheels (amd64, 3.13, 12.6) / Staging ⏩ skipped view
Create Python wheels (amd64, 3.13, 12.6) / Validate wheel (fedora:42) ✅ success view
Create Python wheels (amd64, 3.13, 12.6) / Validate wheel (fedora:42, --user) ✅ success view
Create Python wheels (amd64, 3.13, 13.0) / Build Python 3.13 wheel ✅ success view
Create Python wheels (amd64, 3.13, 13.0) / Prepare validation ✅ success view
Create Python wheels (amd64, 3.13, 13.0) / Staging ⏩ skipped view
Create Python wheels (amd64, 3.13, 13.0) / Validate wheel (fedora:42) ✅ success view
Create Python wheels (amd64, 3.13, 13.0) / Validate wheel (fedora:42, --user) ✅ success view
Create Python wheels (arm64, 3.11, 12.6) / Build Python 3.11 wheel ✅ success view
Create Python wheels (arm64, 3.11, 12.6) / Prepare validation ✅ success view
Create Python wheels (arm64, 3.11, 12.6) / Staging ⏩ skipped view
Create Python wheels (arm64, 3.11, 12.6) / Validate wheel (debian:12) ✅ success view
Create Python wheels (arm64, 3.11, 12.6) / Validate wheel (debian:12, --user) ✅ success view
Create Python wheels (arm64, 3.11, 12.6) / Validate wheel (fedora:42) ✅ success view
Create Python wheels (arm64, 3.11, 12.6) / Validate wheel (fedora:42, --user) ✅ success view
Create Python wheels (arm64, 3.11, 12.6) / Validate wheel (redhat/ubi8:8.10) ✅ success view
Create Python wheels (arm64, 3.11, 12.6) / Validate wheel (redhat/ubi8:8.10, --user) ✅ success view
Create Python wheels (arm64, 3.11, 12.6) / Validate wheel (redhat/ubi9:9.6) ✅ success view
Create Python wheels (arm64, 3.11, 12.6) / Validate wheel (redhat/ubi9:9.6, --user) ✅ success view
Create Python wheels (arm64, 3.11, 12.6) / Validate wheel (ubuntu:22.04) ✅ success view
Create Python wheels (arm64, 3.11, 12.6) / Validate wheel (ubuntu:22.04, --user) ✅ success view
Create Python wheels (arm64, 3.11, 13.0) / Build Python 3.11 wheel ✅ success view
Create Python wheels (arm64, 3.11, 13.0) / Prepare validation ✅ success view
Create Python wheels (arm64, 3.11, 13.0) / Staging ⏩ skipped view
Create Python wheels (arm64, 3.11, 13.0) / Validate wheel (debian:12) ✅ success view
Create Python wheels (arm64, 3.11, 13.0) / Validate wheel (debian:12, --user) ✅ success view
Create Python wheels (arm64, 3.11, 13.0) / Validate wheel (fedora:42) ✅ success view
Create Python wheels (arm64, 3.11, 13.0) / Validate wheel (fedora:42, --user) ✅ success view
Create Python wheels (arm64, 3.11, 13.0) / Validate wheel (redhat/ubi8:8.10) ✅ success view
Create Python wheels (arm64, 3.11, 13.0) / Validate wheel (redhat/ubi8:8.10, --user) ✅ success view
Create Python wheels (arm64, 3.11, 13.0) / Validate wheel (redhat/ubi9:9.6) ✅ success view
Create Python wheels (arm64, 3.11, 13.0) / Validate wheel (redhat/ubi9:9.6, --user) ✅ success view
Create Python wheels (arm64, 3.11, 13.0) / Validate wheel (ubuntu:22.04) ✅ success view
Create Python wheels (arm64, 3.11, 13.0) / Validate wheel (ubuntu:22.04, --user) ✅ success view
Create Python wheels (arm64, 3.13, 12.6) / Build Python 3.13 wheel ✅ success view
Create Python wheels (arm64, 3.13, 12.6) / Prepare validation ✅ success view
Create Python wheels (arm64, 3.13, 12.6) / Staging ⏩ skipped view
Create Python wheels (arm64, 3.13, 12.6) / Validate wheel (fedora:42) ✅ success view
Create Python wheels (arm64, 3.13, 12.6) / Validate wheel (fedora:42, --user) ✅ success view
Create Python wheels (arm64, 3.13, 13.0) / Build Python 3.13 wheel ✅ success view
Create Python wheels (arm64, 3.13, 13.0) / Prepare validation ✅ success view
Create Python wheels (arm64, 3.13, 13.0) / Staging ⏩ skipped view
Create Python wheels (arm64, 3.13, 13.0) / Validate wheel (fedora:42) ✅ success view
Create Python wheels (arm64, 3.13, 13.0) / Validate wheel (fedora:42, --user) ✅ success view
Gen code coverage (amd64, clang16) / gen_code_coverage ✅ success view
Load dependencies (amd64, clang16) / Caching ✅ success view
Load dependencies (amd64, clang16) / Finalize ✅ success view
Load dependencies (amd64, clang16) / Metadata ✅ success view
Load dependencies (amd64, gcc11) / Caching ✅ success view
Load dependencies (amd64, gcc11) / Finalize ✅ success view
Load dependencies (amd64, gcc11) / Metadata ✅ success view
Load dependencies (amd64, gcc12) / Caching ✅ success view
Load dependencies (amd64, gcc12) / Finalize ✅ success view
Load dependencies (amd64, gcc12) / Metadata ✅ success view
Load dependencies (arm64, clang16) / Caching ✅ success view
Load dependencies (arm64, clang16) / Finalize ✅ success view
Load dependencies (arm64, clang16) / Metadata ✅ success view
Load dependencies (arm64, gcc11) / Caching ✅ success view
Load dependencies (arm64, gcc11) / Finalize ✅ success view
Load dependencies (arm64, gcc11) / Metadata ✅ success view
Load dependencies (arm64, gcc12) / Caching ✅ success view
Load dependencies (arm64, gcc12) / Finalize ✅ success view
Load dependencies (arm64, gcc12) / Metadata ✅ success view
Load source build cache (amd64, 12.6) / Caching ✅ success view
Load source build cache (amd64, 12.6) / Finalize ✅ success view
Load source build cache (amd64, 12.6) / Metadata ✅ success view
Load source build cache (amd64, 13.0) / Caching ✅ success view
Load source build cache (amd64, 13.0) / Finalize ✅ success view
Load source build cache (amd64, 13.0) / Metadata ✅ success view
Load source build cache (arm64, 12.6) / Caching ✅ success view
Load source build cache (arm64, 12.6) / Finalize ✅ success view
Load source build cache (arm64, 12.6) / Metadata ✅ success view
Load source build cache (arm64, 13.0) / Caching ✅ success view
Load source build cache (arm64, 13.0) / Finalize ✅ success view
Load source build cache (arm64, 13.0) / Metadata ✅ success view
Load wheel dependencies (amd64, 12.6) / Caching ✅ success view
Load wheel dependencies (amd64, 12.6) / Finalize ✅ success view
Load wheel dependencies (amd64, 12.6) / Metadata ✅ success view
Load wheel dependencies (amd64, 13.0) / Caching ✅ success view
Load wheel dependencies (amd64, 13.0) / Finalize ✅ success view
Load wheel dependencies (amd64, 13.0) / Metadata ✅ success view
Load wheel dependencies (arm64, 12.6) / Caching ✅ success view
Load wheel dependencies (arm64, 12.6) / Finalize ✅ success view
Load wheel dependencies (arm64, 12.6) / Metadata ✅ success view
Load wheel dependencies (arm64, 13.0) / Caching ✅ success view
Load wheel dependencies (arm64, 13.0) / Finalize ✅ success view
Load wheel dependencies (arm64, 13.0) / Metadata ✅ success view
Prepare cache clean-up ✅ success view
Retrieve PR info ✅ success view
✅ Required checks (35/35) — declared in .github/required-checks.yml for merge_group
Required check Status Link
Build and test (arm64, gcc11, openmpi) / Dev environment (Debug) ✅ success view
Build and test (arm64, gcc11, openmpi) / Dev environment (Python) ✅ success view
Build and test (arm64, gcc12, openmpi) / Dev environment (Debug) ✅ success view
Build and test (arm64, gcc12, openmpi) / Dev environment (Python) ✅ success view
Create CUDA Quantum installer (amd64, 12.6) / Build CUDA Quantum assets ✅ success view
Create CUDA Quantum installer (amd64, 12.6) / Minimal OpenMPI installation ✅ success view
Create CUDA Quantum installer (amd64, 12.6) / Validate installer (debian:12) ✅ success view
Create CUDA Quantum installer (amd64, 12.6) / Validate installer (fedora:42) ✅ success view
Create CUDA Quantum installer (amd64, 12.6) / Validate installer (opensuse/leap:15.5) ✅ success view
Create CUDA Quantum installer (amd64, 12.6) / Validate installer (redhat/ubi9:9.6) ✅ success view
Create CUDA Quantum installer (amd64, 12.6) / Validate installer (ubuntu:22.04) ✅ success view
Create CUDA Quantum installer (arm64, 12.6) / Build CUDA Quantum assets ✅ success view
Create CUDA Quantum installer (arm64, 12.6) / Minimal OpenMPI installation ✅ success view
Create CUDA Quantum installer (arm64, 12.6) / Validate installer (redhat/ubi9:9.6) ✅ success view
Create CUDA Quantum installer (arm64, 12.6) / Validate installer (ubuntu:22.04) ✅ success view
Create Docker images (amd64) / Documentation ✅ success view
Create Docker images (amd64) / Validation ✅ success view
Create Docker images (arm64) / Validation ✅ success view
Create Python metapackages / Build Python metapackages ✅ success view
Create Python metapackages / Test Python metapackages (3.11) ✅ success view
Create Python metapackages / Test Python metapackages (3.13) ✅ success view
Create Python metapackages / Test Python metapackages (12.6, 3.11) ✅ success view
Create Python metapackages / Test Python metapackages (12.6, 3.13) ✅ success view
Create Python wheels (amd64, 3.11, 12.6) / Validate wheel (debian:12, --user) ✅ success view
Create Python wheels (amd64, 3.11, 12.6) / Validate wheel (debian:12) ✅ success view
Create Python wheels (amd64, 3.11, 12.6) / Validate wheel (fedora:42, --user) ✅ success view
Create Python wheels (amd64, 3.11, 12.6) / Validate wheel (fedora:42) ✅ success view
Create Python wheels (amd64, 3.11, 12.6) / Validate wheel (redhat/ubi8:8.10, --user) ✅ success view
Create Python wheels (amd64, 3.11, 12.6) / Validate wheel (redhat/ubi8:8.10) ✅ success view
Create Python wheels (arm64, 3.11, 12.6) / Validate wheel (debian:12, --user) ✅ success view
Create Python wheels (arm64, 3.11, 12.6) / Validate wheel (debian:12) ✅ success view
Create Python wheels (arm64, 3.11, 12.6) / Validate wheel (fedora:42, --user) ✅ success view
Create Python wheels (arm64, 3.11, 12.6) / Validate wheel (fedora:42) ✅ success view
Create Python wheels (arm64, 3.11, 12.6) / Validate wheel (redhat/ubi8:8.10, --user) ✅ success view
Create Python wheels (arm64, 3.11, 12.6) / Validate wheel (redhat/ubi8:8.10) ✅ success view

Copy link
Copy Markdown
Collaborator

@sacpis sacpis left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @1tnguyen. Left a few comments.

Comment thread runtime/nvqir/cutensornet/tn_simulation_state.inc Outdated
Comment thread runtime/nvqir/cutensornet/tn_simulation_state.inc Outdated
Copy link
Copy Markdown
Collaborator

@cabreraam cabreraam left a comment

Choose a reason for hiding this comment

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

LGTM

1tnguyen and others added 2 commits May 3, 2026 23:06
@1tnguyen 1tnguyen enabled auto-merge May 3, 2026 23:08
@1tnguyen 1tnguyen added this pull request to the merge queue May 3, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 4, 2026
@1tnguyen 1tnguyen added this pull request to the merge queue May 4, 2026
Merged via the queue into NVIDIA:main with commit 967a554 May 4, 2026
71 checks passed
@1tnguyen 1tnguyen deleted the tnguyen/tensornet-fix branch May 4, 2026 02:20
github-actions Bot pushed a commit that referenced this pull request May 4, 2026
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.

3 participants