<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 7, 2017 at 11:06 PM, Chris Lovett via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm running into some pretty bad performance in llc.exe when compiling some large neural networks into code that contains some very large llvm::<wbr>ConstantDataArrays, some are { size=102,760,448 }. There's a small about of actual code for processing the network, but the assembly is mostly global data.<div><br></div><div>I'm finding that llc.exe memory spikes up around 30 gigabytes and the job takes 20-30 minutes compiling from bitcode.  When I looked into it I found that every single floating point number is loaded into ConstantFP object where the float is parsed into exponent, mantissa and stored in an integer part is stored in a heap allocated array, then these are emitted into MCDataFragments where again more heap allocated data, the float appears to be stored in <span style="font-size:9.5pt;font-family:Consolas;color:black">SmallVectorImpl<</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">char</span><span style="font-size:9.5pt;font-family:Consolas;color:black">>.  </span>On top of this I see a lot of <span style="color:black;font-family:Consolas;font-size:9.5pt">MCFillFragments </span>added because of long double padding.</div><div><br></div><div>All up the code I'm compiling ends up with 276 million MCFragments, which just take a super long time in each phase of compiling (loading from bitcode, emitting, layout and writing).  With a peak working set of 30 gigabytes each float is taking around 108 bytes!  </div><div><br></div><div>Is there a more efficient way to do this? Or is there any plan in the works to handle global data more efficiently in llc ?</div></div></blockquote><div><br></div><div>Maybe try putting the blob of floating point numbers in a string / i8 array?</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div></div>