NVPTX: why ret instruction is not translated to exit in kernel function?

Hi Justin,

In the PTX backend, “ret” instruction at the end of a ptx_kernel function is translated to “exit” instruction. A test case named exit.ll demos this.
But in the NVPTX backend, it seems that you didn’t do such a translation. Why do you choose this? Is this due to the changes of the NVIDA PTX itself?

Thanks,

Yabin

From: Yabin Hu [mailto:yabin.hwu@gmail.com]
Sent: Monday, May 14, 2012 11:40 PM
To: LLVM Developers Mailing List; Justin Holewinski
Subject: NVPTX: why ret instruction is not translated to exit in kernel
function?

Hi Justin,

In the PTX backend, "ret" instruction at the end of a ptx_kernel function is
translated to "exit" instruction. A test case named exit.ll demos this.
But in the NVPTX backend, it seems that you didn't do such a translation.
Why do you choose this? Is this due to the changes of the NVIDA PTX itself?

Either way is valid. From the PTX spec:

    A return instruction executed in a top-level entry routine will terminate thread execution.