occa icon indicating copy to clipboard operation
occa copied to clipboard

Deep copy support for structs

Open amikstcyr opened this issue 7 years ago • 2 comments

Hi OCCA-ers,

For non-trivial (read big-ol-mess) codes, it is sometimes necessary to copy structs (which contain also structs or stl containers) to the GPU & back ... (well at least to the GPU :-)). This avoids costly API changes when more than a handful of functions need to "kernel-ized".

Not sure about the flexibility of the current parser but maybe a low-hanging fruit using source to source tricks could be employed?

Best,

Amik

amikstcyr avatar Oct 08 '18 14:10 amikstcyr

Structs of structs with basic types (like int/double/nested structs in #141) is probably the next feature to be added, so stay tuned :)

I don't think we can handle pointers in structs easily though, but maybe we can build up another occa::X type that can translate between host <--> device

dmed256 avatar Oct 10 '18 01:10 dmed256

@amikstcyr Basic structs are now be available in beec0865857f5fbdf55554deb596396b40614357

Missing:

  • typedef-ing structs

    typedef struct { } foo;
    
  • Expanding @attributes on struct variables

    struct mat3 {
      int *values @dim(3, 3);
    }
    mat3 m;
    // Error since the parser right now doesn't "know" `values` is a @dim(3, 3)
    m.values(0, 0); 
    
  • Access level modifiers are not supported at the moment

    struct foo {
      private: ...
    }
    

dmed256 avatar Apr 04 '19 08:04 dmed256