EnzymeAD / EnzymeAD/Reactant.jl

Arith raising to SHLO fails ONLY on TPU machine

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

Description

https://github.com/EnzymeAD/Reactant.jl/actions/runs/17169033996/job/48715206695?pr=1536#step:12:1214

```mlir
%28:2 = "mhlo.if"(%27) ({
%95 = "arith.constant"() <{value = 0 : tensor<2x1000xi1>}> : () -> tensor<2x1000xi1>
"mhlo.return"(%25, %95) : (tensor<2x1000xf32>, tensor<2x1000xi1>) -> ()
}, {
%80 = "mhlo.constant"() <{value = dense<0.000000e+00> : tensor}> : () -> tensor
%81 = "mhlo.broadcast_in_dim"(%80) <{broadcast_dimensions = dense<> : tensor<0xi64>}> : (tensor) -> tensor<2x1000xf32>
%82 = "mhlo.constant"() <{value = dense<1.000000e+00> : tensor}> : () -> tensor
%83 = "mhlo.broadcast_in_dim"(%82) <{broadcast_dimensions = dense<> : tensor<0xi64>}> : (tensor) -> tensor<2x1000xf32>
%84 = "mhlo.constant"() <{value = dense<0x7F800000> : tensor}> : () -> tensor
%85 = "mhlo.broadcast_in_dim"(%84) <{broadcast_dimensions = dense<> : tensor<0xi64>}> : (tensor) -> tensor<2x1000xf32>
%86 = "mhlo.constant"() <{value = dense<0x7F800000> : tensor}> : () -> tensor
%87 = "mhlo.broadcast_in_dim"(%86) <{broadcast_dimensions = dense<> : tensor<0xi64>}> : (tensor) -> tensor<1000xf32>
%88 = "mhlo.abs"(%22) : (tensor<1000xf32>) -> tensor<1000xf32>
%89 = "mhlo.compare"(%88, %87) <{comparison_direction = #mhlo}> : (tensor<1000xf32>, tensor<1000xf32>) -> tensor<1000xi1>
%90 = "mhlo.broadcast_in_dim"(%89) <{broadcast_dimensions = dense<1> : tensor<1xi64>}> : (tensor<1000xi1>) -> tensor<2x1000xi1>
%91 = "mhlo.abs"(%21) : (tensor<2x1000xf32>) -> tensor<2x1000xf32>
%92 = "mhlo.compare"(%91, %85) <{comparison_direction = #mhlo}> : (tensor<2x1000xf32>, tensor<2x1000xf32>) -> tensor<2x1000xi1>
%93 = "mhlo.select"(%92, %83, %81) : (tensor<2x1000xi1>, tensor<2x1000xf32>, tensor<2x1000xf32>) -> tensor<2x1000xf32>
%94 = "mhlo.select"(%90, %93, %25) : (tensor<2x1000xi1>, tensor<2x1000xf32>, tensor<2x1000xf32>) -> tensor<2x1000xf32>
"mhlo.return"(%94, %90) : (tensor<2x1000xf32>, tensor<2x1000xi1>) -> ()
}) : (tensor) -> (tensor<2x1000xf32>, tensor<2x1000xi1>)
```

The IR seems to be busted.

```diff
-%95 = "arith.constant"() <{value = 0 : tensor<2x1000xi1>}> : () -> tensor<2x1000xi1>
+%95 = "arith.constant"() <{value = dense<0> : tensor<2x1000xi1>}> : () -> tensor<2x1000xi1>
```

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.