Hi,
Can you please post your system configuration: CPU,GPU,SDK,DRIVER,OS.
Also posting a nice testcase which reproduces the crash would be helpful.
Please refer to section 6.10.1 of OpenCL Spec for confirming any syntax issues you might be having.
Thanks Himanshu,
Yes, I have refer to section 6.10.1 already 😛 and finally what I understand is that I have to also add "__attribute__((packed))" to my union.
Does the syntax is correct ? I want a structure that is fully packed as a normal C++ structure !
But, unfortunately it does not work ! I have checked the alignment with and it sounds correct 😛
NB: Also, have you been able to debug the "software" I've sent you ? The one that crash with SDK 2.4 ?
I work under Win7 64 bits, on a Intel CPU !
Please post some code to show the crash or data corruption.
Suggest you try "aligned", not "packed".
Maybe your computer is running on a 64-bit CPU. Mine is 32-bit
Yes, for now I use a 64 bits computer.
But alignment should be the same ?
In the OpenCL spec. page 199, they wrote this :
"You may only specify this attribute on the definition of a enum, struct or
union, not on a typedef which does not also define the enumerated type,
structure or union."
Does it mean that I cannot pack a "typedef" ? or that I can write :
typedef struct __attribute__((packed)) MyStruct {...};
But not ?
typedef __attribute__((packed)) struct MyStruct {...};
NB: I have replace my typedef with a struct, but it still crash !!!
NB2 : I cannot use "align" because my OpenCL code is generated at run-time. So, it is difficult to do and error prone 😛 (Also, my buffer is generated from a malloc, then filled at run-time with memcpy !!)
Even with this version... I still got a crash !!!
struct __attribute__((packed)) ShaderParam_transmissive { float Ks __attribute__((packed)); clSpectrum Cs __attribute__((packed)); float eta __attribute__((packed)); }; struct __attribute__((packed)) ShaderParametersStruct { uint shaderId __attribute__((packed)); union __attribute__((packed)) { struct ShaderParam_emitter emitter; struct ShaderParam_glass glass; struct ShaderParam_matte matte; struct ShaderParam_matte_rough matte_rough; struct ShaderParam_mirror mirror; struct ShaderParam_plastic plastic; struct ShaderParam_Textured_emitter Textured_emitter; struct ShaderParam_Textured_glass Textured_glass; struct ShaderParam_Textured_matte Textured_matte; struct ShaderParam_Textured_mirror Textured_mirror; struct ShaderParam_transmissive transmissive; } __attribute__((packed)) params __attribute__((packed)); };