-
Notifications
You must be signed in to change notification settings - Fork 60
Implement aten::nonzero_static on XPU backend #2061
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
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 implements the nonzero_static operation for the XPU backend, adding support for a static-sized version of the nonzero operation that fills output to a specified size. This addresses issue #1943 in the torch-xpu-ops repository.
- Adds dispatch entries for
nonzero_staticandnonzero_static.outoperations in the native functions YAML - Implements the XPU backend functions with proper input validation and size handling
- Refactors common validation logic into a shared helper function
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| yaml/native/native_functions.yaml | Adds dispatch entries for nonzero_static operations to XPU backend |
| src/ATen/native/xpu/Nonzero.cpp | Implements nonzero_static functions and refactors common validation logic |
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.
The logic looks good to me. Pls. help add test cases or list the existing test cases here as evidence that validates the logic.
|
There are two parametrized tests from upstream, aligned to work with XPU
|
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.
This reverts commit f1ef743.
Fixes #1943