ROCm-Developer-Tools/LLVM-AMDGPU-Assembler-Extra

Cannot build example/sp3

owuntu opened this issue · 14 comments

Hi,
When I try to run make after cmake step, I get this clang error:

~/git/LLVM-AMDGPU-Assembler-Extra/build$ make
[ 5%] Built target amdphdrs
[ 11%] Built target examples_common
[ 13%] Assembling for.s to for.o
clang-3.5: warning: argument unused during compilation: '-mcpu=fiji'
~/git/LLVM-AMDGPU-Assembler-Extra/examples/sp3/for.s: Assembler messages:
~/git/LLVM-AMDGPU-Assembler-Extra/examples/sp3/for.s:47: Error: no such instruction: v_mov_b32 v0,0' ~/git/LLVM-AMDGPU-Assembler-Extra/examples/sp3/for.s:47: Error: no such instruction:v_mov_b32 v0,0'
~/git/LLVM-AMDGPU-Assembler-Extra/examples/sp3/for.s:47: Error: no such instruction: v_mov_b32 v0,3' ~/git/LLVM-AMDGPU-Assembler-Extra/examples/sp3/for.s:47: Error: no such instruction:v_mov_b32 v0,3'
clang-3.5: error: assembler command failed with exit code 1 (use -v to see invocation)
examples/sp3/CMakeFiles/for_co.dir/build.make:64: recipe for target 'examples/sp3/for.o' failed
make[2]: *** [examples/sp3/for.o] Error 1
CMakeFiles/Makefile2:229: recipe for target 'examples/sp3/CMakeFiles/for_co.dir/all' failed
make[1]: *** [examples/sp3/CMakeFiles/for_co.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

I have hcc-native-gcn-isa llvm and hcc build successfully, and LLVM_DIR is point to hcc-native-gcn-isa/llvm/build/cmake/modules/CMakeFiles. I also change CLANG point to hcc-native-gcn-isa/hcc/build/bin/clang.

Hi,

As your error message shown, it may be the case that cmake use the old version clang (clang-3.5). You may try to delete the build directory (to eliminate the cmake cache), let cmake find the correct directory and toolchain, and rebuild the example.

[EDIT]: I don't build the LLVM in the project HCC-Native-GCN-ISA, and I don't know if it is dependent on the cfe.

Li

Hi Li,
I was using the system clang (/usr/bin/clang), which is Ubuntu clang version 3.6.0-2ubuntu1 (tags/RELEASE_360/final) (based on LLVM 3.6.0). But I was getting the same error no such instruction:```v_mov_b32 v0,0'
In addition, what's your LLVM_DIR value? Without setting LLVM_DIR, CMake comlaint:

CMake Error at CMakeLists.txt:54 (find_package):
Could not find a package configuration file provided by "LLVM" with any of
the following names:

LLVMConfig.cmake
llvm-config.cmake

Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set
"LLVM_DIR" to a directory containing one of the above files. If "LLVM"
provides a separate development package or SDK, be sure it has been
installed.

And hcc-native-gcn-isa/llvm/build/cmake/modules/CMakeFiles is a directory that contains LLVMConfig.cmake file.

Yuntao

The examples require LLVM_DIR set to build of LLVM trunk (3.9/later than April 2016).

Hi,
I change to use hcc-native-gcn-isa master branch, and I can get LLVM 3.9.0svn version built. However, the clang it built in hcc-native-gcn-isa/hcc is version 3.5. And as I used this LLVM and Clang, it still complaint the same issue.

[ 16%] Assembling for.s to for.o
clang-3.5: warning: argument unused during compilation: '-mcpu=fiji'
~/git/hcc-native-gcn-isa/llvm-amdgpu-assembler-extra/examples/sp3/for.s: Assembler messages:
~/git/hcc-native-gcn-isa/llvm-amdgpu-assembler-extra/examples/sp3/for.s:47: Error: no such instruction: v_mov_b32 v0,0' ~/git/hcc-native-gcn-isa/llvm-amdgpu-assembler-extra/examples/sp3/for.s:47: Error: no such instruction: v_mov_b32 v0,0'
~/git/hcc-native-gcn-isa/llvm-amdgpu-assembler-extra/examples/sp3/for.s:47: Error: no such instruction: v_mov_b32 v0,3' ~/git/hcc-native-gcn-isa/llvm-amdgpu-assembler-extra/examples/sp3/for.s:47: Error: no such instruction: v_mov_b32 v0,3'
clang-3.5: error: assembler command failed with exit code 1 (use -v to see invocation)
examples/sp3/CMakeFiles/for_co.dir/build.make:64: recipe for target 'examples/sp3/for.o' failed

As you noted, HCC is still on older LLVM, so it will not work. clang/llvm from https://github.com/llvm-mirror/ is known to work.

We are in the process of updating the CLANG frontend to 3.9

greg
On Jun 24, 2016, at 2:50 PM, Nikolay Haustov <notifications@github.commailto:notifications@github.com> wrote:

As you noted, HCC is still on older LLVM, so it will not work. clang/llvm from https://github.com/llvm-mirror/ is known to work.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com//issues/13#issuecomment-228444915, or mute the threadhttps://github.com/notifications/unsubscribe/AD8DuXjLscr-39CW3xEsQP-KR6JYmbTNks5qPDTogaJpZM4I9QcA.

Hi Nikolay,
Even with master branch of LLVM, I couldn't build the examples. Does the examples need clang? Last time I checked, it does not.

Yes, both LLVM and Clang from trunk are needed.

Hi Nikolay,
I used upstream clang, some compiled. Some did not.


/home/aditya/hcc.lc/llvm-amdgpu-assembler-extra/examples/asm-kernel/asm-kernel.s:64:24: error: floating point operands not allowed with sext() modifier
  v_mov_b32 v0, 3.14159
                       ^
/home/aditya/hcc.lc/llvm-amdgpu-assembler-extra/examples/asm-kernel/asm-kernel.s:64:24: error: failed parsing operand.
  v_mov_b32 v0, 3.14159
                       ^
make[2]: *** [examples/asm-kernel/asm-kernel.o] Error 1
make[1]: *** [examples/asm-kernel/CMakeFiles/asm-kernel_co.dir/all] Error 2
make: *** [all] Error 2

This looks like a recent regression.

This regression should be fixed with latest changes in LLVM trunk.

The "v_mov_b32 v0, 3.14159" issue is fixed by r274551 by @SamWot. There is another issue with labels, which were broken some time ago.

/srv/git/LLVM-AMDGPU-Assembler-Extra.artem/LLVM-AMDGPU-Assembler-Extra/examples/gfx8/s_memrealtime.s:89:18: error: invalid operand for instruction
  s_cbranch_scc1 loop_start

I am taking this.

Fix is under review, http://reviews.llvm.org/D22133.
LLVM-AMDGPU-Assembler-Extra builds fine with it.

Committed r275054. Issue resolved.

$ cd /srv/git/llvm-clang.artem/llvm
$ git log -1

commit 20ad7302fa33c1a1498504140159afb58b4e50f8
Author: Artem Tamazov <artem.tamazov@amd.com>
Date:   Mon Jul 11 12:07:18 2016 +0000

    [AMDGPU][llvm-mc] Quickfix for r272748 to enable labels in branch instructions.

    Fixes issue mentioned at:
      https://github.com/RadeonOpenCompute/LLVM-AMDGPU-Assembler-Extra/issues/13.
    Lit tests added.

    Differential Revision: http://reviews.llvm.org/D22133

    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275054 91177308-0d34-0410-b5e6-96231b3b80d8

$ cd /srv/git/LLVM-AMDGPU-Assembler-Extra.artem/LLVM-AMDGPU-Assembler-Extra
$ git log -1

commit ca6a43fccab9645060c3e3f14b8ac4ba000865df
Author: Kirpich30000 <i.am.perminov@gmail.com>
Date:   Wed Jun 8 20:05:24 2016 +0300

    Fix gprs count in amd_kernel_code_t

$ cd ../build.Debug
$ make test

Running tests...
Test project /srv/git/LLVM-AMDGPU-Assembler-Extra.artem/build.Debug
    Start 1: asm-kernel
1/7 Test #1: asm-kernel .......................   Passed    0.04 sec
    Start 2: ds_bpermute
2/7 Test #2: ds_bpermute ......................   Passed    0.04 sec
    Start 3: dpp_reduce
3/7 Test #3: dpp_reduce .......................   Passed    0.04 sec
    Start 4: s_memrealtime
4/7 Test #4: s_memrealtime ....................   Passed    1.12 sec
    Start 5: s_memrealtime_inline
5/7 Test #5: s_memrealtime_inline .............   Passed    1.12 sec
    Start 6: api/assemble
6/7 Test #6: api/assemble .....................   Passed    0.00 sec
    Start 7: api/disassemble
7/7 Test #7: api/disassemble ..................   Passed    0.00 sec

100% tests passed, 0 tests failed out of 7
Total Test time (real) =   2.35 sec