New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Identical calls to getindex not optimised out #54281
Comments
The C version relies on TBAA between |
Hi Keno, |
to remove a little bit of the jargon from Keno's answer, the optimization that "obviously" can be done is only valid if writing to |
Perhaps there should be a possibility for the user to tell the compiler there's no aliasing? A |
That already exists. There's both:
Also see #52851. |
After |
Hi,
thanks for the great job you do on julia. I think I spotted a potential performance issue. Maybe this is know or expected or I am missing something. In any case, I could not find a relevant post that helped me to make sense of this.
versioninfo()
Julia Version 1.10.2
Commit bd47eca (2024-03-01 10:14 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 64 × AMD EPYC 7313 16-Core Processor
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 64 virtual cores)
Environment:
JULIA_DIR = /snap/julia/current
snap on Ubuntu
produces
The issue is that the identical calls to Base.getindex(Main.l, f) and Base.getindex(Main.u, f) are not optimised out and consequently executed twice. This is also evident in the output of @code_lowered and @code_typed.
Of course, this can be fixed easily by hand.
On the other hand, I would not expect having to do this because clang, icc and gcc perform this optimisation automatically all producing machine code similar to
see https://gcc.godbolt.org/z/z8e99c8oj
The text was updated successfully, but these errors were encountered: