<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Feb 26, 2019, at 7:46 PM, Quentin Colombet <<a href="mailto:qcolombet@apple.com" class="">qcolombet@apple.com</a>> wrote:</div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""> The only  use I would have for the copy is as as a means of passing which registers were already created for the new mapping, after which point I would need to delete it.</div></div></blockquote><div class=""><br class=""></div><div class="">Could you describe in pseudo code what the expansion of vgpr into sgpr looks like?</div><div class="">e.g., = use vgpr</div><div class="">And you only support = use sgpr </div><div class=""><br class=""></div></div></div></div></blockquote><br class=""></div><div>It’s serializing the vector operation. There’s an additional optimization to reduce the number of loop iterations when multiple work items/lanes/threads have the same value in them which happens in practice, but essentially it does:</div><div><br class=""></div><div>Save Execution Mask</div><div>For (Lane : Wavefront/Warp) {</div><div>  Enable Lane, Disable all other lanes</div><div>  SGPR = read SGPR value for current lane from VGPR</div><div>  VGPRResult[Lane] = use_op SGPR</div><div>}</div>Restore Execution Mask<div class=""><br class=""></div><div class="">Eventually it might be nice to have optimizations to only emit one of these loops when multiple consecutive instructions need the same register handled (which I suspect will happen frequently with image samplers), but I haven’t really thought about what that should look like yet.<br class=""><div class=""><br class=""></div><div class="">-Matt</div></div></body></html>