Why cannot compile source code libclc when flag define with "'nvptx--nvidiacl', 'nvptx64--nvidiacl'"

Hello All,

I try to compile source code with configure.py for building library object, but it’s represent and error follow as below.

$ ./configure.py --with-llvm-config=/san01/home/chatsiri/workspacecpp/llvm/Debug+Asserts/bin/llvm-config && make
CXX utils/prepare-builtins.o
LINK utils/prepare-builtins
LLVM-AS nvptx–nvidiacl/lib/integer/add_sat.ll.bc
LLVM-CC nvptx–nvidiacl/lib/convert.cl.bc
error: unknown target triple ‘nvptx–nvidiacl’, please use -triple or -arch
make: *** [nvptx–nvidiacl/lib/convert.cl.bc] Error 1

Configure.py defined parameter by default_targets = [‘nvptx–nvidiacl’, ‘nvptx64–nvidiacl’]. My view, It’s parameter specify system architecture from LLVM that source code built in version of architecture those(i386, x64)[1]. Who any idea this error?

[1] http://llvm.org/docs/doxygen/html/dir_1517c77184e85dcdff2c7917c40616d1.html

Hi Chatsiri,

IMHO may be it is caused by the version of your llvm. Since libclc has
switched to support the nvptx backend (which is contained in llvm 3.1
release) three days ago, if your llvm version is below 3.1, then the
error make sense (since llvm cannot find the nvptx backend). Try to
download a newer version of llvm or checkout the head version from
llvm repository, and compile again.

Regards,
Lei Mou

Hi Chatsiri,

IMHO may be it is caused by the version of your llvm. Since libclc has
switched to support the nvptx backend (which is contained in llvm 3.1
release) three days ago, if your llvm version is below 3.1, then the
error make sense (since llvm cannot find the nvptx backend). Try to
download a newer version of llvm or checkout the head version from
llvm repository, and compile again.

Regards,
Lei Mou

Hello Lei Mou,

I compile source code of LLVM version 3.1, but Openclc cannot built the source codes those. LLVM version 3.1 show as below for new version after checkout the head version from LLVM.

LLVM (http://llvm.org/):
LLVM version 3.1svn
DEBUG build with assertions.
Built Jun 5 2012 (16:09:51).
Default target: x86_64-unknown-linux-gnu
Host CPU: corei7

How should I set flag of building with LLVM before compile Openclc? See error below.

$ make
LLVM-CC nvptx–nvidiacl/lib/convert.cl.bc
error: unknown target triple ‘nvptx–nvidiacl’, please use -triple or -arch
make: *** [nvptx–nvidiacl/lib/convert.cl.bc] Error 1

Thank you,
Chatsiri Rattana

Hi Chatsiri,

Sorry, I made a mistake in my previous mail, NVPTX backend is not included in the 3.1 release. Please checkout llvm from the svn repository, and make sure the NVPTX backend is enabled in your compiled binary. You should see something like this when running llc --version:

LLVM (http://llvm.org/):
LLVM version 3.2svn
DEBUG build with assertions.
Built May 31 2012 (20:31:31).
Default target: i386-pc-linux-gnu
Host CPU: penryn

Registered Targets:
… Irrelevant backends are ignored …
nvptx - NVIDIA PTX 32-bit
nvptx64 - NVIDIA PTX 64-bit

Then libclc should work as expected.

Regards,
Lei Mou