LLVM/CLANG: CUDA compilation fail for inline assembly code

I am trying to compile LonestarGPU-rev2.0 benchmark suite with LLVM/CLANG.

This suite has a following piece of code (more info here):

  • static device uint get_smid(void) {

  • uint ret;

  • asm(“mov.u32 %0, %smid;” : “=r”(ret) );

  • return ret;

  • }

The original make file has nvcc compiler with a flag -Xptxas -v. It compiles with nvcc.

LLVM has -Xcuda-ptxas , which I believe is the comparable command for compiling PTX code. I get following error when I try compiling (clang 4.0).:

  1. …/…/include/cutil_subset.h:23:25: error: invalid % escape in inline assembly string

  2. asm(“mov.u32 %0, %smid;” : “=r”(ret) );

It points to %smid.

I have been trying to figure out what is this error is but NVIDIA PTX has this.

Is this a bug or something?