Skip to content

Commit

Permalink
Fix a constraint in bitcast_convert op (#1637)
Browse files Browse the repository at this point in the history
As recommended in
https://github.com/openxla/stablehlo/pull/1566/files/13a2c8b6e518d611fb7bd0747096392478291eef#r1237644676,
the constraint in `bitcast_convert` is revised to make sure that the
`num_bits(E) % num_bits(E') == 0` when `num_bits(E') < num_bits(E)` and
`num_bits(E') % num_bits(E) == 0` when `num_bits(E) < num_bits(E')`.

Note that this does not need a change in existing verification and
testing as the the verifier for `bitcast_convert` is doing the exact
[check](https://github.com/openxla/stablehlo/blob/d8f0c12e2a7541cfe6ba3a04c8a2fb350bdab43d/stablehlo/dialect/TypeInference.cpp#L3174)
as proposed in the PR.
  • Loading branch information
sdasgup3 authored Jun 22, 2023
1 parent ff89c93 commit 5ae526d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -1310,11 +1310,11 @@ implementation-defined as well.
* If `num_bits(E') < num_bits(E)`:
* `rank(result) = R + 1`.
* `dim(result, i) = dim(operand, i)` for all `0 <= i < R`.
* `dim(result, R) = num_bits(E) / num_bits(E')`.
* `dim(result, R) * num_bits(E') = num_bits(E)`.
* If `num_bits(E') > num_bits(E)`:
* `rank(result) = R - 1`.
* `dim(result, i) = dim(operand, i)` for all `0 <= i < R`.
* `dim(operand, R - 1) = num_bits(E') / num_bits(E)`.
* `dim(operand, R - 1) * num_bits(E) = num_bits(E')`.
* (C2) If `is_complex(operand) or is_complex(result)`, then
`is_complex(operand) and is_complex(result)`.

Expand Down

0 comments on commit 5ae526d

Please sign in to comment.