oneAPI-spec
oneAPI-spec copied to clipboard
Global variables
Could DPC++ support global variables in device memory and USM, and a memcpy function for copying data from host to the global variable?
Would Codeplay's extension proposal https://github.com/codeplaysoftware/standards-proposals/pull/132 address your use-case?
@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();
);
}