<div dir="ltr">HI Eric,<div><br></div><div>Thanks for your feedback. Below is my comments.<br><div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-09 2:25 GMT+08:00 Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5">>> > 4. Implement support of "-mtune". Usage is: "-march=CPU_NAME". For<br>

>> > instance, "-march=cortex-a57". This option will ONLY get micro-architecture<br>
>> > level feature enabled specifying to target CPU, like "zcm" and "zcz" for<br>
>> > cyclone. Any architecture features WON'T be modified.<br>
>><br>
>> That's not what -mtune is. According to GCC's manual: "Tune to<br>
>> cpu-type everything applicable about the generated code, except for<br>
>> the ABI and the set of available instructions."<br>
>><br>
>> The difference between -mcup and -mtune is that the former selects ABI<br>
>> and ISAs supported by the CPU, while the former doesn't. This is<br>
>> particularly important if you want to run the code on a newer CPU but<br>
>> doesn't want to break older ones, so you can't use instructions that<br>
>> the old ones don't have, but you can optimise for the pipeline and<br>
>> branch decisions of the newer CPU, as long as it just slows down the<br>
>> older ones.<br>
><br>
> I didn't explain it clearly. Your point is totally what I did in this patch.<br>
> I emphasize " ONLY get micro-architecture level feature enabled" is want to<br>
> say ISA won't be changed by this option. This option is to select target CPU<br>
> to optimize for, including enabling micro-architecture level feature,<br>
> choosing MI scheduler and triggering any optimizations specific for target.<br>
>><br>
>><br>
>><br>
>> > 5. Change usage of "-mcpu" to "-mcpu=CPU_NAME+[no]feature", which is an<br>
>> > alias to "-march={feature of CPU_NAME}+[no]feature" and "-mtune=CPU_NAME"<br>
>> > together. An warning is added to discourage use of this option.<br>
>><br>
>> I find this one redundant with -march and don't think we should add<br>
>> deprecated features. -mcpu is the flag you want for the behaviour<br>
>> you've done -mtune above. AFAIK, we don't have the infrastructure to<br>
>> implement -mtune yet. Also, the driver is a bit bonkers when going<br>
>> from CPU to Arch from a different arch than the host without using<br>
>> -target (which is the point with -march, I guess).<br>
>><br>
>> I don't think -mcpu should be used on its own, only in conjunction<br>
>> with -target or -march.<br>
><br>
> In my patch, the difference between "-mcpu" and "-mtune" is that, "-mcpu"<br>
> will enable all ISAs which target CPU supports, while "-mtune" won't do<br>
> this. And "-mcpu" can accept extra feature modifiers to make a change, but<br>
> "-mtune" accepts CPU name only. So "-mcpu" is an shortcut of "-march" and<br>
> "-tune". Keeping this option alive in clang is because it's still alive in<br>
> gcc, and may still be used in many projects.  An warning is added to<br>
> discourage use of this option.<br>
<br>
</div></div>This is fine, and I encourage the warning. Also, -march should<br>
probably default to -mtune of the same architecture. I didn't read to<br>
verify, but just making sure this is the case.<br></blockquote><div>Currently, there's only one architecture available,  so -march will always default to "armv8-a+neon". We can do further when there's more and more architectures on AArch64 target.</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><br>
>><br>
>><br>
>><br>
>><br>
>> > 1. Neon is enabled by default, and "generic" will be used if no CPU type<br>
>> > is specified.<br>
>><br>
>> Makes sense to me.<br>
>><br>
>><br>
>> > 2. For most scenario, Using "-mtune=CPU" only is recommended as neon is<br>
>> > enabled by default and all micro-architecture optimizations are selected,<br>
>> > and it would provide great compatibility to run on most of AArch64 devices.<br>
>><br>
>> That'd be -mcpu, and we still need -march or -target.<br>
><br>
> "-target" is still necessary at moment while "-march" can be omitted<br>
> sometimes, because the settings of default feature can work well for most<br>
> scenarios and provide good code migration. All I want to do is to get<br>
> "-mcpu" supporter happy to use "-mtune" instead. They don't need to complain<br>
> typing too much as splitting "-mcpu" into "-march" and "-mtune" because they<br>
> can use "-mtune" only. For a standard sets of compiling flags, pair use of<br>
> "-march" and "-mtune" is strongly recommended.<br>
<br>
</div>This seems to be a good idea. Can you give examples of behavior you're<br>
expecting to see just to verify?<br></blockquote><div><br></div><div>Single use of "-target aarch64-linux-gnu" equals "-target aarch64-linux-gnu -march=armv8-a+neon mtune=generic", which can provide correct codes but not fully optimized.</div>
<div><br></div><div>"-target aarch64-linux-gnu -mtune=cortex-a57" euqals "-target aarch64-linux-gnu -march=armv8-a+neon mtune=cortex-a57" ,which can work quite well in most scenarios. NEON is enabled for vectorization and MI scheduler is selected to optimize codes for cortex-a57. And it provides good compatibility which allows binary running on most AArch64 devices as it doesn't rely on any crc or crypto support. New starters of AArch64 can easily start their project from these flags, and it is good enough for experiment purpose for experienced developer.</div>
<div><br></div><div>If user wants to control more features, such as enable crc and crypto, or disable neon or fp, then they need to use "-target=aarch64-linux-gnu -march=armv8-a+[no]feature -mtune=cortex-a57". It's standard sets of flags I recommend to use, which <span style="color:rgb(50,50,50);font-family:Arial,宋体,微软雅黑;font-size:14px;line-height:16px;white-space:nowrap">explicitly select the </span>architecture feature though command line.  Even if a project only require NEON, it's recommend to add "-march=armv8-a+neon" in command line. Because the default behavior of -march is unreliable, which may get change in future.</div>
<div><br></div><div><span style="color:rgb(51,51,51);font-family:Arial,宋体,微软雅黑;font-size:14px;line-height:21px">To </span><font color="#333333" face="Arial, 宋体, 微软雅黑"><span style="line-height:21px">summarize</span></font>, missing of "-march" can work well at moment, but should only be used for short term experiment. Pair using "-march" and "-mtune" is recommended.</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><br>
>><br>
>><br>
>><br>
>> > 3. "-march" is designed to be used only if user wants to use crc and<br>
>> > crypto instructions, or disable fp/neon. So "-march" will not be frequently<br>
>> > used and won't bring too much finger burden.<br>
>><br>
>> I thought the idea was to encourage -march... at least on new targets...<br>
><br>
> Yes, we always encourage people to specifying architecture features via<br>
> "-march". Letting "-march" and "-mtune" replace "-mcpu" and "-mfpu" is what<br>
> we want to do.<br>
<br>
</div>Very much so.<br>
<br>
Thanks!<br>
<span class=""><font color="#888888"><br>
-eric<br>
</font></span><div class="im"><br>
>><br>
>><br>
>> --renato<br>
><br>
><br>
><br>
><br>
> --<br>
> Best Regards,<br>
><br>
> Kevin Qin<br>
><br>
</div><div class=""><div class="h5">> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Best Regards,<div><br></div><div>Kevin Qin</div></div>
</div></div></div>