Coder Social home page Coder Social logo

Comments (6)

nsajko avatar nsajko commented on September 22, 2024 1

there should be a possibility for the user to tell the compiler there's no aliasing

That already exists. There's both:

  1. An experimental API in Base: Base.Experimental.Const and Base.Experimental.@aliasscope.

  2. The user package UnsafeAssume.jl, which allows telling the compiler other things, too.

Also see #52851.

from julia.

Keno avatar Keno commented on September 22, 2024

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.

juliaUser42 avatar juliaUser42 commented on September 22, 2024

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.

oscardssmith avatar oscardssmith commented on September 22, 2024

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.

sgaure avatar sgaure commented on September 22, 2024

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.

KristofferC avatar KristofferC commented on September 22, 2024

Still, making the change would probably require some careful evaluation, I'm sure some people are using TBAA violating workarounds.

After ReshapedArrays 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.