Skip to content
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

Add support for global variables #2

Open
int3h opened this issue May 15, 2013 · 0 comments
Open

Add support for global variables #2

int3h opened this issue May 15, 2013 · 0 comments

Comments

@int3h
Copy link
Member

int3h commented May 15, 2013

We should add support for global variables. A common pattern is to have the Root node have input attributes, which is set by host code at runtime. Then each node in the tree pushes this value down to its children.

This pattern is so common, we should implement language support for it. The easiest option for this is creating a macro for the push-down code, so that we simply annotate the 'global' attributes in the root, and then the macro will take care of making sure each node in the tree has a copy of them assigned to it. However, this still has the problem that we're duplicating every global variable for every node in the tree, taking space and time.

The other option is to implement compiler/backend support for globals wherein we have a memory location accessible to every node. Global values exist in this buffer only, and access to them by FTL code is rewritten to be an access of this global buffer. Before committing to this, we should investigate performance characteristics (e.g., to avoid memory access bottlenecking, or if we should have this global buffer copied to thread group local memory at the start of computation, etc.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant