cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

bdegg
Journeyman III

Is there a way for a kernel to write to an array?

I'm using CAL on a dsp application, and I need each kernel instance to loop through a signal sample, and write the result of each iteration to a unique index in an output array.

Since the processing relies on feedback from the previous iteration, running a separate kernel for each iteration is not practical. Basically I need to run a one dimensional stream domain to write to a two dimensional output.

The only output method (that I could find) in the IL docs is a single value, per output, per kernel.

I'm sure there's a way to do this that I'm just not seeing, can someone point me in the right direction??

Thanks!

0 Likes
3 Replies
alexey_morozov
Journeyman III

Hi!

Instead of using output buffers with samples which are attached to a single kernel in the execution grid, use a global buffer resource which can be accessed linearly at any position. Details about using global buffers you will find in the documentation.

 

 

0 Likes

Excellent, thanks!

One thing isn't clear in the docs though. I see you can allocate a 2d global buffer in CAL, but it doesn't say how to write to 2d coordinates within IL. memexport only appears to accept one index value.

Is a 2d buffer unrolled into one long 1d buffer in IL?

0 Likes

Global memory resides as linear memory in GPU and it must be addressed using integer linear address.

0 Likes