<?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 Is there anyone here familiar in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Handling-Branch-Predictor-and-Instruction-Cache-Misses-in-non/m-p/1081375#M7096</link>
    <description>&lt;P style="font-size: 13.008px; line-height: 19.512px;"&gt;Is there anyone here familiar with explicit caching using the IA-32 or Intel 64 architectures?&lt;/P&gt;

&lt;P style="font-size: 13.008px; line-height: 19.512px;"&gt;I was reading more of Volume 3 of the "Intel 64 and IA-32 Architectures Software Developer's Manual" and I found a section that states that the PREFETCHh instruction should never be used to fetch code however my above program gets about a 15% performance increase when using gcc's __builtin_prefetch (which compiles to PREFETCHh with some added checks).&lt;/P&gt;

&lt;P style="font-size: 13.008px; line-height: 19.512px;"&gt;What's the reason for this limitation since the instruction appears to do something close to what I want? &amp;nbsp;Does it sidestep the TLB and force a retranslation of the virtual address space or is it something more time consuming?&lt;/P&gt;</description>
    <pubDate>Wed, 13 Apr 2016 21:08:47 GMT</pubDate>
    <dc:creator>Bryan_K_1</dc:creator>
    <dc:date>2016-04-13T21:08:47Z</dc:date>
    <item>
      <title>Handling Branch Predictor and Instruction Cache Misses in non-deterministic Parallel Programming</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Handling-Branch-Predictor-and-Instruction-Cache-Misses-in-non/m-p/1081374#M7095</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;

&lt;P&gt;I've been working on a library that implements mostly transparent automatic parallelization however when I benchmark it, I only see about 50% CPU utilization on all cores. &amp;nbsp;Benchmarking system resources shows that the main memory is active at ~600MB/s. &amp;nbsp;I was able to increase CPU usage to about 70% (and also greatly increase performance) by using the gcc __builtin_prefetch() but main memory still shows ~600MB/s.&lt;/P&gt;

&lt;P&gt;As with all parallel code, I used gprof to generate a call graph with time percentages and the majority of the overhead is from pointer indirection in a single spot (https://github.com/bk5115545/The-Event-Engine/blob/EngineLogging/include/event_system/Subscriber.h#L74). &amp;nbsp;I have verified that the target function optimizes to a nop when using -O3 so I have included the below code to attempt to prefetch the instructions into the instruction cache but I can't find any assembly directives which allow me to hint which memory should be loaded into the instruction cache when disparate&amp;nbsp;code paths are about to be executed.&lt;/P&gt;

&lt;P&gt;Windows performance counters also show about a 60% L2 hit rate and based on what I've been reading this is very low.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://github.com/bk5115545/The-Event-Engine/blob/EngineLogging/source/event_system/Dispatcher.cpp#L215-L236" target="_blank"&gt;https://github.com/bk5115545/The-Event-Engine/blob/EngineLogging/source/event_system/Dispatcher.cpp#L215-L236&lt;/A&gt;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;for (unsigned int i = 0; i &amp;lt; thread_cache.size(); i++) {
     try {
           // std::cerr &amp;lt;&amp;lt; "Thread try_call try." &amp;lt;&amp;lt; std::endl;
           std::pair&amp;lt;Subscriber*, std::shared_ptr&amp;lt;void&amp;gt;&amp;gt;&amp;amp; work = thread_cache.at(i);

           // put first cache-line (between 32 and 64 bytes) of next function into L2-d cache (which is HOPEFULLY
           // faster than referencing main memory)
           // but it would be a lot nicer if x86 had instructions to prefetch into the instruction cache
           // for rare but time-sensitive code paths
           if (i + 1 &amp;lt; thread_cache.size() - 1)
               __builtin_prefetch((thread_cache.at(i + 1).first-&amp;gt;target_for_prefetch()), 0, 1);

           work.first-&amp;gt;call(work.second);
           // std::cerr &amp;lt;&amp;lt; "Thread try_call success." &amp;lt;&amp;lt; std::endl;
       } catch (std::string e) {
           std::cerr &amp;lt;&amp;lt; "Exception thrown by function called by Dispatcher Threads." &amp;lt;&amp;lt; std::endl;
           std::cerr &amp;lt;&amp;lt; e &amp;lt;&amp;lt; std::endl;
       }
}&lt;/PRE&gt;

&lt;P&gt;I have a few questions. &amp;nbsp;First, is there a way (even vendor specific) to hint to the cache engine that a rarely-called function will be called soon? &amp;nbsp;Second, is there an Intel processor on the market that allows for complete software control of the cache (I know that the cache is shared but I will need this for the next phase of my project)? &amp;nbsp;Third, I'm trying to test the feasibility of a new type of architecture using software emulation; I'm also currently in college; what is this type of work called?&lt;/P&gt;

&lt;P&gt;Thanks for your help&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 23:03:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Handling-Branch-Predictor-and-Instruction-Cache-Misses-in-non/m-p/1081374#M7095</guid>
      <dc:creator>Bryan_K_1</dc:creator>
      <dc:date>2016-04-08T23:03:00Z</dc:date>
    </item>
    <item>
      <title>Is there anyone here familiar</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Handling-Branch-Predictor-and-Instruction-Cache-Misses-in-non/m-p/1081375#M7096</link>
      <description>&lt;P style="font-size: 13.008px; line-height: 19.512px;"&gt;Is there anyone here familiar with explicit caching using the IA-32 or Intel 64 architectures?&lt;/P&gt;

&lt;P style="font-size: 13.008px; line-height: 19.512px;"&gt;I was reading more of Volume 3 of the "Intel 64 and IA-32 Architectures Software Developer's Manual" and I found a section that states that the PREFETCHh instruction should never be used to fetch code however my above program gets about a 15% performance increase when using gcc's __builtin_prefetch (which compiles to PREFETCHh with some added checks).&lt;/P&gt;

&lt;P style="font-size: 13.008px; line-height: 19.512px;"&gt;What's the reason for this limitation since the instruction appears to do something close to what I want? &amp;nbsp;Does it sidestep the TLB and force a retranslation of the virtual address space or is it something more time consuming?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2016 21:08:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Handling-Branch-Predictor-and-Instruction-Cache-Misses-in-non/m-p/1081375#M7096</guid>
      <dc:creator>Bryan_K_1</dc:creator>
      <dc:date>2016-04-13T21:08:47Z</dc:date>
    </item>
  </channel>
</rss>

