-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement ConditionallySpeculatable for Fft (#2225)
The logic is the same as for unary ops, except that if the type of FFT is RFFT or IRFFT then the last `fft_length.size()` dimensions in the operand need to be static (for speculatability), because there are extra constraints on them that could turn out to be false at runtime if they are dynamic. Indeed, there is a general constraint that `shape(result) = shape(operand)`. For RFFT, the operand type element type is float, so the last `fft_length.size()` dims in the operand have to be static, because `fft_length` is static (it is an attribute). For IRFFT, the result element type is float, so the last `fft_length.size()` dims in the result are inferred from the `fft_length`, and they need to match the operand, so those dims have to be static in the operand. There are also constraints on the last dimension, but `size(fft_length) >= 1` so that is already covered by the previous check. The relevant constraints from the spec are: ``` (C4) If among operand and result, there is a tensor real of a floating-point type, then shape(real)[-size(fft_length):] = fft_length. (C5) shape(result) = shape(operand) except for: * If fft_type = RFFT, dim(result, -1) = dim(operand, -1) = 0 ? 0 : dim(operand, -1) / 2 + 1. * If fft_type = IRFFT, dim(operand, -1) = dim(result, -1) = 0 ? 0 : dim(result, -1) / 2 + 1. ```
- Loading branch information
mlevesquedion
authored
Apr 17, 2024
1 parent
6515513
commit 9fb78c1
Showing
3 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters