<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></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 Jun 1, 2019, at 10:57 PM, Jan Vesely <<a href="mailto:jan.vesely@rutgers.edu" class="">jan.vesely@rutgers.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span 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; float: none; display: inline !important;" class="">On Thu, 2019-05-30 at 08:40 -0400, Matt Arsenault wrote:</span><br 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=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Ping<br class=""><br class=""><blockquote type="cite" class="">On May 23, 2019, at 7:59 PM, <a href="mailto:arsenm2@gmail.com" class="">arsenm2@gmail.com</a> wrote:<br class=""><br class="">From: Matt Arsenault <<a href="mailto:arsenm2@gmail.com" class="">arsenm2@gmail.com</a>><br class=""><br class="">---<br class="">.../program/execute/call-clobbers-amdgcn.cl   | 102 ++++++++++++++++++<br class="">1 file changed, 102 insertions(+)<br class=""><br class="">diff --git a/tests/cl/program/execute/call-clobbers-amdgcn.cl b/tests/cl/program/execute/call-clobbers-amdgcn.cl<br class="">index 18e657ce3..b0a1f8c70 100644<br class="">--- a/tests/cl/program/execute/call-clobbers-amdgcn.cl<br class="">+++ b/tests/cl/program/execute/call-clobbers-amdgcn.cl<br class="">@@ -19,6 +19,49 @@ dimensions: 1<br class="">global_size: 1 0 0<br class="">arg_out: 0 buffer int[1] 0xabcd1234<br class=""><br class="">+[test]<br class="">+name: Conditional call<br class="">+kernel_name: conditional_call<br class="">+dimensions: 1<br class="">+local_size: 64 0 0<br class="">+global_size: 64 0 0<br class="">+arg_out: 0 buffer int[64] \<br class="">+  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 \<br class="">+  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 \<br class="">+  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 \<br class="">+  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 \<br class="">+  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 \<br class="">+  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 \<br class="">+  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 \<br class="">+  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234<br class="">+<br class="">+[test]<br class="">+name: Conditional call partial dispatch<br class="">+kernel_name: conditional_call<br class="">+dimensions: 1<br class="">+local_size: 16 0 0<br class="">+global_size: 16 0 0<br class="">+arg_out: 0 buffer int[16] \<br class="">+  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 \<br class="">+  0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234 0xabcd1234<br class="">+<br class="">+<br class="">+[test]<br class="">+name: Skip call no lanes<br class="">+kernel_name: skip_call_no_lanes<br class="">+dimensions: 1<br class="">+local_size: 64 0 0<br class="">+global_size: 64 0 0<br class="">+arg_out: 0 buffer int[64] \<br class="">+  123 123 123 123 123 123 123 123 \<br class="">+  123 123 123 123 123 123 123 123 \<br class="">+  123 123 123 123 123 123 123 123 \<br class="">+  123 123 123 123 123 123 123 123 \<br class="">+  123 123 123 123 123 123 123 123 \<br class="">+  123 123 123 123 123 123 123 123 \<br class="">+  123 123 123 123 123 123 123 123 \<br class="">+  123 123 123 123 123 123 123 123<br class="">+<br class="">!*/<br class=""><br class="">#ifndef __AMDGCN__<br class="">@@ -65,3 +108,62 @@ kernel void call_clobber_v40(__global int* ret)<br class="">                 : "v40");<br class="">   *ret = tmp;<br class="">}<br class="">+<br class="">+__attribute__((noinline))<br class="">+void spill_sgpr_to_csr_vgpr()<br class="">+{<br class="">+    __asm volatile(<br class="">+        "s_nop 1" :::<br class="">+        "v0","v1","v2","v3","v4","v5","v6","v7",<br class="">+        "v8","v9","v10","v11","v12","v13","v14","v15",<br class="">+        "v16","v17","v18","v19","v20","v21","v22","v23",<br class="">+        "v24","v25","v26","v27","v28","v29","v30","v31",<br class="">+<br class="">+        "s0","s1","s2","s3","s4","s5","s6","s7",<br class="">+        "s8","s9","s10","s11","s12","s13","s14","s15",<br class="">+        "s16","s17","s18","s19","s20","s21","s22","s23",<br class="">+        "s24","s25","s26","s27","s28","s29","s30","s31",<br class="">+        "s32", "s33", "s34", "s35", "s36", "s37", "s38");<br class="">+}<br class="">+<br class="">+// A CSR VGPR needs to be spilled/restored in the prolog/epilog, but<br class="">+// all lanes need to be made active to avoid clobbering lanes that did<br class="">+// not enter the call.<br class="">+kernel void conditional_call(global int* ret)<br class="">+{<br class="">+    __asm volatile("v_mov_b32 v32, 0xabcd1234" : : : "v32");<br class="">+<br class="">+    int id = get_local_id(0);<br class="">+    if (id == 0)<br class="">+    {<br class="">+        spill_sgpr_to_csr_vgpr();<br class="">+    }<br class="">+<br class="">+    int tmp;<br class="">+    __asm volatile("v_mov_b32 %0, v32"<br class="">+                   : "=v"(tmp)<br class="">+                   :<br class="">+                   : "v32");<br class="">+    ret[id] = tmp;<br class="">+}<br class="">+<br class="">+__attribute__((noinline))<br class="">+void hang_if_all_inactive()<br class="">+{<br class="">+    __builtin_amdgcn_s_sendmsghalt(0, 0);<br class="">+}<br class="">+<br class="">+// If all lanes could be dynamically false, the call must not be taken<br class="">+// in case a side effecting scalar op is called inside.<br class="">+kernel void skip_call_no_lanes(global int* ret)<br class="">+{<br class="">+    int divergent_false;<br class="">+    __asm volatile("v_mov_b32 %0, 0" : "=v"(divergent_false));<br class="">+<br class="">+    if (divergent_false)<br class="">+    {<br class="">+        hang_if_all_inactive();<br class=""></blockquote></blockquote><br 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=""><span 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; float: none; display: inline !important;" class="">this looks like it will hang the GPU on test failure, which is a no-</span><br 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=""><span 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; float: none; display: inline !important;" class="">go.</span><br 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=""><br 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=""><span 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; float: none; display: inline !important;" class="">Jan</span><br 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=""></div></blockquote></div><br class=""><div class=""><br class=""></div><div class="">Is there a way to specify a timeout? The alternatives require more ABI support</div></body></html>