-
Notifications
You must be signed in to change notification settings - Fork 60
Fix segmentation fault in NLLLoss kernel #2111
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
Conversation
|
issue link #2008 |
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 fixes segmentation faults and kernel call errors in the NLLLoss kernel implementation for XPU devices. The changes refactor the kernel functors to use safer memory access patterns and more consistent parameter ordering.
Key changes include:
- Complete rewrite of kernel functors with improved memory safety and bounds checking
- Simplified function signatures with reordered parameters for better consistency
- Addition of proper index validation and overflow protection
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/ATen/native/xpu/sycl/LossNLLKernel.h | Updated function signatures to reorder parameters and use consistent naming |
| src/ATen/native/xpu/sycl/LossNLLKernel.cpp | Major refactor of kernel implementations with improved memory safety and bounds checking |
| src/ATen/native/xpu/sycl/KernelUtils.h | Added utility constants and functions for kernel execution |
| src/ATen/native/xpu/LossNLL.cpp | Updated function calls to match new kernel signatures |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
LGTM.
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.
The main part of this PR looks good to me.


Fixed the following issues found by test/test_nn.py::TestNNDeviceTypeXPU::test_nll_loss_large_tensor_reduction_mean_xpu and test_nll_loss_large_tensor_reduction_sum_xpu