Skip to content

Fix heap corruption from list[bool] kernel arguments#4716

Open
mitchdz wants to merge 4 commits into
NVIDIA:mainfrom
mitchdz:fix-heap-corruption
Open

Fix heap corruption from list[bool] kernel arguments#4716
mitchdz wants to merge 4 commits into
NVIDIA:mainfrom
mitchdz:fix-heap-corruption

Conversation

@mitchdz

@mitchdz mitchdz commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

On local simulators a list[bool] is marshaled as a bit-packed
std::vector, but argument synthesis read every vector arg as a
{begin, end, capacity} pointer triple. That layout is wrong for
std::vector (its members are _Bit_iterators, not raw pointers), so it
walked off the buffer and corrupted the heap, or silently read an empty
vector when the padding was zero. This showed up as the flaky
test_list_subscript segfault.

Read i1 vector args through the std::vector API when the target is a
local simulator (gated by CompileTarget::isLocalSimulator). Remote and
emulated targets pack std::vector and are unchanged. Covers sample,
observe, run, get_state, translate/get_qir, and lifted closure args.

Regression from #4265 (argsCreator packing).

  On local simulators a list[bool] is marshaled as a bit-packed
  std::vector<bool>, but argument synthesis read every vector arg as a
  {begin, end, capacity} pointer triple. That layout is wrong for
  std::vector<bool> (its members are _Bit_iterators, not raw pointers), so it
  walked off the buffer and corrupted the heap, or silently read an empty
  vector when the padding was zero. This showed up as the flaky
  test_list_subscript segfault.

  Read i1 vector args through the std::vector<bool> API when the target is a
  local simulator (gated by CompileTarget::isLocalSimulator). Remote and
  emulated targets pack std::vector<char> and are unchanged. Covers sample,
  observe, run, get_state, translate/get_qir, and lifted closure args.

  Regression from NVIDIA#4265 (argsCreator packing).

  Tests:
  - test_argument_conversion.cpp: synthesize a real std::vector<bool> and check
    the resulting constant array.
  - test_kernel_builder.py::test_repeated_builder_launch_no_segfault: run the
    make_kernel/sample loop under MALLOC_PERTURB_ so the crash is deterministic.

Signed-off-by: mdzurick <mitch_dz@hotmail.com>
@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown

CI Summary (workflow_dispatch) — ✅ passed

Run #27634361212 · ✅ 12 · ⏩ 1 · ❌ 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 ⏩ skipped
metadata ✅ success
python_metapackages ✅ success
python_wheels ✅ success
source_build ✅ success
wheeldeps ✅ success
⏩ Skipped jobs (1) — intentionally skipped on PR builds; run on merge_group / workflow_dispatch
Job
gen_code_coverage
All sub-jobs (186) — every matrix leg, with links
Job Status Link
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 (amd64, llvm, openmpi) / Dev environment (Debug) ✅ success view
Build and test (amd64, llvm, 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
Build and test (arm64, llvm, openmpi) / Dev environment (Debug) ✅ success view
Build and test (arm64, llvm, 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, 12.6) / Validate wheel on GPU (nvidia simulator) ✅ 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.11, 13.0) / Validate wheel on GPU (nvidia simulator) ⏩ skipped 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, 12.6) / Validate wheel on GPU (nvidia simulator) ⏩ skipped 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 (amd64, 3.13, 13.0) / Validate wheel on GPU (nvidia simulator) ⏩ skipped 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, 12.6) / Validate wheel on GPU (nvidia simulator) ⏩ skipped 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.11, 13.0) / Validate wheel on GPU (nvidia simulator) ⏩ skipped 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, 12.6) / Validate wheel on GPU (nvidia simulator) ⏩ skipped 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
Create Python wheels (arm64, 3.13, 13.0) / Validate wheel on GPU (nvidia simulator) ⏩ skipped view
Gen code coverage ⏩ skipped view
Load dependencies (amd64, gcc12) / Caching ✅ success view
Load dependencies (amd64, gcc12) / Finalize ✅ success view
Load dependencies (amd64, gcc12) / Metadata ✅ success view
Load dependencies (amd64, llvm) / Caching ✅ success view
Load dependencies (amd64, llvm) / Finalize ✅ success view
Load dependencies (amd64, llvm) / 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 dependencies (arm64, llvm) / Caching ✅ success view
Load dependencies (arm64, llvm) / Finalize ✅ success view
Load dependencies (arm64, llvm) / 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 (39/39) — declared in .github/required-checks.yml for workflow_dispatch
Required check Status Link
Build and test (amd64, llvm, openmpi) / Dev environment (Debug) ✅ success view
Build and test (amd64, llvm, openmpi) / Dev environment (Python) ✅ success view
Build and test (arm64, llvm, openmpi) / Dev environment (Debug) ✅ success view
Build and test (arm64, llvm, 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, 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

github-actions Bot pushed a commit that referenced this pull request Jun 10, 2026
@github-actions

Copy link
Copy Markdown

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

@mitchdz mitchdz self-assigned this Jun 11, 2026
@mitchdz mitchdz added the bug fix To be listed under Bug Fixes in the release notes label Jun 11, 2026
@copy-pr-bot

copy-pr-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@mitchdz mitchdz force-pushed the fix-heap-corruption branch from c05a5b7 to b095c56 Compare June 11, 2026 15:05
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

CI Summary (push) — ✅ passed

Run #27593737466 · ✅ 6 · ⏩ 7 · ❌ 0 · ⛔ 0

Top-level jobs (13)
Job Result
binaries ⏩ skipped
build_and_test ✅ success
config_devdeps ✅ success
config_source_build ⏩ skipped
config_wheeldeps ✅ success
devdeps ✅ success
docker_image ⏩ skipped
gen_code_coverage ⏩ skipped
metadata ✅ success
python_metapackages ⏩ skipped
python_wheels ⏩ skipped
source_build ⏩ skipped
wheeldeps ✅ success
⏩ Skipped jobs (7) — intentionally skipped on PR builds; run on merge_group / workflow_dispatch
Job
binaries
config_source_build
docker_image
gen_code_coverage
python_metapackages
python_wheels
source_build
All sub-jobs (42) — every matrix leg, with links
Job Status Link
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 (amd64, llvm, openmpi) / Dev environment (Debug) ✅ success view
Build and test (amd64, llvm, openmpi) / Dev environment (Python) ✅ success view
Build and test (arm64, llvm, openmpi) / Dev environment (Debug) ✅ success view
Build and test (arm64, llvm, openmpi) / Dev environment (Python) ✅ success view
CI Summary ❔ in_progress view
Configure build (devdeps) ✅ success view
Configure build (source_build) ⏩ skipped view
Configure build (wheeldeps) ✅ success view
Create CUDA Quantum installer ⏩ skipped view
Create Docker images ⏩ skipped view
Create Python metapackages ⏩ skipped view
Create Python wheels ⏩ skipped view
Gen code coverage ⏩ skipped view
Load dependencies (amd64, gcc12) / Caching ✅ success view
Load dependencies (amd64, gcc12) / Finalize ✅ success view
Load dependencies (amd64, gcc12) / Metadata ✅ success view
Load dependencies (amd64, llvm) / Caching ✅ success view
Load dependencies (amd64, llvm) / Finalize ✅ success view
Load dependencies (amd64, llvm) / 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 dependencies (arm64, llvm) / Caching ✅ success view
Load dependencies (arm64, llvm) / Finalize ✅ success view
Load dependencies (arm64, llvm) / Metadata ✅ success view
Load source build cache ⏩ skipped 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 ❔ in_progress view
Retrieve PR info ✅ success view
✅ Required checks (6/6) — declared in .github/required-checks.yml for push
Required check Status Link
Build and test (amd64, llvm, openmpi) / Dev environment (Debug) ✅ success view
Build and test (amd64, llvm, openmpi) / Dev environment (Python) ✅ success view
Build and test (arm64, llvm, openmpi) / Dev environment (Debug) ✅ success view
Build and test (arm64, llvm, 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

@schweitzpgi

Copy link
Copy Markdown
Collaborator

I think the bug is in the Python code. Arguments are Python objects in Python and we are free to marshal them (correctly) any way we want as C++ proxies.

The ArgumentConversion algorithm is correctly assuming that all vector types are the triple pointer encoding. This is a universal assumption on the device.

Unfortunately, Python has decided to incorrectly encode a list[bool] as a vector<bool> which is just plain wrong. It must be encoded as a vector<char>.

@Renaud-K

Copy link
Copy Markdown
Collaborator

I would tend to agree with Eric. We are having to touch a lot of API just for vector support. Any chance this can be handled up the stack?

mitchdz added 2 commits June 15, 2026 16:22
# Conflicts:
#	cudaq/include/cudaq/Target/CompileTarget.h
#	runtime/cudaq/platform/default/python/QPU.cpp
#	runtime/internal/compiler/include/cudaq_internal/compiler/ArgumentConversion.h
A `list[bool]` kernel argument was marshaled as a bit-packed
`std::vector<bool>` for every local-simulator launch. That object is the
libstdc++/libc++ specialization (its members are `_Bit_iterator`s, not a
`{begin, end, capacity}` raw-pointer triple), so when the argument-synthesis
path (`ArgumentConverter`) read it as the universal vector triple it walked off
the buffer and corrupted the heap. This showed up as the flaky
`test_list_subscript` segfault. Regression from NVIDIA#4265 (argsCreator packing).

The two launch modes want different host encodings, and the args were always
packed the same way:

  - Argument synthesis folds the arguments in as constants and reads every
    vector as the `{begin, end, capacity}` triple, so an `i1` vector must be a
    `std::vector<char>` (one byte per element).
  - Direct launch (argsCreator) supplies the arguments at runtime through the
    generated thunk, whose existing "vector<bool> unpack" helpers understand a
    host `std::vector<bool>`.

Pick the encoding by mode in `marshal_arguments_for_module_launch`: a kernel
whose formal arguments are all unused is synthesized (`isFullySynthesized`),
so pack the synthesis encoding (`std::vector<char>`); otherwise a local
simulator direct-launches it, so keep the argsCreator encoding
(`std::vector<bool>`). This leaves `argsCreator` and `ArgumentConverter`
untouched and drops the `boolVecBitPacked`/`isLocalSimulator` plumbing that had
taught argument synthesis to read `std::vector<bool>` directly.

Verified on qpp-cpu and nvidia: test_kernel_parameters (list[bool],
list[list[bool]]), test_list_subscript + test_repeated_builder_launch_no_segfault
under MALLOC_PERTURB_, and the full python/tests/kernel + builder suites
(1018 passed). C++ test_argument_conversion FileCheck passes.

Signed-off-by: mdzurick <mitch_dz@hotmail.com>
@mitchdz mitchdz force-pushed the fix-heap-corruption branch from b095c56 to d9dae8a Compare June 16, 2026 04:14
@github-actions

Copy link
Copy Markdown

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions Bot pushed a commit that referenced this pull request Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix To be listed under Bug Fixes in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants