Comments (6)
there should be a possibility for the user to tell the compiler there's no aliasing
That already exists. There's both:
-
An experimental API in
Base
:Base.Experimental.Const
andBase.Experimental.@aliasscope
. -
The user package UnsafeAssume.jl, which allows telling the compiler other things, too.
Also see #52851.
from julia.
The C version relies on TBAA between double
pointers and int
pointers to prove noalias. Our current TBAA hierachy isn't fine enough to require this, although the whole ReinterpretArray
change years ago was in preparation for making such a change. Still, making the change would probably require some careful evaluation, I'm sure some people are using TBAA violating workarounds.
from julia.
Hi Keno,
Thank you for your quick answer. I am an engineer literate in assembly - not a compiler guy. For my purposes, it's enough to know the limits of what the compiler can do or cannot do ;-)
from julia.
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 y
doesn't write to either u
or l
. In this case, this should be possible to prove via tbaa (type based alias analysis) since y
is a vector of floats, while the other arrays are vectors of Ints.
from julia.
Perhaps there should be a possibility for the user to tell the compiler there's no aliasing? A @noalias
macro applied to a method, or a loop? I can predict disastrous consequences since it's really a call site thing, not a method or instance thing, so it should probably not be used in generic code. It would be nice for the more speed aware users, though. If I recall correctly, I think I've used a fortran compiler many years ago (HP, IBM, PGI?) with a compiler flag -noaliasing
with this effect.
from julia.
Still, making the change would probably require some careful evaluation, I'm sure some people are using TBAA violating workarounds.
After ReshapedArray
s what (safe) ways are there to get aliasing between two Array
of different data type? I know there is still vec
so aliasing between matrix and vector of the same type is possible. Would it be hard to make that change and run a PkgEval?
from julia.
Related Issues (20)
- REPL hints and tab completion freezes the REPL HOT 5
- at-doc return type depends on whether REPL is loaded HOT 3
- Possible improvement in error messages for invalid array sizes HOT 1
- Looking up an instruction pointer (`StackTraces.lookup(::InterpreterIP)`) has dynamic dispatch
- Encounter a bug using DifferentialEquations HOT 5
- Should the test environment precompile (w/ `--check-bounds=yes`) when precompiling a package environment? HOT 4
- push!, append! AbstractVector implementations no longer work on Julia 1.11+
- 'make test' fails for julia-1.11.0-rc2 HOT 2
- `JULIA_NUM_THREADS` ignored when embedding Julia on a Windows system HOT 1
- Segmentation fault in Hermitian `eigen`/`eigvals` on nightly HOT 30
- Add ErrorHints stdlib HOT 5
- Load stdlib JLLs by path
- Consider dropping bfloat16 demotion pass HOT 1
- "Inferrable" `stdin` for use with trimmed programs
- `@test`'s use of kwargs is confusing and limits extensibility HOT 1
- Provide an error message if LD_PRELOAD is set during a Julia build or startup HOT 15
- Allow uplo='F' for Symmetric and Hermitian wrappers? HOT 2
- Shipped Windows binaries with new codesigning need `.ji` checksums updated HOT 3
- Emit OSC 9;9 escape sequences on Windows HOT 1
- Ambiguous behavior of Tuple constructor with mismatched array length HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from julia.