EnzymeAD / EnzymeAD/Reactant.jl

inconsistent `a ^ b` (for negative `b`) for integers

Open
#1,366 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
370
Forks
74
Avg merge
18h 47m
Merged PRs (30d)
30

Description

```julia
julia> x = ConcreteRNumber(2)
ConcretePJRTNumber{Int64, 1, Reactant.Sharding.ShardInfo{Reactant.Sharding.NoSharding, Nothing}}(2)

julia> y = ConcreteRNumber(-4)
ConcretePJRTNumber{Int64, 1, Reactant.Sharding.ShardInfo{Reactant.Sharding.NoSharding, Nothing}}(-4)

julia> @code_hlo x ^ y
module @"reactant_^" attributes {mhlo.num_partitions = 1 : i64, mhlo.num_replicas = 1 : i64} {
func.func @main(%arg0: tensor, %arg1: tensor) -> tensor {
%0 = stablehlo.power %arg0, %arg1 : tensor
return %0 : tensor
}
}

julia> @jit x ^ y
ConcretePJRTNumber{Int64, 1, Reactant.Sharding.ShardInfo{Reactant.Sharding.NoSharding, Nothing}}(0)
```

The XLA behavior matches the SHLO spec. We need to do a manual cast here.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.