<?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 Best tools for analyzing and profiling Intel Processor Graphics OpenCL kernels? in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/Best-tools-for-analyzing-and-profiling-Intel-Processor-Graphics/m-p/1069234#M4375</link>
    <description>&lt;P&gt;I want to deeply profile and analyze my Intel Graphics OpenCL kernels and am not entirely clear on which tools are available and their advantages.&lt;/P&gt;

&lt;P&gt;I assume VTune is the very best? &amp;nbsp;What specifically does it offer for OpenCL developers that's useful?&lt;/P&gt;

&lt;P&gt;What about GPA? &amp;nbsp;Last I checked it didn't provide much detail.&lt;/P&gt;

&lt;P&gt;Is GT-Pin something that's documented or is it what's actually powering the kernel analysis in Code Builder and Visual Studio?&lt;/P&gt;

&lt;P&gt;I'd like to understand:&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;achieved EU occupancy&amp;nbsp;&lt;/LI&gt;
	&lt;LI&gt;where any local memory bank conflicts might be occurring&amp;nbsp;&lt;/LI&gt;
	&lt;LI&gt;instruction hot spots&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;I may be missing some features that already exist in the Visual Studio (2013) CodeBuilder because the Kernel Analysis screen crashes when analyzing my application which uses pre-compiled binary kernels (with "-cl-kernel-arg-info" enabled).&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Also, I'd like to be able to dump the GEN assembly from an existing .IR binary. &amp;nbsp;Is there a way to do this?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jul 2016 22:51:24 GMT</pubDate>
    <dc:creator>allanmac1</dc:creator>
    <dc:date>2016-07-21T22:51:24Z</dc:date>
    <item>
      <title>Best tools for analyzing and profiling Intel Processor Graphics OpenCL kernels?</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Best-tools-for-analyzing-and-profiling-Intel-Processor-Graphics/m-p/1069234#M4375</link>
      <description>&lt;P&gt;I want to deeply profile and analyze my Intel Graphics OpenCL kernels and am not entirely clear on which tools are available and their advantages.&lt;/P&gt;

&lt;P&gt;I assume VTune is the very best? &amp;nbsp;What specifically does it offer for OpenCL developers that's useful?&lt;/P&gt;

&lt;P&gt;What about GPA? &amp;nbsp;Last I checked it didn't provide much detail.&lt;/P&gt;

&lt;P&gt;Is GT-Pin something that's documented or is it what's actually powering the kernel analysis in Code Builder and Visual Studio?&lt;/P&gt;

&lt;P&gt;I'd like to understand:&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;achieved EU occupancy&amp;nbsp;&lt;/LI&gt;
	&lt;LI&gt;where any local memory bank conflicts might be occurring&amp;nbsp;&lt;/LI&gt;
	&lt;LI&gt;instruction hot spots&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;I may be missing some features that already exist in the Visual Studio (2013) CodeBuilder because the Kernel Analysis screen crashes when analyzing my application which uses pre-compiled binary kernels (with "-cl-kernel-arg-info" enabled).&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Also, I'd like to be able to dump the GEN assembly from an existing .IR binary. &amp;nbsp;Is there a way to do this?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 22:51:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Best-tools-for-analyzing-and-profiling-Intel-Processor-Graphics/m-p/1069234#M4375</guid>
      <dc:creator>allanmac1</dc:creator>
      <dc:date>2016-07-21T22:51:24Z</dc:date>
    </item>
    <item>
      <title>It sounds like you want  Code</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Best-tools-for-analyzing-and-profiling-Intel-Processor-Graphics/m-p/1069235#M4376</link>
      <description>&lt;P&gt;It sounds like you want&amp;nbsp; Code Builder&amp;nbsp;and possibly VTune.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Code builder has a lot of specialized views to help you understand OpenCL application/kernel performance.&amp;nbsp; In case you haven't seen them the videos on the OpenCL page (&lt;A href="https://software.intel.com/en-us/intel-opencl"&gt;https://software.intel.com/en-us/intel-opencl)&lt;/A&gt;&amp;nbsp;have a&amp;nbsp;lot of great details on what is included&amp;nbsp;and how to use the tools.&lt;/P&gt;

&lt;P&gt;VTune does great hotspot analysis, and&amp;nbsp;it also is a great system efficiency visualizer with a lot of details on exactly what is happening in the EUs as well as video codec fixed function.&lt;/P&gt;

&lt;P&gt;For more info: &lt;A href="https://software.intel.com/sites/default/files/managed/e7/2f/VTune_for_media_apps_June2016-Final.pdf"&gt;&lt;U&gt;&lt;FONT color="#0066cc"&gt;VTune for Media Apps&lt;/FONT&gt;&lt;/U&gt;&lt;/A&gt;, &lt;A href="https://software.intel.com/en-us/articles/intel-vtune-amplifier-xe-getting-started-with-opencl-performance-analysis-on-intel-hd-graphics"&gt;https://software.intel.com/en-us/articles/intel-vtune-amplifier-xe-getting-started-with-opencl-performance-analysis-on-intel-hd-graphics&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;GPA is custom made for game developers, with lots of 3d graphics details in its frame analyzer.&amp;nbsp; You can see info useful for OpenCL performance analysis in the system analyzer but you're right the focus there is realtime feedback and you'll get much more detailed optimization info in VTune.&lt;/P&gt;

&lt;P&gt;GT-Pin can provide a lot of details too, but you're probably best starting with the other tools.&amp;nbsp; In many cases they are getting the same info but in a more immediately accessible, consolidated, more extensively documented way.&lt;/P&gt;

&lt;P&gt;I suspect that&amp;nbsp;there is a way to get Gen assembly from .ir via the ioc64 tool -- I'll research and get back to you.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2016 07:26:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Best-tools-for-analyzing-and-profiling-Intel-Processor-Graphics/m-p/1069235#M4376</guid>
      <dc:creator>Jeffrey_M_Intel1</dc:creator>
      <dc:date>2016-07-22T07:26:03Z</dc:date>
    </item>
    <item>
      <title>Thanks, those links gave me a</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Best-tools-for-analyzing-and-profiling-Intel-Processor-Graphics/m-p/1069236#M4377</link>
      <description>&lt;P&gt;Thanks, those links gave me a better understanding of VTune's features! &amp;nbsp;I guess I'll try the free trial.&lt;/P&gt;

&lt;P&gt;Using the "-asm=&amp;lt;file_path&amp;gt;", I can get iocXX to spit out an assembly file from an OpenCL compilation but it looks like when there is a multi-kernel OpenCL file, only one of the kernels is written to the assembly file.&lt;/P&gt;

&lt;P&gt;I'm going to guess the iocXX compiler overwrites the assembly output each time it finishes building a kernel. &amp;nbsp;It would be nice if all the kernels appeared in the file and there was a leading textual header of some sort (kernel name, properties and some other meta info) before each assembly dump.&lt;/P&gt;

&lt;P&gt;So there is probably a bug in the iocXX "-asm" feature or else the workaround is to simply generate assembly for one kernel at a time.&lt;/P&gt;

&lt;P&gt;RFE: I would like to see is a command line profiler that lets me launch my app and by default reports the min/max/avg kernel runtimes and CL API timings. &amp;nbsp;Additional switches would have the profiler focus on a single kernel by name and report back whatever counters are available in the GEN architecture. &amp;nbsp;This is basically what CUDA's nvprof tool provides and for some GPU devs this is far more useful than a the full blown visual tool that doesn't involve HTML or a GUI. &amp;nbsp;It sort of sounds like GT-Pin already has these capabilities and maybe a more user-friendly wrapper could expose them.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2016 18:06:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Best-tools-for-analyzing-and-profiling-Intel-Processor-Graphics/m-p/1069236#M4377</guid>
      <dc:creator>allanmac1</dc:creator>
      <dc:date>2016-07-22T18:06:00Z</dc:date>
    </item>
    <item>
      <title> </title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Best-tools-for-analyzing-and-profiling-Intel-Processor-Graphics/m-p/1069237#M4378</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;The Code Builder tool provides&amp;nbsp;EU occupancy and&amp;nbsp;instruction latency (for read instructions) reports. Currently there is no report for&amp;nbsp;local memory bank conflicts as part of the code builder.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;There are two ways to get these reports:&lt;/P&gt;

&lt;P style="margin-left:36pt;"&gt;1.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;U&gt;OpenCL Application Analysis&lt;/U&gt; - start from an existing application and get report for any kernel executed by the application. For this option to get the latency report your application&amp;nbsp;&lt;STRONG&gt;must&amp;nbsp;build the kernels from source&lt;/STRONG&gt;&amp;nbsp;(with clCreateProgramWithSource).&amp;nbsp;Please read more here:&amp;nbsp;&lt;A href="https://software.intel.com/en-us/node/539437"&gt;https://software.intel.com/en-us/node/539437&lt;/A&gt;&lt;/P&gt;

&lt;P style="margin-left:36pt;"&gt;2&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;. Run analysis from&amp;nbsp;&lt;/SPAN&gt;&lt;U style="font-size: 1em; line-height: 1.5;"&gt;OpenCL Kernel Development Framework&lt;/U&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;&amp;nbsp;- using the KDF you can start from a cl file, assign variables for the kernel, build, run and analyze the kernel without the need to write the host code. Of course you need to specify the kernel code to be analyzed. This is the recommended way to analyze the kernel if you want to try different implementations, different variables, or different locals and globals.&amp;nbsp;Please read more here:&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://software.intel.com/en-us/node/539301" style="font-size: 1em; line-height: 1.5;"&gt;https://software.intel.com/en-us/node/539301&lt;/A&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;As for the Gen assembly – Currently the generation of GEN assembly from IR is not exposed externally. We will consider to add this capability for the next release&lt;/P&gt;

&lt;P&gt;If you have the source code you can use the Intel Graphics Disassembly Source Mapping as part of the Code Builder to see the mapping between the cl code and the GEN assembly. Please read more here: &amp;nbsp;&amp;nbsp;&lt;A href="https://software.intel.com/en-us/node/600446"&gt;https://software.intel.com/en-us/node/600446&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;the code builder also has a command line interface - with the CLI you can launch your applicaiton and get&amp;nbsp;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;min/max/avg kernel runtimes and CL API timings as well as HW counters for each kernel. Then you can specify a specific kernel and perform a deep analysis for this kernel to get occupancy and latency reports. Please read more here&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://software.intel.com/en-us/node/558502"&gt;https://software.intel.com/en-us/node/558502&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;&amp;nbsp;Thanks,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;BR /&gt;
	Yuval&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2016 13:21:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Best-tools-for-analyzing-and-profiling-Intel-Processor-Graphics/m-p/1069237#M4378</guid>
      <dc:creator>Yuval_E_Intel</dc:creator>
      <dc:date>2016-07-24T13:21:11Z</dc:date>
    </item>
    <item>
      <title>Ah, OK! </title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Best-tools-for-analyzing-and-profiling-Intel-Processor-Graphics/m-p/1069238#M4379</link>
      <description>&lt;P&gt;Ah, OK!&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I am currently creating a binary from the IR and converting it to a C array with bin2c.&lt;/P&gt;

&lt;P&gt;That explains why I can't use the Deep Analysis features.&lt;/P&gt;

&lt;P&gt;I'll load the kernel from source.&lt;/P&gt;

&lt;P&gt;Thanks for your and Jeffrey's detailed responses.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jul 2016 22:19:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Best-tools-for-analyzing-and-profiling-Intel-Processor-Graphics/m-p/1069238#M4379</guid>
      <dc:creator>allanmac1</dc:creator>
      <dc:date>2016-07-25T22:19:09Z</dc:date>
    </item>
    <item>
      <title>One more question...</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Best-tools-for-analyzing-and-profiling-Intel-Processor-Graphics/m-p/1069239#M4380</link>
      <description>&lt;P&gt;One more question...&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;Using an option string in clBuildProgram(), I can create and build the program with include files and successfully capture the basic Analysis info.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;But the deeper Kernel Analysis panel will consistently fail even if I also declare the analysis working directory path to be the directory containing the include files. &amp;nbsp;It's worth noting one of my include files has a ".inl" suffix.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;I finally got the Analysis panel to work but I had to simplify the program source file&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;so that there were no include files at all.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Is there any way to run iocXX in preprocessor mode and spit out the fully preprocessed file?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2016 00:11:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Best-tools-for-analyzing-and-profiling-Intel-Processor-Graphics/m-p/1069239#M4380</guid>
      <dc:creator>allanmac1</dc:creator>
      <dc:date>2016-07-26T00:11:00Z</dc:date>
    </item>
    <item>
      <title>Quote:Allan M. wrote:Is there</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Best-tools-for-analyzing-and-profiling-Intel-Processor-Graphics/m-p/1069240#M4381</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Allan M. wrote:&lt;BR /&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Is there any way to run iocXX in preprocessor mode and spit out the fully preprocessed file?&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Answering my own question...&lt;/P&gt;

&lt;P&gt;On Windows, this will preprocess your OpenCL file and all its includes:&lt;/P&gt;

&lt;PRE class="brush:plain;"&gt;     cl /I . /I "%INTELOCLSDKROOT%\include" /D __OPENCL_VERSION__ /X /EP foo.cl | grep . - &amp;gt; foo.i&lt;/PRE&gt;

&lt;P&gt;Notes:&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;The /EP option emits to stdout and removes all #line directives which seem to break the Kernel Latency panel.&lt;/LI&gt;
	&lt;LI&gt;The grep removes all empty lines making it easier to inspect in the Kernel Latency panel.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Next, use the "bin2c" utility to convert the source file into a char[] array that can be compiled directly into your C application so you don't have to fiddle with opening/loading/closing files:&lt;/P&gt;

&lt;PRE class="brush:;"&gt;     bin2c -c -p 0 -n foo_source foo.i &amp;gt; foo.source&lt;/PRE&gt;

&lt;P&gt;The char[] array can be loaded like this:&lt;/P&gt;

&lt;P&gt;_____________________________________________________________&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;  cl_int err;

  size_t const   strings_sizeof[] = { strlen(foo_source) };
  char   const * strings[]        = { (char*)foo_source  };

  cl_program program = clCreateProgramWithSource(context,
                                                 1,
                                                 strings,
                                                 strings_sizeof,
                                                 &amp;amp;err);
  cl_ok(err);

  char const * const options = " &amp;lt; your CL options here &amp;gt; ";

  cl(BuildProgram(program,
                  1,
                  &amp;amp;device_id,
                  options,
                  NULL,
                  NULL));
&lt;/PRE&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;_____________________________________________________________&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;I have the preprocessing and "bin2c" steps in a makefile and the snippet directly above is neat and compact.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2016 16:51:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Best-tools-for-analyzing-and-profiling-Intel-Processor-Graphics/m-p/1069240#M4381</guid>
      <dc:creator>allanmac1</dc:creator>
      <dc:date>2016-07-26T16:51:00Z</dc:date>
    </item>
    <item>
      <title>Now that I'm building kernels</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/Best-tools-for-analyzing-and-profiling-Intel-Processor-Graphics/m-p/1069241#M4382</link>
      <description>&lt;P&gt;Now that I'm building kernels from source, I can report that everything works well on a Core i7-5775C + HD6200 using VS2013:&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;Session Analysis&lt;/LI&gt;
	&lt;LI&gt;Kernels Overview&lt;/LI&gt;
	&lt;LI&gt;Kernel Latency&lt;/LI&gt;
	&lt;LI&gt;Kernel Analysis&lt;/LI&gt;
	&lt;LI&gt;GEN-to-source mapping in the Session Explorer&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Thanks for your help.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2016 19:31:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/Best-tools-for-analyzing-and-profiling-Intel-Processor-Graphics/m-p/1069241#M4382</guid>
      <dc:creator>allanmac1</dc:creator>
      <dc:date>2016-07-26T19:31:17Z</dc:date>
    </item>
  </channel>
</rss>

