viiccwen opened a new pull request, #1442:
URL: https://github.com/apache/mahout/pull/1442

   ### Related Issues
   
   Closes #1262
   
   ### Changes
   
   - [x] Bug fix
   - [ ] New feature
   - [x] Refactoring
   - [ ] Documentation
   - [x] Test
   - [ ] CI/CD pipeline
   - [ ] Other
   
   ### Why
   
   Several amplitude f32 batch and GPU-pointer paths calculated `1 << 
num_qubits` without first using QDP's shared `validate_qubit_count` function. 
Excessive inputs could therefore panic on shift overflow or proceed toward an 
impractical allocation instead of returning the established 
`MahoutError::InvalidInput`. QDP also retained an unused duplicate `MAX_QUBITS` 
macro in the CUDA kernel configuration.
   
   ### How
   
   - Apply `validate_qubit_count` before state-length calculations in the 
uncovered float32 batch and float32/float64 GPU-pointer single and batch paths.
   - Keep the Rust `MAX_QUBITS` constant as the single effective validation 
policy.
   - Remove the unused CUDA `MAX_QUBITS` definition and update the stale Rust 
comment.
   - Extend the existing maximum-qubit and GPU-pointer test modules with 
regression coverage for all affected entry points.
   
   Runtime device-capacity planning remains outside this cleanup's scope.
   
   ## Checklist
   
   - [x] Added or updated unit tests for all changes
   - [x] Added or updated documentation for all changes
   


-- 
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