Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24330
Note: Links to docs will display an error until the docs builds have been completed. ❌ You can merge normally! (4 Unrelated Failures), 4 Unclassified FailuresAs of commit aba2e56 with merge base 7d51b01 ( UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:
BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
f04e979 to
c2763d9
Compare
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are blocking approval of the complex operator support.
No open issues 🎉
What changed in this PR
Enables torch.complex(real, imag) through default Edge export and CPU execution, addressing #24328 for matching FP16, FP32, and FP64 inputs.
Changes:
- Adds a portable
complex.outkernel with broadcasting, output resizing, and default dimension-order validation. - Registers the operator and adds complex32 dtype mapping plus a temporary Core ATen verifier exception.
- Adds kernel and Python integration tests covering supported types, broadcasting, and invalid inputs.
| File | Description |
|---|---|
shim_et/xplat/executorch/kernels/portable/op_registration_util.bzl |
Adds the portable kernel build target and broadcast dependency. |
kernels/test/targets.bzl |
Registers complex tests for ATen and portable kernels. |
kernels/test/op_complex_test.cpp |
Tests types, broadcasting, special values, resizing, and validation. |
kernels/test/CMakeLists.txt |
Includes complex kernel tests in CMake builds. |
kernels/portable/functions.yaml |
Registers the portable complex.out implementation. |
kernels/portable/cpu/op_complex.cpp |
Implements complex tensor construction on CPU. |
kernels/aten/functions.yaml |
Registers complex.out for ATen builds. |
extension/pybindings/test/test_pybindings.py |
Adds end-to-end export and execution coverage. |
exir/verification/verifier.py |
Temporarily allows complex.default through Core ATen validation. |
exir/dialects/edge/dtype/supported.py |
Maps complex32 to ComplexHalf. |
Review effort: Balanced
|
@pytorchbot label "release notes: ops & kernels" |
c2763d9 to
4b6aea4
Compare
|
@mshr-h could you rebase branch with main and ping again for review? |
4b6aea4 to
830615b
Compare
|
@nil-is-all @JakeStevens Rebased onto the latest upstream/main. Could you take another look? Thanks! |
830615b to
825068d
Compare
b4345f8 to
441f2a6
Compare
441f2a6 to
4451779
Compare
4451779 to
21f5700
Compare
21f5700 to
61b4e38
Compare
61b4e38 to
45559b7
Compare
|
@claude review effort:max |
|
Claude finished @JakeStevens's task in 3m 54s —— View job The kernel is correct, but Detailed reviewPR Review: #24330SummaryThis PR adds a portable Three reviewers looked at the PR independently, and all three found the same build-list gap. There is also a design question about how wide the verifier exemption reaches, plus some smaller test and coverage gaps. Infrastructure
API Design
Testing
Code Quality
RecommendationRequest Changes The only blocking item is the missing |
45559b7 to
2a36833
Compare
2a36833 to
aba2e56
Compare
|
Addressed claude review by adding the missing |
Summary
Models using
torch.complex(real, imag)currently fail the defaultto_edge()Core ATen check. Allowing the operator through that check still leaves CPU execution blocked by a missingaten::complex.outkernel.This PR enables default export and CPU execution for matching FP16/32/64 inputs, producing complex32/64/128 outputs. The portable kernel supports broadcasting and output resizing, and requires default contiguous dimension order. Edge dtype mapping now includes complex32.
Note:
aten.complex.defaultis temporarily allowed by the verifier while keeping IR validation enabled. A separate PyTorch change is needed to formally include it in Core ATen. This exception can be removed once all supported PyTorch versions include that change.Fixes #24328
Test plan
Rebuild the native bindings and C++ tests from this branch, then
Result: Python unittest reported 24 tests passed; GoogleTest reported 21/21 complex kernel tests passed; CTest reported 1/1 test target passed. No failures.
cc @larryliu0820 @manuelcandales @JakeStevens @nil-is-all