viiccwen opened a new issue, #973:
URL: https://github.com/apache/mahout/issues/973

   ### Summary
   
   The GPU pointer encoding entry points in `qdp-core`:
   
   - `QdpEngine::encode_from_gpu_ptr`
   - `QdpEngine::encode_batch_from_gpu_ptr`
   - `QdpEngine::encode_from_gpu_ptr_f32`
   
   had two issues:
   
   1. used `1usize << num_qubits` to derive the state vector length, which can 
overflow / be undefined for large `num_qubits`.
   2. Their `# Safety` contracts did not clearly state that the input pointers 
must remain valid until all CUDA work launched by the call has completed (not 
just during the immediate Rust call), even though kernels are asynchronous and 
the methods perform synchronization at the end.
   
   This issue tracks tightening these APIs to avoid undefined behavior and to 
document the actual safety requirements for callers (including FFI/Python).
   
   ### Affected APIs
   
   - `qdp/qdp-core/src/lib.rs`:
     - `QdpEngine::encode_from_gpu_ptr`
     - `QdpEngine::encode_from_gpu_ptr_f32`
     - `QdpEngine::encode_batch_from_gpu_ptr`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to