<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic String Functions and efficiency in SSE4.2 in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/String-Functions-and-efficiency-in-SSE4-2/m-p/795867#M2739</link>
    <description>&lt;P&gt;Here is a description of an algorithm for a "Hash" like approach for finding all Sub-strings in a String:&lt;/P&gt;&lt;P&gt;For example,&lt;/P&gt;&lt;P&gt; Input String ( IS )  : "000123000123000123000"&lt;BR /&gt; Search Sub-string ( SS ): "123"&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;. If len(SS) &amp;gt; len(IS) there are no Sub-strings and go to &lt;STRONG&gt;11&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;. Allocate an Array for Positions of 1st characters of all Found Sub-strings ( APFS )&lt;BR /&gt; ( Estimated length is: ( len(IS) / len(SS) ) + some number of guard bytes )&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;. Calculate a Hash for the Search Sub-string "123" ( HSS ): HSS = '1'+'2'+'3' = 49+50+51 = 150&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;. Calculate a Hash for a Current Sub-string ( HCS ): HCS = '0'+'0'+'0' = 48+48+48 = 144&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;. Compare HSS and HCS&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;5&lt;/STRONG&gt;. If equal, save in APFS a position of the 1st character of the found Sub-string in the IS and advance for len(SS) characters&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;6&lt;/STRONG&gt;. End of the Input String ( IS )? If Yes, go to step 9. If Not, continue processing&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;7&lt;/STRONG&gt;. Calculate a Hash for a new Current Sub-string: HCS = HCS - &amp;lt; CS[0] &amp;gt; + &amp;lt; IS[next-char] &amp;gt; = 144-'0'+'1'= 144-48+49 = 145&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;8&lt;/STRONG&gt;. Go to step 4&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;9&lt;/STRONG&gt;. Do all the rest processing with found Sub-strings ( use APFS )&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;. Release memory of APFS&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;11&lt;/STRONG&gt;. Done&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Notes&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;- This is almost a Classic or a Book like approach&lt;BR /&gt;- Could be implemented with SSE&lt;BR /&gt;- Could be done in parallel for very long input strings&lt;BR /&gt;- Since this is your College Project I can't provide the source codes for the algorithm, but&lt;BR /&gt; I could help you with a review, tune-ups, etc. You could switch to aprivate posting if you wish.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Mar 2012 17:29:24 GMT</pubDate>
    <dc:creator>SergeyKostrov</dc:creator>
    <dc:date>2012-03-06T17:29:24Z</dc:date>
    <item>
      <title>String Functions and efficiency in SSE4.2</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/String-Functions-and-efficiency-in-SSE4-2/m-p/795866#M2738</link>
      <description>Hello,&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I'm a student and doing my College Project about pattern searching. Hence String Functions are useful to achieve the goal.&lt;BR /&gt;&lt;BR /&gt;The point is that &lt;A target="_blank" href="http://software.intel.com/sites/products/documentation/hpc/composerxe/en-us/2011Update/ippxe/ipp_manual_lnx/hh_goto.htm#IPPS/ipps_ch11/functn_Find.htm"&gt;Find function&lt;/A&gt; just returns the first match position in a text, e.g:&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Courier;"&gt;Text: Surfing n Turfing&lt;BR /&gt;pos: 0123456789abcdef0&lt;BR /&gt;pattern to search: urfi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;Find
 function would return position '1' as index, but actually there is a 
match in position 'b' too. I know that the most logical solution would 
be search again in the text from position '2', but maybe it would not be
 the most efficient solution.&lt;BR /&gt;&lt;BR /&gt;As far as I know (*1), processors 
with SSE4.2 technology have 16-byte registers and they can work in 
parallel in the pattern matching process, as shown below:&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Courier;"&gt;pattern to search: urfi&lt;BR /&gt; &amp;lt;-- 16 bytes --&amp;gt;&lt;BR /&gt;Text: Surfing n Turfin&lt;BR /&gt;result: 0100000000010000&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;That is, Find function returns just first position but actually the processor knows all matched positions in 16-byte length.&lt;BR /&gt;&lt;BR /&gt;So, I think it could be more efficient if there would be any function that would return all matched positions.&lt;BR /&gt;&lt;BR /&gt;My questions are the next:&lt;BR /&gt;&lt;OL&gt;&lt;LI&gt;Does anyone know if there is any function that works on that way?&lt;/LI&gt;&lt;LI&gt;If
 not (and maybe is outside the scope of this forum), how could I create 
my own function to achieve that goal? Is there any Intel tool to create 
custom functions? Would either FASM or NASM be a good option?&lt;/LI&gt;&lt;/OL&gt;&lt;DIV&gt;&lt;/DIV&gt;(*1):&lt;BR /&gt;&lt;A href="http://softwarecommunity.intel.com/userfiles/en-us/d9156103.pdf"&gt;http://softwarecommunity.intel.com/userfiles/en-us/d9156103.pdf&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.strchr.com/strcmp_and_strlen_using_sse_4.2"&gt;http://www.strchr.com/strcmp_and_strlen_using_sse_4.2&lt;/A&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 06 Mar 2012 10:11:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/String-Functions-and-efficiency-in-SSE4-2/m-p/795866#M2738</guid>
      <dc:creator>Pablo_Cantos</dc:creator>
      <dc:date>2012-03-06T10:11:12Z</dc:date>
    </item>
    <item>
      <title>String Functions and efficiency in SSE4.2</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/String-Functions-and-efficiency-in-SSE4-2/m-p/795867#M2739</link>
      <description>&lt;P&gt;Here is a description of an algorithm for a "Hash" like approach for finding all Sub-strings in a String:&lt;/P&gt;&lt;P&gt;For example,&lt;/P&gt;&lt;P&gt; Input String ( IS )  : "000123000123000123000"&lt;BR /&gt; Search Sub-string ( SS ): "123"&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;. If len(SS) &amp;gt; len(IS) there are no Sub-strings and go to &lt;STRONG&gt;11&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;. Allocate an Array for Positions of 1st characters of all Found Sub-strings ( APFS )&lt;BR /&gt; ( Estimated length is: ( len(IS) / len(SS) ) + some number of guard bytes )&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;. Calculate a Hash for the Search Sub-string "123" ( HSS ): HSS = '1'+'2'+'3' = 49+50+51 = 150&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;. Calculate a Hash for a Current Sub-string ( HCS ): HCS = '0'+'0'+'0' = 48+48+48 = 144&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;. Compare HSS and HCS&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;5&lt;/STRONG&gt;. If equal, save in APFS a position of the 1st character of the found Sub-string in the IS and advance for len(SS) characters&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;6&lt;/STRONG&gt;. End of the Input String ( IS )? If Yes, go to step 9. If Not, continue processing&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;7&lt;/STRONG&gt;. Calculate a Hash for a new Current Sub-string: HCS = HCS - &amp;lt; CS[0] &amp;gt; + &amp;lt; IS[next-char] &amp;gt; = 144-'0'+'1'= 144-48+49 = 145&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;8&lt;/STRONG&gt;. Go to step 4&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;9&lt;/STRONG&gt;. Do all the rest processing with found Sub-strings ( use APFS )&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;10&lt;/STRONG&gt;. Release memory of APFS&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;11&lt;/STRONG&gt;. Done&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Notes&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;- This is almost a Classic or a Book like approach&lt;BR /&gt;- Could be implemented with SSE&lt;BR /&gt;- Could be done in parallel for very long input strings&lt;BR /&gt;- Since this is your College Project I can't provide the source codes for the algorithm, but&lt;BR /&gt; I could help you with a review, tune-ups, etc. You could switch to aprivate posting if you wish.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2012 17:29:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/String-Functions-and-efficiency-in-SSE4-2/m-p/795867#M2739</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2012-03-06T17:29:24Z</dc:date>
    </item>
  </channel>
</rss>

