cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

bjang
Journeyman III

type struct in kernel

Is "structure" allowed inside kernel?

I know it is allowed in non-kernel code in brook file but it doesn't seem to be supported inside kernel? There is a comment on this in Brook+ spec, page 10 but it is not clear.

0 Likes
3 Replies
Ceq
Journeyman III

It should work, you have an example in your Brook+ directory: " samples / tests / struct / struct.br "
However there could be a few issues in the current version, for example, if you try to use pointer type
inside a typedef structure and you don't use it in any kernel you'll get a compiler assertion failure.
(If you use it inside a kernel it will report "type not supported", but it would be very strange to require pointers inside kernels)
0 Likes

Originally posted by: Ceq It should work, you have an example in your Brook+ directory: " samples / tests / struct / struct.br " However there could be a few issues in the current version, for example, if you try to use pointer type inside a typedef structure and you don't use it in any kernel you'll get a compiler assertion failure. (If you use it inside a kernel it will report "type not supported", but it would be very strange to require pointers inside kernels)


I found that if I declare a float array inside the struct. The brook+ compile will complain too.  I think their don't like any form of pointer in the structure.

0 Likes

You should be able to use struct streams.

Pointers are not supported inside the kernels, but you can use indexing with gather/scatter streams.

0 Likes