Skip to content

Global variables #125

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

Open
WeiqunZhang opened this issue Apr 28, 2020 · 2 comments
Open

Global variables #125

WeiqunZhang opened this issue Apr 28, 2020 · 2 comments
Assignees
Labels
DPC++ enhancement New feature or request

Comments

@WeiqunZhang
Copy link

Could DPC++ support global variables in device memory and USM, and a memcpy function for copying data from host to the global variable?

@rscohn2 rscohn2 added DPC++ enhancement New feature or request labels Apr 28, 2020
@rolandschulz
Copy link

Would Codeplay's extension proposal codeplaysoftware/standards-proposals#132 address your use-case?

@WeiqunZhang
Copy link
Author

@rolandschulz Thanks for pointing to the extension proposal. It addresses some of our usages. But it's not clear if it works for the following example.

// File: parm.H
extern sycl::symbol<int> gv;
inline int f_using_gv () { return gv; }
// File: parm.cpp
#include "parm.H"
sycl::symbol<int> gv;
// functions for initializing gv via copying from host or launching a kernel to set gv.
// File: main.cpp
#include "parm.H"
int main(...) {
    sycl::queue q(...);
    q.submit(...
        int v = f_using_gv();
    );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DPC++ enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants