Skip to content

Commit 1ca1bb8

Browse files
committed
LoongArch64: Update QEMU
Compile the community version of QEMU to support LSX/LASX extension instructions
1 parent 62c33db commit 1ca1bb8

File tree

2 files changed

+108
-82
lines changed

2 files changed

+108
-82
lines changed

.github/workflows/loongarch64.yml

Lines changed: 54 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,29 @@ jobs:
3333

3434
- name: Install APT deps
3535
run: |
36-
sudo add-apt-repository ppa:savoury1/virtualisation
3736
sudo apt-get update
38-
sudo apt-get install autoconf automake autotools-dev ninja-build make ccache \
39-
qemu-user-static
37+
sudo apt-get install autoconf automake autotools-dev ninja-build make ccache
4038
4139
- name: Download and install loongarch64-toolchain
4240
run: |
4341
wget https://github.com/sunhaiyong1978/CLFS-for-LoongArch/releases/download/8.1/CLFS-loongarch64-8.1-x86_64-cross-tools-gcc-glibc.tar.xz
4442
#wget https://github.com/loongson/build-tools/releases/download/2023.08.08/CLFS-loongarch64-8.1-x86_64-cross-tools-gcc-glibc.tar.xz
4543
tar -xf CLFS-loongarch64-8.1-x86_64-cross-tools-gcc-glibc.tar.xz -C /opt
4644
45+
- name: Checkout qemu
46+
uses: actions/checkout@v3
47+
with:
48+
repository: qemu/qemu
49+
path: qemu
50+
ref: master
51+
52+
- name: Install qemu
53+
run: |
54+
cd qemu
55+
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=loongarch64-linux-user --disable-system --static
56+
make -j$(nproc)
57+
make install
58+
4759
- name: Set env
4860
run: |
4961
echo "LD_LIBRARY_PATH=/opt/cross-tools/target/usr/lib64:/opt/cross-tools/loongarch64-unknown-linux-gnu/lib64:$LD_LIBRARY_PATH" >> $GITHUB_ENV
@@ -76,45 +88,46 @@ jobs:
7688

7789
- name: Test
7890
run: |
79-
qemu-loongarch64-static ./utest/openblas_utest
80-
qemu-loongarch64-static ./utest/openblas_utest_ext
81-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xscblat1
82-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xdcblat1
83-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xccblat1
84-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xzcblat1
85-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xscblat2 < ./ctest/sin2
86-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xdcblat2 < ./ctest/din2
87-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xccblat2 < ./ctest/cin2
88-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xzcblat2 < ./ctest/zin2
89-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xscblat3 < ./ctest/sin3
90-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xdcblat3 < ./ctest/din3
91-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xccblat3 < ./ctest/cin3
92-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xzcblat3 < ./ctest/zin3
93-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/sblat1
94-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/dblat1
95-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/cblat1
96-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/zblat1
97-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/sblat1
98-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/dblat1
99-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/cblat1
100-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/zblat1
91+
export PATH=$GITHUB_WORKSPACE/qemu-install/bin/:$PATH
92+
qemu-loongarch64 ./utest/openblas_utest
93+
qemu-loongarch64 ./utest/openblas_utest_ext
94+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xscblat1
95+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xdcblat1
96+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xccblat1
97+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xzcblat1
98+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xscblat2 < ./ctest/sin2
99+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xdcblat2 < ./ctest/din2
100+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xccblat2 < ./ctest/cin2
101+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xzcblat2 < ./ctest/zin2
102+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xscblat3 < ./ctest/sin3
103+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xdcblat3 < ./ctest/din3
104+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xccblat3 < ./ctest/cin3
105+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xzcblat3 < ./ctest/zin3
106+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/sblat1
107+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/dblat1
108+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/cblat1
109+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/zblat1
110+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/sblat1
111+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/dblat1
112+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/cblat1
113+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/zblat1
101114
rm -f ./test/?BLAT2.SUMM
102-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/sblat2 < ./test/sblat2.dat
103-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/dblat2 < ./test/dblat2.dat
104-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/cblat2 < ./test/cblat2.dat
105-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/zblat2 < ./test/zblat2.dat
115+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/sblat2 < ./test/sblat2.dat
116+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/dblat2 < ./test/dblat2.dat
117+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/cblat2 < ./test/cblat2.dat
118+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/zblat2 < ./test/zblat2.dat
106119
rm -f ./test/?BLAT2.SUMM
107-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/sblat2 < ./test/sblat2.dat
108-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/dblat2 < ./test/dblat2.dat
109-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/cblat2 < ./test/cblat2.dat
110-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/zblat2 < ./test/zblat2.dat
120+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/sblat2 < ./test/sblat2.dat
121+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/dblat2 < ./test/dblat2.dat
122+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/cblat2 < ./test/cblat2.dat
123+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/zblat2 < ./test/zblat2.dat
111124
rm -f ./test/?BLAT3.SUMM
112-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/sblat3 < ./test/sblat3.dat
113-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/dblat3 < ./test/dblat3.dat
114-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/cblat3 < ./test/cblat3.dat
115-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/zblat3 < ./test/zblat3.dat
125+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/sblat3 < ./test/sblat3.dat
126+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/dblat3 < ./test/dblat3.dat
127+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/cblat3 < ./test/cblat3.dat
128+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/zblat3 < ./test/zblat3.dat
116129
rm -f ./test/?BLAT3.SUMM
117-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/sblat3 < ./test/sblat3.dat
118-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/dblat3 < ./test/dblat3.dat
119-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/cblat3 < ./test/cblat3.dat
120-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/zblat3 < ./test/zblat3.dat
130+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/sblat3 < ./test/sblat3.dat
131+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/dblat3 < ./test/dblat3.dat
132+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/cblat3 < ./test/cblat3.dat
133+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/zblat3 < ./test/zblat3.dat

.github/workflows/loongarch64_clang.yml

Lines changed: 54 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ jobs:
3434
3535
- name: Install APT deps
3636
run: |
37-
sudo add-apt-repository ppa:savoury1/virtualisation
3837
sudo apt-get update
39-
sudo apt-get install autoconf automake autotools-dev ninja-build make ccache \
40-
qemu-user-static
38+
sudo apt-get install autoconf automake autotools-dev ninja-build make ccache
4139
4240
- name: Download and install loongarch64-toolchain
4341
run: |
@@ -46,6 +44,20 @@ jobs:
4644
tar -xf clang+llvm_8.0.1-6_amd64-linux-gnu_debian-10.tar.gz -C /opt
4745
tar -xf loongson-gnu-toolchain-8.3-x86_64-loongarch64-linux-gnu-rc1.3.tar.xz -C /opt
4846
47+
- name: Checkout qemu
48+
uses: actions/checkout@v3
49+
with:
50+
repository: qemu/qemu
51+
path: qemu
52+
ref: master
53+
54+
- name: Install qemu
55+
run: |
56+
cd qemu
57+
./configure --prefix=$GITHUB_WORKSPACE/qemu-install --target-list=loongarch64-linux-user --disable-system --static
58+
make -j$(nproc)
59+
make install
60+
4961
- name: Set env
5062
run: |
5163
echo "PATH=$GITHUB_WORKSPACE:/opt/clang+llvm_8.0.1-6_amd64-linux-gnu_debian-10/bin:/opt/loongson-gnu-toolchain-8.3-x86_64-loongarch64-linux-gnu-rc1.3/bin:$PATH" >> $GITHUB_ENV
@@ -77,46 +89,47 @@ jobs:
7789

7890
- name: Test
7991
run: |
80-
qemu-loongarch64-static ./utest/openblas_utest
81-
qemu-loongarch64-static ./utest/openblas_utest_ext
82-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xscblat1
83-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xdcblat1
84-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xccblat1
85-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xzcblat1
86-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xscblat2 < ./ctest/sin2
87-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xdcblat2 < ./ctest/din2
88-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xccblat2 < ./ctest/cin2
89-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xzcblat2 < ./ctest/zin2
90-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xscblat3 < ./ctest/sin3
91-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xdcblat3 < ./ctest/din3
92-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xccblat3 < ./ctest/cin3
93-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./ctest/xzcblat3 < ./ctest/zin3
94-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/sblat1
95-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/dblat1
96-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/cblat1
97-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/zblat1
98-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/sblat1
99-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/dblat1
100-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/cblat1
101-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/zblat1
92+
export PATH=$GITHUB_WORKSPACE/qemu-install/bin/:$PATH
93+
qemu-loongarch64 ./utest/openblas_utest
94+
qemu-loongarch64 ./utest/openblas_utest_ext
95+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xscblat1
96+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xdcblat1
97+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xccblat1
98+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xzcblat1
99+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xscblat2 < ./ctest/sin2
100+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xdcblat2 < ./ctest/din2
101+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xccblat2 < ./ctest/cin2
102+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xzcblat2 < ./ctest/zin2
103+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xscblat3 < ./ctest/sin3
104+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xdcblat3 < ./ctest/din3
105+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xccblat3 < ./ctest/cin3
106+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./ctest/xzcblat3 < ./ctest/zin3
107+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/sblat1
108+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/dblat1
109+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/cblat1
110+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/zblat1
111+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/sblat1
112+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/dblat1
113+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/cblat1
114+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/zblat1
102115
rm -f ./test/?BLAT2.SUMM
103-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/sblat2 < ./test/sblat2.dat
104-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/dblat2 < ./test/dblat2.dat
105-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/cblat2 < ./test/cblat2.dat
106-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/zblat2 < ./test/zblat2.dat
116+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/sblat2 < ./test/sblat2.dat
117+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/dblat2 < ./test/dblat2.dat
118+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/cblat2 < ./test/cblat2.dat
119+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/zblat2 < ./test/zblat2.dat
107120
rm -f ./test/?BLAT2.SUMM
108-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/sblat2 < ./test/sblat2.dat
109-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/dblat2 < ./test/dblat2.dat
110-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/cblat2 < ./test/cblat2.dat
111-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/zblat2 < ./test/zblat2.dat
121+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/sblat2 < ./test/sblat2.dat
122+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/dblat2 < ./test/dblat2.dat
123+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/cblat2 < ./test/cblat2.dat
124+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/zblat2 < ./test/zblat2.dat
112125
rm -f ./test/?BLAT3.SUMM
113-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/sblat3 < ./test/sblat3.dat
114-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/dblat3 < ./test/dblat3.dat
115-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/cblat3 < ./test/cblat3.dat
116-
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64-static ./test/zblat3 < ./test/zblat3.dat
126+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/sblat3 < ./test/sblat3.dat
127+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/dblat3 < ./test/dblat3.dat
128+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/cblat3 < ./test/cblat3.dat
129+
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 qemu-loongarch64 ./test/zblat3 < ./test/zblat3.dat
117130
rm -f ./test/?BLAT3.SUMM
118-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/sblat3 < ./test/sblat3.dat
119-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/dblat3 < ./test/dblat3.dat
120-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/cblat3 < ./test/cblat3.dat
121-
OPENBLAS_NUM_THREADS=2 qemu-loongarch64-static ./test/zblat3 < ./test/zblat3.dat
131+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/sblat3 < ./test/sblat3.dat
132+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/dblat3 < ./test/dblat3.dat
133+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/cblat3 < ./test/cblat3.dat
134+
OPENBLAS_NUM_THREADS=2 qemu-loongarch64 ./test/zblat3 < ./test/zblat3.dat
122135

0 commit comments

Comments
 (0)