Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Vectorization need not be limited to single register which can hold large data. Like using '128' bit register to hold '4 x 32' bit data. It depends on architectural limitations. Some architecture have different execution units which have registers of their own. In that case, a part of the data can be fed to that execution unit and the result can be taken from a register corresponding to that execution unit.<br></p> <p>For example, consider the below case.<br></p> <blockquote> <p>for(i=0; i &lt; N; i++)<br> {<br> a[i] = a[i] + b[i];<br> }<br></p> </blockquote> <p><br> <br> If I am working on an architecture which has two execution units, then my vector size is defined as two. The loop mentioned above will be reframed as<br></p> <blockquote> <p>for(i=0; i&lt;(N/2); i+=2)<br> {<br> a[i] = a[i] + b[i] ;<br> <br><br> a[i+1] = a[i+1] + b[i+1];<br> }</p> <p>NOTE: The 2 inside the for statement is derived from the vector size.<br></p> </blockquote> <p>As I am having two execution units the two statements inside the loop will be fed into the two execution units. The sum will be accumulated in the execution units separately. Finally the sum of accumulated values (from two execution units) will be carried out.<br> <br> The good practices are <br> 1. The constraints like dependency (between different iterations of the loop) needs to be checked before vectorizing the loop.<br> 2. Function calls needs to be prevented.<br> 3. Pointer access can create aliasing and it needs to be prevented.<br></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload