You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by "400Ping (via GitHub)" <gi...@apache.org> on 2026/01/23 15:16:58 UTC
[PR] [QDP] GPU pointer validation stream sync [mahout]
400Ping opened a new pull request, #930:
URL: https://github.com/apache/mahout/pull/930
### Purpose of PR
- `lib.rs`: obtain PyTorch’s current CUDA stream pointer and route CUDA-tensor encoding through stream-aware core APIs to prevent cross-stream races.
- `lib.rs`: add `encode_from_gpu_ptr_with_stream` and `encode_batch_from_gpu_ptr_with_stream`, and synchronize on the provided stream; keep default-stream entry points intact.
- `amplitude.rs`: add a stream-aware GPU norm path so normalization and kernels run on the same stream before host reads.
### Related Issues or PRs
Related to https://github.com/apache/mahout/issues/726
### Changes Made
<!-- Please mark one with an "x" -->
- [ ] Bug fix
- [x] New feature
- [ ] Refactoring
- [ ] Documentation
- [ ] Test
- [ ] CI/CD pipeline
- [ ] Other
### Breaking Changes
<!-- Does this PR introduce a breaking change? -->
- [ ] Yes
- [x] No
### Checklist
<!-- Please mark each item with an "x" when complete -->
<!-- If not all items are complete, please open this as a **Draft PR**.
Once all requirements are met, mark as ready for review. -->
- [ ] Added or updated unit tests for all changes
- [ ] Added or updated documentation for all changes
- [ ] Successfully built and ran all unit tests or manual tests locally
- [ ] PR title follows "MAHOUT-XXX: Brief Description" format (if related to an issue)
- [ ] Code follows ASF guidelines
--
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: dev-unsubscribe@mahout.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [QDP] PyTorch CUDA stream‑aware encode for GPU tensors [mahout]
Posted by "400Ping (via GitHub)" <gi...@apache.org>.
400Ping merged PR #930:
URL: https://github.com/apache/mahout/pull/930
--
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: dev-unsubscribe@mahout.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [QDP] PyTorch CUDA stream‑aware encode for GPU tensors [mahout]
Posted by "400Ping (via GitHub)" <gi...@apache.org>.
400Ping commented on PR #930:
URL: https://github.com/apache/mahout/pull/930#issuecomment-3796433631
@CheyuWu PTAL
--
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: dev-unsubscribe@mahout.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [QDP] GPU Pointer Validation Stream Sync [mahout]
Posted by "400Ping (via GitHub)" <gi...@apache.org>.
400Ping closed pull request #930: [QDP] GPU Pointer Validation Stream Sync
URL: https://github.com/apache/mahout/pull/930
--
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: dev-unsubscribe@mahout.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [QDP] PyTorch CUDA stream‑aware encode for GPU tensors [mahout]
Posted by "rich7420 (via GitHub)" <gi...@apache.org>.
rich7420 commented on code in PR #930:
URL: https://github.com/apache/mahout/pull/930#discussion_r2730194140
##########
qdp/qdp-python/src/lib.rs:
##########
@@ -211,6 +212,23 @@ fn get_tensor_device_id(tensor: &Bound<'_, PyAny>) -> PyResult<i32> {
Ok(device_index)
}
+/// Get the current CUDA stream pointer for the tensor's device.
+fn get_torch_cuda_stream_ptr(tensor: &Bound<'_, PyAny>) -> PyResult<*mut c_void> {
Review Comment:
It seems here extracts a stream pointer from PyTorch but doesn't validate that the stream is valid for the device or that it's not a null pointer in a meaningful way. I think we could add validation or a defensive check here.
--
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: dev-unsubscribe@mahout.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [QDP] PyTorch CUDA stream‑aware encode for GPU tensors [mahout]
Posted by "viiccwen (via GitHub)" <gi...@apache.org>.
viiccwen commented on code in PR #930:
URL: https://github.com/apache/mahout/pull/930#discussion_r2740507231
##########
qdp/qdp-core/src/gpu/encodings/amplitude.rs:
##########
@@ -460,6 +472,15 @@ impl AmplitudeEncoder {
)));
}
+ let ret = unsafe { cudaStreamSynchronize(stream) };
+ if ret != 0 {
+ return Err(MahoutError::Cuda(format!(
+ "CUDA stream synchronize failed: {} ({})",
+ ret,
+ cuda_error_to_string(ret)
+ )));
+ }
+
Review Comment:
should we put this function into shared module? and there's different error message.
[https://github.com/400Ping/mahout/blob/4b71ad078c242cf708167289b5a5fa1d58ce9419/qdp/qdp-core/src/lib.rs#L57-L69](https://github.com/400Ping/mahout/blob/4b71ad078c242cf708167289b5a5fa1d58ce9419/qdp/qdp-core/src/lib.rs#L57-L69)
--
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: dev-unsubscribe@mahout.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [QDP] PyTorch CUDA stream‑aware encode for GPU tensors [mahout]
Posted by "rich7420 (via GitHub)" <gi...@apache.org>.
rich7420 commented on PR #930:
URL: https://github.com/apache/mahout/pull/930#issuecomment-3794908245
@400Ping thanks for the patch!
plz fix ci errors and conflicts.
--
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: dev-unsubscribe@mahout.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [QDP] PyTorch CUDA stream‑aware encode for GPU tensors [mahout]
Posted by "rich7420 (via GitHub)" <gi...@apache.org>.
rich7420 commented on PR #930:
URL: https://github.com/apache/mahout/pull/930#issuecomment-3815726242
I think in this pr should add tests for the feature.
--
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: dev-unsubscribe@mahout.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org