Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#72131 - Missing optimization because of inconsistent relation between Julia and llvm ?
Attached to Project:
Community Packages
Opened by Iago-lito (iago-lito) - Tuesday, 14 September 2021, 12:30 GMT
Last edited by Antonio Rojas (arojas) - Wednesday, 15 September 2021, 14:11 GMT
Opened by Iago-lito (iago-lito) - Tuesday, 14 September 2021, 12:30 GMT
Last edited by Antonio Rojas (arojas) - Wednesday, 15 September 2021, 14:11 GMT
|
DetailsDescription: The `julia` packages uses local `llvm` version 12 instead of version 11 like the official julia binary. As a (likely) consequence, one optimization is not performed.
This julia file: ```julia using BenchmarkTools BenchmarkTools.DEFAULT_PARAMETERS.seconds = 1 function average(collection) cumsum = 0 for value in collection cumsum += value end cumsum / length(collection) end r1 = 1:1_000_000 r2 = 1:2_000_000 println("ranges") @btime average($r1) @btime average($r2) ``` Outputs something like the following when using the official `julia` binary: ``` 3.168 ns (0 allocations: 0 bytes) 2.675 ns (0 allocations: 0 bytes) ``` The time complexity has been optimized to O(1) with internal use of the triangular number `N * (N + 1) / 2`. But with the `julia` binary obtained from vanilla `pacman` installation, I get: ``` 440.674 μs (0 allocations: 0 bytes) 898.528 μs (0 allocations: 0 bytes) ``` No optimization is made, and time complexity in O(N). The only difference I noticed is the LLVM version and the `*` next to commit number, here with the `pacman` version: ``` $ /usr/bin/julia _ _ _ _(_)_ | Documentation: https://docs.julialang.org (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 1.6.2 (2021-07-14) _/ |\__'_|_|_|\__'_| | |__/ | julia> versioninfo() Julia Version 1.6.2 Commit 1b93d53fc4* (2021-07-14 15:36 UTC) Platform Info: OS: Linux (x86_64-pc-linux-gnu) CPU: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-12.0.1 (ORCJIT, skylake) ``` .. and here with the official binary: ``` $ ./julia-1.6.2/bin/julia _ _ _ _(_)_ | Documentation: https://docs.julialang.org (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 1.6.2 (2021-07-14) _/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release |__/ | julia> versioninfo() Julia Version 1.6.2 Commit 1b93d53fc4 (2021-07-14 15:36 UTC) Platform Info: OS: Linux (x86_64-pc-linux-gnu) CPU: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-11.0.1 (ORCJIT, skylake) ``` .. should this be reported here, or at Julia's, or at LLVM? |
This task depends upon
Closed by Antonio Rojas (arojas)
Wednesday, 15 September 2021, 14:11 GMT
Reason for closing: Fixed
Additional comments about closing: julia 1.6.2-4
Wednesday, 15 September 2021, 14:11 GMT
Reason for closing: Fixed
Additional comments about closing: julia 1.6.2-4
```julia
using Pkg
pkg"add BenchmarkTools"
```
to fully reproduce.
https://github.com/JuliaLang/julia/blob/release-1.6/deps/llvm.mk
EDIT: using the bundled LLVM without any of the patches is also fast, must be some compilation flag.