Runtime Compile Error when using Struct
See original GitHub issueGot runtime compiling error like the following:
<program source>:39:29: warning: declaration of 'struct Vecter3D' will not be visible outside of this function
void Compute(global struct Vecter3D* x, global double* y, double a)
^
<program source>:42:16: error: subscript of pointer to incomplete type '__global struct Vecter3D'
y[num] = a * x[num].x + a * x[num].y + a * x[num].z;
~^
<program source>:39:29: note: forward declaration of 'struct Vecter3D'
void Compute(global struct Vecter3D* x, global double* y, double a)
My struct
[StructLayout(LayoutKind.Sequential)]
public struct Vecter3D
{
public double x;
public double y;
public double z;
}
Here is the kernal
[OpenCLKernel]
public void Compute([Global][Amplifier.OpenCL.StructAttribute] Vecter3D[] x, [Global] double[] y, double a)
{
int i = get_global_id(0);
y[i] = a * x[i].x + a *x[i].y + a * x[i].z;
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Compile time error when using struct in other c file
I am using a structure that I defined in main.h and now using it in stack.c. In my main.h I have defined struct...
Read more >Difference between Compile Time Errors and Runtime Errors
This compiler error indicates something that must be fixed before the code can be compiled. All these errors are detected by the compiler...
Read more >Generic struct including itself breaks the runtime - should ...
When a struct B contains an instance field of type A and A is a struct type, it is a compile-time error for...
Read more >internal compiler error: method X on struct {} not found · ...
compiler /runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation ...
Read more >Unsafe.SkipInit<T>(T) Method
This error occurs because the compiler expects all fields of the struct to be initialized before the struct is used or returned to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@optimus-code Thanks for your feedback. Looking into the struct issue today, will give an update soon
I have updated the example code, I think you missed passing the struct to the compiler so it couldn’t find in the kernel. Apologies for less documentation, just working alone on this now 😃