<div dir="ltr"><div>Hi Bandhav,</div><div><br></div><div>While I'm unfamiliar with the details of codegen and cost modelling in LLVM, it is possible to declare multiple address spaces for a target, mark pointers as belonging to a specific address space, and cast between them.</div><div>To quote the language reference "For targets that support them, address spaces
may affect how optimizations are performed and/or what target
instructions are used to access the variable.", which sounds quite hopeful for your usecase. If nothing else, you could probably model the loads from different address spaces as being different instructions, even if they are in the end the same instruction in the output machine code, and tag them with different costs.<br></div><div><br></div><div>Hope this helps,</div><div>Henrik<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 26, 2020 at 4:55 AM Bandhav Veluri via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><div class="gmail_default">Hi,</div><div class="gmail_default"><br></div><div class="gmail_default">I’m working on a RISC-V architecture that has instruction costs different from those in the default cost model. Is there an out-of-source way to provide llc with custom cost model? Or, does this need a change in LLVM backend?<br><br>Also, the cost model is not totally static. For example, loads from 0x1000-0x1ffc take 1 cycle, whereas loads from address > 0x80000000, take 10-100 cycles. Is it possible to model these costs in the scheduler? Requiring programmer to define custom pointer types to mark pointers, to one or the other address space, is okay. Is there a way to model different costs for different pointer types?<br></div><div class="gmail_default"><br></div><div class="gmail_default">Thank you,</div><div class="gmail_default">Bandhav</div></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>