Skip to content

mapreduce uses @simd which can cause different results depending on optimizations #59657

@LilithHafner

Description

@LilithHafner

This produced incorrect answers in a real-world workflow. This is a simplified MWE:

$ julia --startup=no
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.11.5 (2025-04-14)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> x = Float32[429.17752, 429.2375, 429.29248, 430.21002, 430.995, 431.16498, 431.025, 430.995, 430.995, 430.995, 430.77252, 430.575, 430.255, 430.0, 430.375, 430.535];

julia> f = identity
identity (generic function with 1 method)

julia> sum(x -> identity(x), x)
6886.6f0

julia> sum(x -> f(x), x)
6886.6006f0

julia> versioninfo()
Julia Version 1.11.5
Commit 760b2e5b739 (2025-04-14 06:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (aarch64-linux-gnu)
  CPU: 64 × Neoverse-N1
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, neoverse-n1)
Threads: 64 default, 0 interactive, 32 GC (on 64 virtual cores)
Environment:
  JULIA_CONDAPKG_BACKEND = Null
  JULIA_CONDAPKG_EXE = /home/ubuntu/temple/.venv/bin/python
  JULIA_PROJECT = @.
  JULIA_NUM_THREADS = auto

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsThis change adds or pertains to documentationfoldsum, maximum, reduce, foldl, etc.mathsMathematical functions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions