Note that there are some explanatory texts on larger screens.

plurals
  1. POOpenCL kernel not vectorized
    primarykey
    data
    text
    <p>I am trying to build a kernel to do parallel string search. To this end I tend to use a finite state machine. The transition table of the fsm is in the kernel argument states. The code:</p> <pre><code> __kernel void Find ( __constant char *text, const int offset, const int tlenght, __constant char *characters, const int clength, const int maxlength, __constant int *states, const int statesdim){ private char c; private int state; private const int id = get_global_id(0); if (id&lt;(tlenght-maxlength)) { private int cIndex,sd,s,k; for (int i=0; i&lt;maxlength; i++) { c = text[i+offset]; cIndex = -1; for (int j=0; j&lt;clength; j++) { if (characters[j]==c) { cIndex = j; } } if (cIndex==-1) { state = 0; break; } else { s = states[state+cIndex*statesdim]; } if (state&lt;=0) break; } } } </code></pre> <p>If I compile this kernel using iocgui, I get the result: </p> <pre><code>Using default instruction set architecture. Intel OpenCL CPU device was found! Device name: Pentium(R) Dual-Core CPU T4400 @ 2.20GHz Device version: OpenCL 1.1 (Build 31360.31426) Device vendor: Intel(R) Corporation Device profile: FULL_PROFILE Build started Kernel &lt;Find&gt; was successfully vectorized Done. Build succeeded! </code></pre> <p>When I change the line where the new state is determined to:</p> <pre><code>state = states[state+cIndex*statesdim]; </code></pre> <p>The result is:</p> <pre><code>Using default instruction set architecture. Intel OpenCL CPU device was found! Device name: Pentium(R) Dual-Core CPU T4400 @ 2.20GHz Device version: OpenCL 1.1 (Build 31360.31426) Device vendor: Intel(R) Corporation Device profile: FULL_PROFILE Build started Kernel &lt;Find&gt; was not vectorized Done. Build succeeded! </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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