ITADN

Constant memory is incorrectly freed by CudaSlice::drop

#514Opencaelunshun 创建于 2025-12-23
C
caelunshuncommented
The implementation of constant memory by reusing `CudaSlice` unfortunately causes the implementation to try to free the backing memory when the slice handle is dropped. This results in a CUDA_ERROR_INVALID_VALUE error. It can be reproduced by inserting `drop(coefficients_symbol)` on line 27 in `examples/09-constant-memory.rs`. The solutions I can think of would be either (1) add a boolean field to `CudaSlice` to indicate whether dropping should be a no-op, or (2) use a separate type to represent constant-memory-backed symbols. A temporary workaround is to `mem::forget` the slices after using them.
0 条评论