cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

VST_RT
Journeyman III

Swap

exchange values by index

HI,

what i want to do is a swap. iam using Brook+

i call the kernel with a datastrea. in the kernel i want to change some specific values of this stream according to the index.

to have acces to the index, i cant use a stream so i use gather array.

kernel void
ABC(int dir, int m0, float x[],...

but a gather array is read only so i cant change the values.

is there a build in function that i missed?

local arrays are also forbidden, a local stream could help, eventually. but i dont know how to fill it, within the kernel function.

thank you for helping.

 

Tags (1)
0 Likes
10 Replies
ryta1203
Journeyman III

Swap

You can't change the values of the incoming gather stream but you can assign the values of an outgoing stream and then use that.

This is a streaming environment, so yes, it's like a way one street. I'm also  confused how a local array would help you here?

Maybe you could post some simple psuedo code of what you are trying to accomplish.

0 Likes
VST_RT
Journeyman III

Swap

Hi and thanks again.

masterplan is a VST_PLUGIN. now i thought i could implement a FFT on the GPU.

i would do something like that:

fft(in,out)

...

temp = in

in = in

in = temp

...

 

local arrays or local pointers, would make it easier to get some c++ code "converted" to brook code. in this case copieng the input to a local array and do the swap thing on the local array or somethign like that.

bye

0 Likes
VST_RT
Journeyman III

Swap

Hi,

now iam doing it this way:

kernel void FFT(float p[][], out float data[][], int width)
{
    int2 index = instance().xy;
    ix = index.x;
    iy = index.y;   
    data[iy][ix] = p[iy][ix];

 . . .

                temp = data[width-i-1][ix];
                data[width-i-1][ix] = data[width-j-1][ix]; //IS THIS ALLOWED?
                data[width-j-1][ix] = temp;

 . . .

 

}

 

its compiling but its not working, after an IFFT the soundoutput is not ok.

i think ididnt really get the gather,scatter thing...

0 Likes
gaurav_garg
Adept I

Swap

Read from scatter is not allowed.

0 Likes
ryta1203
Journeyman III

Swap

Let me know if I've missed something, since I really don't know what's going on inside the "...." code lines.

kernel void FFT(float p[][], out float data[][], int width) { int2 index = instance().xy; ix = index.x; iy = index.y; data[iy][ix] = p[iy][ix]; . . . temp = p[width-i-1][ix]; data[width-i-1][ix] = p[width-j-1][ix]; //IS THIS ALLOWED? data[width-j-1][ix] = temp; . . . } Why not that?

0 Likes
youplaboom
Journeyman III

Swap

Originally posted by: VST_RT

 

i think ididnt really get the gather,scatter thing...

 

gather: read only

scatter: write only

0 Likes
VST_RT
Journeyman III

Swap

thanks for the replys!

ok then read or not read... if thats all i got it.

 

 @ryta: argh, is see i posted a wrong piece of code.  it was :

data[][] = data[][];

and thats not nice. but compiled without error.

i really think, that a FFT isnt a good piece of work to do on a GPU. because the data is "indexed", so there is no independeny of data, and thats a problem in the whole SIMD idea!?

0 Likes
ryta1203
Journeyman III

Swap

FFTs work fine on GPUs... personally I just think you are having a problem grasping the "streaming" concept still.

0 Likes
VST_RT
Journeyman III

Swap

mh. ok, so maybe you can lighten me? some good piece of paper to read?

i really appreciate your help, thank you very much.

 

0 Likes