-
Notifications
You must be signed in to change notification settings - Fork 60
[WIP]Change philox state API usage to support XPU graph #2085
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the XPU implementation to use the new philox_xpu_state
API instead of the legacy philox_engine_inputs
API to support XPU graph functionality. The changes replace the old pair-based approach for Philox random number generation with a unified state object.
- Replace
philox_engine_inputs()
calls withphilox_xpu_state()
- Update function signatures to use
PhiloxXpuState
instead ofstd::pair<uint64_t, uint64_t>
- Replace
philox_unpack()
withat::xpu::philox::unpack()
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/ATen/native/xpu/sycl/RreluWithNoiseKernels.cpp | Updates RReLU with noise kernel to use new philox state API |
src/ATen/native/xpu/sycl/RandpermKernel.cpp | Updates randperm kernel to use new philox state API and removes unused include |
src/ATen/native/xpu/sycl/MultinomialKernel.cpp | Updates multinomial kernel to use new philox state API |
src/ATen/native/xpu/sycl/Dropout.cpp | Updates dropout kernels to use new philox state API |
src/ATen/native/xpu/sycl/Distributions.cpp | Updates various distribution kernels to use new philox state API |
src/ATen/native/xpu/sycl/DistributionTemplates.h | Removes PhiloxState definition and updates template functions to use new API |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@@ -1,5 +1,4 @@ | |||
#include <ATen/Dispatch.h> | |||
#include <ATen/native/xpu/sycl/DistributionTemplates.h> | |||
#include <ATen/native/xpu/sycl/Philox4x32.h> |
Copilot
AI
Sep 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The removed include <ATen/native/xpu/sycl/DistributionTemplates.h>
might still be needed since this file uses functions that were previously defined there. Verify that all necessary functions are still accessible through the remaining includes.
#include <ATen/native/xpu/sycl/Philox4x32.h> | |
#include <ATen/native/xpu/sycl/Philox4x32.h> | |
#include <ATen/native/xpu/sycl/DistributionTemplates.h> |
Copilot uses AI. Check for mistakes.
auto rng_engine_inputs = PhiloxState( | ||
std::get<0>(rng_engine_inputs_), std::get<1>(rng_engine_inputs_)); | ||
// Sample with replacement | ||
|
Copilot
AI
Sep 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The comment '// Sample with replacement' was removed but it provided valuable context for understanding the code section. Consider keeping meaningful comments that explain the algorithm or approach being used.
// Sample with replacement |
Copilot uses AI. Check for mistakes.
Signed-off-by: Ma, Jing1 <[email protected]>
Switch philox_engine_inputs usage to philox_xpu_state per XPU graph request. This PR requires stock pytorch XPUGeneratorImpl PR merged.