GithubHelp home page GithubHelp logo

Comments (4)

csyonghe avatar csyonghe commented on July 27, 2024

Our front-end currently don't allow empty initializing arrays whose size is not known at compile time. But it seems that you can work around this by initializing the array explicitly in the entrypoint. Or you can try something like:

groupshared uint totals[workgroup_subgroups] = __makeArrayFromElement<workgroup_subgroups>(0);

__intrinsic_op(makeArrayFromElement)
Array<uint, N> __makeArrayFromElement<let N:int>(uint element);

from slang.

csyonghe avatar csyonghe commented on July 27, 2024

Note that initialization of groupshared variable is not a currently supported feature. The compiler currently generates in-efficient code in that every thread will try to assign to the variable at the begining of the entrypoint.

from slang.

kevinboulain avatar kevinboulain commented on July 27, 2024

If it weren't for the extern length, the initialization would have compiled. Is the link phase (when extern/export is resolved) not considered compile time?
Though, as you said, it would have resulted in inefficient code. Should initialization of groupshared memory be disallowed by default then (to avoid a potential surprise if nothing better can be done)?

(Feel free to close by the way, especially if you judge nothing is really broken here.)

from slang.

csyonghe avatar csyonghe commented on July 27, 2024

Yeah, I think we need to work on the diagnostic to disallow initialization of groupshared variables as a separate issue.

Closing this one.

from slang.

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.