Skip to content

Issue using -ffast-math with NaN #2073

Closed
@tlepley-cadence

Description

@tlepley-cadence

With clang, libjit is compiled with the -ffast-math option, but it should be avoided in case of usage of NaN. For instance, in gcc, the -ffast-math flag activates the -ffinite-math-only flag that disables the NaN functionality.

With the ReplaceNaN operator, Glow makes use of NaN in libjit.

It turns out that in my Linux environment, libjit_element_is_nan_kernel_f doesn't work properly. Even when a NaN number is provided, isnan() returns false (while printf by the way correctly prints NaN).
It makes the CPU/InterpAndCPU.replaceNaN/0 test fail.

When I disable -ffast-math for the target CPURuntime, the test passes correctly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions