-
Notifications
You must be signed in to change notification settings - Fork 115
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
OpenCL Backend: Argument Mapping #45
Comments
Unfortunately, it is not possible to pass (global) pointers to public struct Foo
{
public ArrayView<int> Data;
public long SomeField;
} cannot simply be passed to a kernel by creating a marshalling struct View_Int
{
__global int *ptr;
int length;
}
struct Foo
{
struct View Data;
long SomeField;
} One solution to this problem is to extract all nested void Kernel(Index index, ArrayView<int> source, Foo foo)
{
// ...
} As previously mentioned, this kernel cannot be represented in __kernel void Kernel(struct View_Int source, struct Foo foo)
{
// ...
} However, to avoid the problems presented, we can output the following __kernel void Kernel(
__global int *ptr1, // First nested view pointer
__global int *ptr2, // Second nested view pointer
struct View_Int source, // Source structure without pointer information from host
struct Foo foo) // Source structure without pointer information from host
{
// Setup view pointers in kernel code
source.ptr = ptr1;
foo.Data.ptr = ptr2;
// ...
} |
Unfortunately, the proposed solution does not work properly, since |
The new
CLArgumentMapper
maps managed values from the.Net
world to the OpenCL driver world. Since we have to map all intrinsic view types (which are an abstract concept) to actual kernel types, theCLTypeGenerator
class should do the job for us. However, it is not currently known whether OpenCL drivers accept structures with nested pointer declarations (they will not be passed as pointers but as constants - which should be acceptable...). We need to investigate this issue and change the classesCLArgumentMapper
/CLTypeGenerator
accordingly (if necessary).The text was updated successfully, but these errors were encountered: