viiccwen commented on code in PR #814:
URL: https://github.com/apache/mahout/pull/814#discussion_r2719910017


##########
qdp/qdp-python/src/lib.rs:
##########
@@ -238,37 +238,103 @@ fn validate_cuda_tensor_for_encoding(
     Ok(())
 }
 
-/// CUDA tensor information extracted directly from PyTorch tensor
-struct CudaTensorInfo {
+/// DLPack tensor information extracted from a PyCapsule
+///
+/// This struct owns the DLManagedTensor pointer and ensures proper cleanup
+/// via the DLPack deleter when dropped (RAII pattern).
+struct DLPackTensorInfo {
+    /// Raw DLManagedTensor pointer from PyTorch DLPack capsule
+    /// This is owned by this struct and will be freed via deleter on drop
+    managed_ptr: *mut DLManagedTensor,
+    /// Data pointer inside dl_tensor (GPU memory, owned by managed_ptr)
     data_ptr: *const f64,
     shape: Vec<i64>,
+    /// CUDA device ID from DLPack metadata.
+    /// Currently unused but kept for potential future device validation or 
multi-GPU support.
+    #[allow(dead_code)]
+    device_id: i32,

Review Comment:
   IMO, it could be a follow-up. WDYT?
   bcz this PR only deals with refactoring encode path & adding missing tests.



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