cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ain0102
Observer
Observer
1,022 Views
Registered: ‎02-06-2018

pragma access_pattern Which pattern is faster?

Jump to solution

Hi.

I have to use access_pattern.

 

#pragma SDS data access_pattern(A:<pattern>)
void function(unsigned char A[10][1000])
{
    for(int i=0; i<ROW; i++)
    {
        for(int j=0; j<COL; j++)
        {
            if ( ... )
                A[i][j] = 0;
            if ( ... )
                A[i-1][j] = 1;
            if ( ... )
                A[i+1][j] = 1;
        }
    }
}

My algorithm should use the 'RANDOM' pattern.

 

Is the 'RANDOM' pattern slower than 'SEQUENTIAL' ?

 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
khareashish_trimble
Adventurer
Adventurer
987 Views
Registered: ‎10-17-2017

The RANDOM access pattern would allow a random access to the data however it would require the whole array to be transferred to the hardware accelerator and stored in BRAM. This would increase your BRAM utilization. 

 

On the other hand SEQUENTIAL access does not require memory to store the whole array. The processing of the array elements can be pipelined. The accelerator can start processing new elements while the old ones are still being processed.  

 

 

I wanna say the RANDOM access pattern could be somewhat slower than SEQUENTIAL but I haven't really experimented with it personally. 

 

 

View solution in original post

1 Reply
khareashish_trimble
Adventurer
Adventurer
988 Views
Registered: ‎10-17-2017

The RANDOM access pattern would allow a random access to the data however it would require the whole array to be transferred to the hardware accelerator and stored in BRAM. This would increase your BRAM utilization. 

 

On the other hand SEQUENTIAL access does not require memory to store the whole array. The processing of the array elements can be pipelined. The accelerator can start processing new elements while the old ones are still being processed.  

 

 

I wanna say the RANDOM access pattern could be somewhat slower than SEQUENTIAL but I haven't really experimented with it personally. 

 

 

View solution in original post