EnzymeAD / EnzymeAD/Enzyme-JAX

missing all_finite simplifications

Open
#1,387 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
MLIR
Stars
131
Forks
53
Avg merge
1d 10h
Merged PRs (30d)
193

Description

```julia
julia> fn(x) = x == -Inf
fn (generic function with 1 method)

julia> @code_hlo compile_options=CompileOptions(; all_finite=true) fn(ConcreteRNumber(3.0))
module @reactant_fn attributes {mhlo.num_partitions = 1 : i64, mhlo.num_replicas = 1 : i64} {
func.func @main(%arg0: tensor) -> tensor {
%cst = stablehlo.constant dense<0xFFF0000000000000> : tensor
%0 = stablehlo.compare EQ, %arg0, %cst : (tensor, tensor) -> tensor
return %0 : tensor
}
}

julia> @code_hlo compile_options=CompileOptions(; all_finite=true, no_nan=true) fn(ConcreteRNumber(3.0))
module @reactant_fn attributes {mhlo.num_partitions = 1 : i64, mhlo.num_replicas = 1 : i64} {
func.func @main(%arg0: tensor) -> tensor {
%cst = stablehlo.constant dense<0xFFF0000000000000> : tensor
%0 = stablehlo.compare EQ, %arg0, %cst : (tensor, tensor) -> tensor
return %0 : tensor
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with the shown fn(x) = x == -Inf example and @code_hlo using CompileOptions(; all_finite=true) and no_nan=true. Trace the HLO generation path for these options and compare the emitted IR; done means the redundant comparison is simplified under the applicable finiteness assumptions.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.