<div dir="ltr">Hi Justin, <div><br></div><div>Is a compiler allowed to inline a function that calls __syncthreads? I saw nvcc does that, but not sure it's valid though. For example, </div><div><br></div><div>void foo() {</div><div>  __syncthreads();</div><div>}</div><div><br></div><div>if (threadIdx.x % 2 == 0) {</div><div>  ...</div><div>  foo();</div><div>} else {</div><div>  ...</div><div>  foo();</div><div>}</div><div><br></div><div>Before inlining, all threads meet at one __syncthreads(). After inlining</div><div><br></div><div>if (threadIdx.x % 2 == 0) {</div><div>  ...</div><div>  __syncthreads();</div><div>} else {</div><div>  ...</div><div>  __syncthreads();</div><div>}</div><div><br></div><div>The __syncthreads call is duplicated, and it's no longer guaranteed that all threads can meet one __syncthreads(). </div><div><br></div><div>Any thoughts? </div><div><br></div><div>Jingyue</div></div>