Skip to content

Conversation

@vchuravy
Copy link
Collaborator

@vchuravy vchuravy commented Sep 4, 2025

Requires EnzymeAD/Enzyme.jl#2551

It's a little bit "weird" in that we tell Enzyme to just treat this as a Float32 and then use a custom rule for stochastic_round.

During Reverse mode we are performing accumulation and this strategy would not perform stochastic rounding for those operations.

using StochasticRounding
import StochasticRounding: stochastic_round

function Enzyme.typetree_inner(::Type{Float32sr}, ctx, dl, seen::Enzyme.Compiler.TypeTreeTable)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so as is this can result in some errors, specifically if an all-zero bits is not a valid zero, or in reverse mode of a 32-bit floating point add is not a correct add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants