Skip to content

[QDP] Add CUDA kernel tests for basis encoding#1325

Open
tongyu0924 wants to merge 4 commits into
apache:mainfrom
tongyu0924:main
Open

[QDP] Add CUDA kernel tests for basis encoding#1325
tongyu0924 wants to merge 4 commits into
apache:mainfrom
tongyu0924:main

Conversation

@tongyu0924
Copy link
Copy Markdown

Changes

  • Test

Why

basis.cu had no test coverage.

How

Add tests/basis_encode.rs covering:

  • Single-sample encode: first, middle, last index (f64 + f32)
  • Batch encode: multiple samples with different indices (f64 + f32)
  • Error rejection: out-of-range index, zero state_len, zero num_samples
  • Non-Linux dummy stub

Checklist

  • Added or updated unit tests for all changes
  • Added or updated documentation for all changes

Comment thread qdp/qdp-kernels/tests/basis_encode.rs Outdated
let num_samples = 4usize;
let state_len = 4usize;
let num_qubits = 2u32;
let basis_indices: Vec<usize> = vec![0, 1, 2, 3];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we have multiple test cases and hard testcase that test the limit and edge case of the code?

@400Ping
Copy link
Copy Markdown
Member

400Ping commented May 19, 2026

Please fix pre-commit

@400Ping 400Ping changed the title Add CUDA kernel tests for basis encoding [QDP] Add CUDA kernel tests for basis encoding May 19, 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