You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 27, 2021. It is now read-only.
But it breaks with an error like this, somehow to do with differences in the packing of the tuple:
ERROR: Julia and OpenCL type don't match at kernel argument 6: Found Tuple{CLArrays.DeviceArray{UInt32,2,CLArrays.HostPtr{UInt32}},Cellular.Life{Cellular.RadialNeighborhood{:test,Cellular.Skip},Int32,Tuple{Int32,Int32}}}.
Please make sure to define OpenCL structs correctly!
You should be generally fine by using `__attribute__((packed))`, but sometimes the alignment of fields is different from Julia.
Consider the following example:
```
//packed
// Tuple{NTuple{3, Float32}, Void, Float32}
struct __attribute__((packed)) Test{
float3 f1;
int f2; // empty type gets replaced with Int32 (no empty types allowed in OpenCL)
// you might need to define the alignement of fields to match julia's layout
float f3; // for the types used here the alignement matches though!
};
// this is a case where Julia and OpenCL packed alignment would differ, so we need to specify it explicitely
// Tuple{Int64, Int32}
struct __attribute__((packed)) Test2{
long f1;
int __attribute__((aligned (8))) f2; // opencl would align this to 4 in packed layout, while Julia uses 8!
};
```
You can use `c.datatype_align(T)` to figure out the alignment of a Julia type!
I've been trying to broadcast with an argument like this:
But it breaks with an error like this, somehow to do with differences in the packing of the tuple: