<html><body><p><font size="2">The usage of `AssumptionCache` in PPC hardware loop was introduced in </font><font size="2">0724fea2da637883f1461e12ff46d596a816f758</font><br><br><font size="2">For PPC hardware loop pass, we want to make sure we will not convert some small loops into hardware loop. Small loop is identified by instruction number of the loop. So we used `CodeMetrics` class to calculate the instruction number.</font><br><br><font size="2">And in the `CodeMetrics` class, when it calculates the instruction number, it will exclude the ephemeral values(llvm.assume related instructions) first, that's why we need assumption cache analysis.</font><br><br><font size="2">I think it is ok to have empty `AssumptionCache`in PPC hardware loop pass as it is true that after CGP there is no ephemeral values any more.</font><br><br><font size="2">But maybe it makes more sense to have other APIs for `CodeMetrics` class to calculate instruction number without `AssumptionCache`.</font><br><br><font size="2">Thanks.</font><br><br><font size="2">BRS//</font><br><font size="2">Chen Zheng</font><br><font size="2">Power Compiler Backend Developer</font><br><br><br><img width="16" height="16" src="cid:1__=C7BB0C30DFA9056D8f9e8a93df938690918cC7B@" border="0" alt="Inactive hide details for Sam Parker ---2021/03/25 05:44:25 PM---Indeed, it's just there because the original PPC implementatio"><font size="2" color="#424282">Sam Parker ---2021/03/25 05:44:25 PM---Indeed, it's just there because the original PPC implementation used it. Looking back through the co</font><br><br><font size="2" color="#5F5F5F">From:        </font><font size="2">Sam Parker <Sam.Parker@arm.com></font><br><font size="2" color="#5F5F5F">To:        </font><font size="2">Sjoerd Meijer <Sjoerd.Meijer@arm.com>, Janek Van Oirschot <janekvo@graphcore.ai>, "llvm-dev@lists.llvm.org" <llvm-dev@lists.llvm.org></font><br><font size="2" color="#5F5F5F">Cc:        </font><font size="2">David Green <David.Green@arm.com>, "czhengsz@cn.ibm.com" <czhengsz@cn.ibm.com></font><br><font size="2" color="#5F5F5F">Date:        </font><font size="2">2021/03/25 05:44 PM</font><br><font size="2" color="#5F5F5F">Subject:        </font><font size="2">[EXTERNAL] Re: isHardwareLoopProfitable() called with empty assumption cache in hwloops pass</font><br><hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br><br><br><font size="1" color="#FFFFFF">Indeed, it's just there because the original PPC implementation used it. Looking back through the commits, I didn't move the pass into a different phase so either PPC has either never had a populated assumption cache or never noticed the change ZjQcmQRYFpfptBannerStart</font> <br><b><font face="Arial">This Message Is From an External Sender </font></b><br><font size="2" face="Arial">This message came from outside your organization. </font><br><font size="1" color="#FFFFFF">ZjQcmQRYFpfptBannerEnd</font><br><font face="Arial">Indeed, it's just there because the original PPC implementation used it. Looking back through the commits, I didn't move the pass into a different phase so either PPC has either never had a populated assumption cache or never noticed the change when it was cleared. </font><br><br><font face="Arial">As Sjoerd said, can we re-populate it?</font><br><br><font face="Arial">As long as it runs after LSR, I can't immediately think of anything that would affect the Arm implementation (famous last words!) if we moved the transform a bit earlier in the pipeline.</font><br><br><font face="Arial">Regards,</font><br><font face="Arial">Sam</font><br><br><font face="Helvetica">Sam Parker</font><br><font face="Helvetica">Compilation Tools Engineer | Arm</font><br><font face="Helvetica">. . . . . . . . . . . . . . . . . . . . . . . . . . .</font><br><font face="Helvetica">Arm.com</font><p><hr width="100%" size="2" align="left"><br><b>From:</b> Sjoerd Meijer <Sjoerd.Meijer@arm.com><b><br>Sent:</b> 25 March 2021 09:32<b><br>To:</b> Janek Van Oirschot <janekvo@graphcore.ai>; llvm-dev@lists.llvm.org <llvm-dev@lists.llvm.org><b><br>Cc:</b> Sam Parker <Sam.Parker@arm.com>; David Green <David.Green@arm.com><b><br>Subject:</b> Re: isHardwareLoopProfitable() called with empty assumption cache in hwloops pass <br> <br><font face="Arial">I can't imagine that being the intended behaviour. I don't think we have paid much attention to the assumption cache in the ARM implementation. Some parts of the hardware loop infrastructure were factored out from the initial PPC implementation, which I think explains it is there and used by PPC, but not in the ARM implementation. But perhaps Sam knows more.</font><br><br><font face="Arial">I have never looked into the AssumptionCache, but I assume there's way to retrigger and repopulate it (after CGP)?</font><br><br><font face="Arial">Just out of curiousity, can you perhaps tell more how you would like to persuade/force hardware loops with an assume? There are some options at the moment (but would apply to all loops in the compilation unit), don't think we e.g. looked into a pragma, so it sounds interesting. I guess this is a hint about the iteration count?</font><br><br><font face="Arial">Cheers,<br>Sjoerd.</font><br><hr width="100%" size="2" align="left"><br><b>From:</b> Janek Van Oirschot <janekvo@graphcore.ai><b><br>Sent:</b> 24 March 2021 17:27<b><br>To:</b> llvm-dev@lists.llvm.org <llvm-dev@lists.llvm.org><b><br>Cc:</b> Sam Parker <Sam.Parker@arm.com>; Sjoerd Meijer <Sjoerd.Meijer@arm.com>; David Green <David.Green@arm.com><b><br>Subject:</b> isHardwareLoopProfitable() called with empty assumption cache in hwloops pass <br> <br>Hey all,<br> <br>It seems that when HardwareLoops calls the isHardwareLoopProfitable TTI hook, it never has a populated AssumptionCache. Some debugging revealed that HardwareLoops runs during the PreISel phase for ARM and PPC. However, the CodeGenPrepare pass runs before PreISel and removes all assumes meaning that the AssumptionCache in HardwareLoops will end up empty.<br> <br>From what I gather (and let me know if I'm wrong), only PPC uses the AssumptionCache in isHardwareLoopProfitable but only to aid in some cost analysis. I was wondering whether it's intended behaviour to have an empty AssumptionCache during HardwareLoops? I ask because I was looking into using assumes to persuade HardwareLoops into emitting hardware intrinsics for our (downstream) target.<br> <br>Kind regards,<br>Janek van Oirschot<br> 
<p><br><font size="2"><br>** We have updated our privacy policy, which contains important information about how we collect and process your personal data. To read the policy, please click </font><a href="http://www.graphcore.ai/privacy"><u><font size="2" color="#0000FF">here</font></u></a><font size="2"> **<br><br>This email and its attachments are intended solely for the addressed recipients and may contain confidential or legally privileged information.<br>If you are not the intended recipient you must not copy, distribute or disseminate this email in any way; to do so may be unlawful.<br><br>Any personal data/special category personal data herein are processed in accordance with UK data protection legislation.<br>All associated feasible security measures are in place. Further details are available from the Privacy Notice on the website and/or from the Company.<br><br>Graphcore Limited (registered in England and Wales with registration number 10185006) is registered at 107 Cheapside, London, UK, EC2V 6DN.<br>This message was scanned for viruses upon transmission. However Graphcore accepts no liability for any such transmission.</font><p><p><BR>
</body></html>