question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Runtime Compile Error when using Struct

See original GitHub issue

Got 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:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
deepakkumar1984commented, Sep 21, 2021

@optimus-code Thanks for your feedback. Looking into the struct issue today, will give an update soon

0reactions
deepakkumar1984commented, Sep 26, 2021

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 😃 image

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found