<?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 Do the compiler have such an in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023344#M39123</link>
    <description>&lt;P&gt;Do the compiler have such an option?&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I am using compiler v13.1.1, but it does not have an option &lt;STRONG&gt;-offload&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Using icpc -help | grep "offload", I can get the following output:&amp;nbsp;&lt;/P&gt;

&lt;P&gt;-offload-attribute-target=&amp;lt;name&amp;gt;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; file with the offload attribute target(mic)&lt;BR /&gt;
	-offload-option,&amp;lt;target&amp;gt;,&amp;lt;tool&amp;gt;,"option list"&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; appends additional options for offload compilations given the&lt;BR /&gt;
	-no-offload&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; disable any offload usage&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Aug 2014 13:10:14 GMT</pubDate>
    <dc:creator>Jianbin_F_</dc:creator>
    <dc:date>2014-08-15T13:10:14Z</dc:date>
    <item>
      <title>compile assembly code for Xeon Phi</title>
      <link>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023333#M39112</link>
      <description>&lt;P&gt;Hi Guys,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I am using Xeon Phi in offload mode. Basically, I have written a code with offload pragmas (main.cpp, micSolver.cpp). First, I generate the assembly code with icc -S micSolver.cpp, and it emits two files: (1) micSolver.s, and (2) micSolverMIC.s. As expected, the micSolverMIC.s includes the code to be run on Phi.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;My question is, how can I compile the assembly code further into binary code? There is no problem when using 'icc -c micSolver.s', while 'icc -c micSolverMIC.s' gives the following errors. Do you guys have any idea on how to compile the assembly code?&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:;"&gt;micSolverMIC.s: Assembler messages:
micSolverMIC.s:129: Error: no such instruction: `kmov %eax,%k1'
micSolverMIC.s:132: Error: no such instruction: `vpackstorelps %zmm0,(%rdx){%k1}'
micSolverMIC.s:1347: Error: no such instruction: `vpxord %zmm1,%zmm1,%zmm1'
micSolverMIC.s:1353: Error: no such instruction: `kmov %r13d,%k1'
micSolverMIC.s:1361: Error: no such instruction: `vprefetch0 (%rdx)'
micSolverMIC.s:1363: Error: no such instruction: `vprefetch0 4(%rdx)'
micSolverMIC.s:1365: Error: no such instruction: `vprefetch0 (%rcx)'
micSolverMIC.s:1367: Error: no such instruction: `vprefetch0 4(%rcx)'
micSolverMIC.s:1369: Error: no such instruction: `vprefetch0 (%r8)'
micSolverMIC.s:1371: Error: no such instruction: `vprefetch0 4(%r8)'
micSolverMIC.s:1378: Error: bad register name `%zmm5'
micSolverMIC.s:1380: Error: bad register name `%zmm4'
micSolverMIC.s:1381: Error: bad register name `%zmm3'
micSolverMIC.s:1382: Error: bad register name `%zmm2'
micSolverMIC.s:1383: Error: no such instruction: `vpxord %zmm6,%zmm6,%zmm6'
micSolverMIC.s:1387: Error: no such instruction: `vprefetch0 (%r9)'
micSolverMIC.s:1389: Error: no such instruction: `vprefetch0 64(%r9)'
micSolverMIC.s:1391: Error: no such instruction: `vprefetch0 (%r10)'
micSolverMIC.s:1393: Error: no such instruction: `vprefetch0 64(%r10)'
micSolverMIC.s:1395: Error: no such instruction: `vprefetch0 (%r11)'
micSolverMIC.s:1397: Error: no such instruction: `vprefetch0 64(%r11)'
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2014 08:35:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023333#M39112</guid>
      <dc:creator>Jianbin_F_</dc:creator>
      <dc:date>2014-08-14T08:35:42Z</dc:date>
    </item>
    <item>
      <title>You can compile the Xeon Phi™</title>
      <link>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023334#M39113</link>
      <description>&lt;P&gt;You can compile the Xeon Phi™ assembly file using: &lt;STRONG&gt;icc -mmic -c micSolverMIC.s&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;But I'm not sure where you are headed by doing this.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2014 09:46:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023334#M39113</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2014-08-14T09:46:41Z</dc:date>
    </item>
    <item>
      <title>Quote:Kevin Davis (Intel)</title>
      <link>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023335#M39114</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Kevin Davis (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;You can compile the Xeon Phi™ assembly file using: &lt;STRONG&gt;icc -mmic -c micSolverMIC.s&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;But I'm not sure where you are headed by doing this.&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Kevin, I want to optimize the assembly code directly. For example, I plan to change the instruction order so that we can better hide the latency.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;The question is, for sure, &lt;STRONG&gt;I can use icc -mmic -c micSolverMIC.s&lt;/STRONG&gt;. However, the obtained &lt;STRONG&gt;micSolverMIC.o&lt;/STRONG&gt; cannot be linked with the &lt;STRONG&gt;main.o&lt;/STRONG&gt;, because they are in different format. For example, using icc -o a.out main.o micSolverMIC.o micSolver.o, it will report the following message. Do you know how to solve this issue?&amp;nbsp;&lt;/P&gt;

&lt;P&gt;ipo: warning #11010: *MIC* file format not recognized for /lib64/libc.so.6&lt;BR /&gt;
	ipo: warning #11010: *MIC* file format not recognized for /lib64/libc.so.6&lt;BR /&gt;
	ipo: warning #11010: file format not recognized for micSolerMIC.o&lt;BR /&gt;
	ld: micSolerMIC.o: Relocations in generic ELF (EM: 181)&lt;BR /&gt;
	ld: micSolerMIC.o: Relocations in generic ELF (EM: 181)&lt;BR /&gt;
	ld: micSolerMIC.o: Relocations in generic ELF (EM: 181)&lt;BR /&gt;
	ld: micSolerMIC.o: Relocations in generic ELF (EM: 181)&lt;BR /&gt;
	ld: micSolerMIC.o: Relocations in generic ELF (EM: 181)&lt;BR /&gt;
	ld: micSolerMIC.o: Relocations in generic ELF (EM: 181)&lt;BR /&gt;
	ld: micSolerMIC.o: Relocations in generic ELF (EM: 181)&lt;BR /&gt;
	micSolerMIC.o: could not read symbols: File in wrong format&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2014 11:27:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023335#M39114</guid>
      <dc:creator>Jianbin_F_</dc:creator>
      <dc:date>2014-08-14T11:27:55Z</dc:date>
    </item>
    <item>
      <title>Quote:Jianbin F. wrote:</title>
      <link>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023336#M39115</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Jianbin F. wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Kevin, I want to optimize the assembly code directly. For example, I plan to change the instruction order so that we can better hide the latency.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Don't get me wrong, but I don't think that one can write better assembly code than the compiler does. I would recommend using Intrinsics. There you can also influence the order of instructions and in addition to that the compiler is still able to optimize the code in way a normal brain could never do it.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2014 14:08:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023336#M39115</guid>
      <dc:creator>Patrick_S_</dc:creator>
      <dc:date>2014-08-14T14:08:08Z</dc:date>
    </item>
    <item>
      <title>Quote:Patrick S. wrote:</title>
      <link>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023337#M39116</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Patrick S. wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Quote:&lt;/STRONG&gt;&lt;/P&gt;

&lt;BLOCKQUOTE&gt;&lt;EM&gt;Jianbin F.&lt;/EM&gt; wrote:

	&lt;P&gt;Kevin, I want to optimize the assembly code directly. For example, I plan to change the instruction order so that we can better hide the latency.&amp;nbsp;&lt;/P&gt;

	&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Don't get me wrong, but I don't think that one can write better assembly code than the compiler does. I would recommend using Intrinsics. There you can also influence the order of instructions and in addition to that the compiler is still able to optimize the code in way a normal brain could never do it.&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Thanks for your comments. However, I indeed believe that programmers can do a better job than the compiler. For instance, programmers can put the (loop-)index-related instructions in a better place to hide the instruction latency.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;For sure, I can influence the order of instructions by using intrinsics. But how can you influence the place of the index-related instructions?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2014 14:18:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023337#M39116</guid>
      <dc:creator>Jianbin_F_</dc:creator>
      <dc:date>2014-08-14T14:18:45Z</dc:date>
    </item>
    <item>
      <title>If you are testing code</title>
      <link>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023338#M39117</link>
      <description>&lt;P&gt;If you are testing code scheduling for the Xeon Phi, I would recommend working in native mode rather than offload mode.&amp;nbsp; The assembler works fine for generating mic-native binaries (as long as you use "-mmic" for each step) -- I use the same approach of modifying the compiler's assembler output for the Xeon Phi for several of my projects.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2014 15:42:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023338#M39117</guid>
      <dc:creator>McCalpinJohn</dc:creator>
      <dc:date>2014-08-14T15:42:42Z</dc:date>
    </item>
    <item>
      <title>icc -c micSolver.s  generates</title>
      <link>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023339#M39118</link>
      <description>&lt;P&gt;icc -c micSolver.s&amp;nbsp; generates object file for micSolverMIC.s is it is present in the same directory as micSolver.s&lt;/P&gt;
&lt;P&gt;No need to invoke icc -c micSolver.s,&amp;nbsp;&amp;nbsp; which actually invokes the host assembler and hence you see unrecognized instructions.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2014 15:59:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023339#M39118</guid>
      <dc:creator>Ravi_N_Intel</dc:creator>
      <dc:date>2014-08-14T15:59:02Z</dc:date>
    </item>
    <item>
      <title>I will have to consider</title>
      <link>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023340#M39119</link>
      <description>&lt;P&gt;I will have to consider further what you are interested in doing and the possible dangers and whether this is even possible given our efforts to hide the manipulation of the Xeon Phi™ specific objects/executable associated with the offload language extensions.&lt;/P&gt;

&lt;P&gt;The offload model produces “fat” binaries (objects and executables) where the host and coprocessor object binary files are contained in a single .o file. Our compiler driver and other compiler associated tools are augmented to handle these. Producing a separate MIC.o as you described breaks the compiler driver handling and you would also be required to produce the host-side .o probably by compilation of the assembly only also otherwise a “fat” object may be produced that conflicts with your hand-made MIC.o. I have not tried this and I’m not sure this is doable using the offload model.&lt;/P&gt;

&lt;P&gt;You may need to compile the code you want to hand tune only with &lt;STRONG&gt;-mmic&lt;/STRONG&gt; and create a static or shared library containing the routine with the hand tuned assembly and call into that library from an offload pragma if you really require the offload model. (Or as John suggests, work exclusively in native mode).&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2014 15:59:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023340#M39119</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2014-08-14T15:59:18Z</dc:date>
    </item>
    <item>
      <title>My apologies. As Ravi</title>
      <link>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023341#M39120</link>
      <description>&lt;P&gt;My apologies. As Ravi indicates, this is much easier than I had known/understood existed when working with assembly source files. Even when starting with the assembly file, our integration for the offload compilation is such that the user need only interact with our compiler in terms of the host-side. The compiler and other tools also invisibly handle the coprocessor side when using assembly files.&lt;/P&gt;

&lt;P&gt;I confirmed that you can compile to assembly using &lt;STRONG&gt;-S&lt;/STRONG&gt;. Hand tune the &amp;lt;file&amp;gt;MIC.s file, and then compile both the host and coprocessor .s files simply by referring to the host-side assembly file only, just as Ravi indicated.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Aug 2014 09:18:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023341#M39120</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2014-08-15T09:18:21Z</dc:date>
    </item>
    <item>
      <title>Thanks, Kevin. Then it will</title>
      <link>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023342#M39121</link>
      <description>&lt;P&gt;Thanks, Kevin. Then it will report the following message. Did I miss any library?&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;micSolver.cpp:(.text+0xa73): undefined reference to `__offload_target_acquire'&lt;BR /&gt;
	micSolver.cpp:(.text+0xa98): undefined reference to `__offload_offload'&lt;BR /&gt;
	micSolver.cpp:(.text+0xacf): undefined reference to `__offload_target_acquire'&lt;BR /&gt;
	micSolver.cpp:(.text+0xf7c): undefined reference to `__offload_offload'&lt;BR /&gt;
	micSolver.cpp:(.text+0xfb3): undefined reference to `__offload_target_acquire'&lt;BR /&gt;
	micSolver.cpp:(.text+0x1500): undefined reference to `__offload_offload'&lt;/P&gt;</description>
      <pubDate>Fri, 15 Aug 2014 09:38:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023342#M39121</guid>
      <dc:creator>Jianbin_F_</dc:creator>
      <dc:date>2014-08-15T09:38:38Z</dc:date>
    </item>
    <item>
      <title>Yes, the offload library and</title>
      <link>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023343#M39122</link>
      <description>&lt;P&gt;Yes, the offload library and likely because your main does not contain any offload language extensions so it was not included. On your link, use the icpc compiler driver and just include the option: &lt;STRONG&gt;-offload&lt;/STRONG&gt;&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Aug 2014 09:43:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023343#M39122</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2014-08-15T09:43:44Z</dc:date>
    </item>
    <item>
      <title>Do the compiler have such an</title>
      <link>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023344#M39123</link>
      <description>&lt;P&gt;Do the compiler have such an option?&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I am using compiler v13.1.1, but it does not have an option &lt;STRONG&gt;-offload&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Using icpc -help | grep "offload", I can get the following output:&amp;nbsp;&lt;/P&gt;

&lt;P&gt;-offload-attribute-target=&amp;lt;name&amp;gt;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; file with the offload attribute target(mic)&lt;BR /&gt;
	-offload-option,&amp;lt;target&amp;gt;,&amp;lt;tool&amp;gt;,"option list"&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; appends additional options for offload compilations given the&lt;BR /&gt;
	-no-offload&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; disable any offload usage&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Aug 2014 13:10:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023344#M39123</guid>
      <dc:creator>Jianbin_F_</dc:creator>
      <dc:date>2014-08-15T13:10:14Z</dc:date>
    </item>
    <item>
      <title>Yes but not for that old one</title>
      <link>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023345#M39124</link>
      <description>&lt;P&gt;Yes but not for that old one :-)&amp;nbsp;&amp;nbsp; Support was added in the CXE 2013 SP1 (14.0). For the 13.x vintage, just add something in the main() like:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;__attribute__((target(mic))) int foo;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Aug 2014 16:24:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/compile-assembly-code-for-Xeon-Phi/m-p/1023345#M39124</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2014-08-15T16:24:34Z</dc:date>
    </item>
  </channel>
</rss>

