Closed sanderjo closed 4 months ago
You generally want to be running bleeding edge for RISC-V, so try upgrading to GCC 14. GCC 13 lacks typecast intrinsics, so it's explicitly disabled there.
Clang 14+ should also work.
I installed gcc-14 etc, made it active, did the build, but still no commands starting with "v" in the objdump-disassembly.
So can you help further? And: the objdump method: is that correct, and does it give v-commands in your output?
Installed gcc-14:
sudo apt install gcc-14 g++-14
via update-alternatives set gcc-14 etc to active:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 90 --slave /usr/bin/g++ g++ /usr/bin/g++-14 --slave /usr/bin/gcov gcov /usr/bin/gcov-14 --slave /usr/bin/riscv64-linux-gnu-gcc riscv64-linux-gnu-gcc /usr/bin/riscv64-linux-gnu-gcc-14
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 70 --slave /usr/bin/g++ g++ /usr/bin/g++-13 --slave /usr/bin/gcov gcov /usr/bin/gcov-13 --slave /usr/bin/riscv64-linux-gnu-gcc riscv64-linux-gnu-gcc /usr/bin/riscv64-linux-gnu-gcc-13
Checking ... looks good ... version 14 is now default:
sander@bananapif3:~/git/sabctools$ riscv64-linux-gnu-gcc --version
riscv64-linux-gnu-gcc (Ubuntu 14-20240412-0ubuntu1) 14.0.1 20240412 (experimental) [master r14-9935-g67e1433a94f]
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
sander@bananapif3:~/git/sabctools$ which riscv64-linux-gnu-gcc
/usr/bin/riscv64-linux-gnu-gcc
sander@bananapif3:~/git/sabctools$ ll /usr/bin/riscv64-linux-gnu-gcc
lrwxrwxrwx 1 root root 39 May 17 15:10 /usr/bin/riscv64-linux-gnu-gcc -> /etc/alternatives/riscv64-linux-gnu-gcc*
sander@bananapif3:~/git/sabctools$ ll /etc/alternatives/riscv64-linux-gnu-gcc
lrwxrwxrwx 1 root root 33 Apr 12 14:30 /etc/alternatives/riscv64-linux-gnu-gcc -> /usr/bin/riscv64-linux-gnu-gcc-14*
clean & build:
python3 setup.py clean
python3 setup.py build
Check: yes, freshly built:
sander@bananapif3:~/git/sabctools$ ll build/lib.linux-riscv64-cpython-312/sabctools/sabctools.cpython-312-riscv64-linux-gnu.so
-rwxrwxr-x 1 sander sander 385656 May 17 15:11 build/lib.linux-riscv64-cpython-312/sabctools/sabctools.cpython-312-riscv64-linux-gnu.so*
... but still no commands starting with "v" in the disassembled code:
objdump -d build/lib.linux-riscv64-cpython-312/sabctools/sabctools.cpython-312-riscv64-linux-gnu.so | awk '{ print $3 }' | sort -u | grep -E "^v"
Proof the objdump does disassemble:
sander@bananapif3:~/git/sabctools$ objdump -d build/lib.linux-riscv64-cpython-312/sabctools/sabctools.cpython-312-riscv64-linux-gnu.so | awk '{ print $3 }' | sort -u | head
add
addi
addiw
addw
and
andi
auipc
beq
beqz
sander@bananapif3:~/git/sabctools$ objdump -d build/lib.linux-riscv64-cpython-312/sabctools/sabctools.cpython-312-riscv64-linux-gnu.so | awk '{ print $3 }' | sort -u | tail
srai
sraiw
srl
srli
srliw
sub
subw
sw
xor
zext.b
Thanks for trying that out.
And: the objdump method: is that correct, and does it give v-commands in your output?
That should be a sufficient indicator.
Are you able to check what commands are being passed to the compiler exactly? Not sure if setuptools offers the option by default.
You can also try with rapidyenc directly - this should help isolate whether the build config has an issue.
If you try rapidyenc directly, after the cmake ..
command, you can use make VERBOSE=1
which should show the commands being executed. In the list, the de/encoder_rvv files should have the -march=rv64gcv
option set.
You should also be able to see ==> Checking support for flag: -march=rv64gcv
in the build log for sabctools.
If using pip to install/build, it seems like passing the -v
option will display all issued commands. Look at the commands used to build decoder_rvv.cc
My attempt to cross build isn't working due to setuptools sending flags the compiler doesn't like.
sander@bananapif3:~/git/sabctools$ git pull
Already up to date.
sander@bananapif3:~/git/sabctools$ python3 setup.py clean
running clean
removing 'build/temp.linux-riscv64-cpython-312' (and everything under it)
sander@bananapif3:~/git/sabctools$
sander@bananapif3:~/git/sabctools$
sander@bananapif3:~/git/sabctools$ python3 setup.py build
running build
running build_py
running build_ext
==> Baseline detection: ARM=False, x86=False, macOS=False
==> Checking support for flag: -std=c++11
==> Please ignore any errors shown below!
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c /tmp/tmp28dpejbi.cc -o tmp/tmp28dpejbi.o -std=c++11
==> Success!
==> Checking support for flag: -march=rv64gcv
==> Please ignore any errors shown below!
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c /tmp/tmpczvs55v1.cc -o tmp/tmpczvs55v1.o -march=rv64gcv
==> Success!
==> Checking support for flag: -march=rv64gc_zbkc
==> Please ignore any errors shown below!
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c /tmp/tmp5tjjbe6o.cc -o tmp/tmp5tjjbe6o.o -march=rv64gc_zbkc
==> Success!
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/examples -I/usr/include/python3.12 -c src/yencode/platform.cc -o build/src/yencode/platform.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/examples -I/usr/include/python3.12 -c src/yencode/encoder.cc -o build/src/yencode/encoder.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/examples -I/usr/include/python3.12 -c src/yencode/decoder.cc -o build/src/yencode/decoder.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/examples -I/usr/include/python3.12 -c src/yencode/crc.cc -o build/src/yencode/crc.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/encoder_sse2.cc -o build/src/yencode/encoder_sse2.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/decoder_sse2.cc -o build/src/yencode/decoder_sse2.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/encoder_ssse3.cc -o build/src/yencode/encoder_ssse3.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/decoder_ssse3.cc -o build/src/yencode/decoder_ssse3.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/crc_folding.cc -o build/src/yencode/crc_folding.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/crc_folding_256.cc -o build/src/yencode/crc_folding_256.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/encoder_avx.cc -o build/src/yencode/encoder_avx.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/decoder_avx.cc -o build/src/yencode/decoder_avx.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/encoder_avx2.cc -o build/src/yencode/encoder_avx2.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/decoder_avx2.cc -o build/src/yencode/decoder_avx2.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/encoder_vbmi2.cc -o build/src/yencode/encoder_vbmi2.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/decoder_vbmi2.cc -o build/src/yencode/decoder_vbmi2.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/encoder_neon.cc -o build/src/yencode/encoder_neon.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/decoder_neon64.cc -o build/src/yencode/decoder_neon64.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/crc_arm.cc -o build/src/yencode/crc_arm.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/crc_arm_pmull.cc -o build/src/yencode/crc_arm_pmull.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/encoder_rvv.cc -o build/src/yencode/encoder_rvv.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/decoder_rvv.cc -o build/src/yencode/decoder_rvv.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/crc_riscv.cc -o build/src/yencode/crc_riscv.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -DCRCUTIL_USE_MM_CRC32=0 -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/tests -I/usr/include/python3.12 -c src/crcutil-1.0/code/crc32c_sse4.cc -o build/src/crcutil-1.0/code/crc32c_sse4.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-expansion-to-defined -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -DCRCUTIL_USE_MM_CRC32=0 -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/tests -I/usr/include/python3.12 -c src/crcutil-1.0/code/multiword_64_64_cl_i386_mmx.cc -o build/src/crcutil-1.0/code/multiword_64_64_cl_i386_mmx.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-expansion-to-defined -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -DCRCUTIL_USE_MM_CRC32=0 -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/tests -I/usr/include/python3.12 -c src/crcutil-1.0/code/multiword_64_64_gcc_amd64_asm.cc -o build/src/crcutil-1.0/code/multiword_64_64_gcc_amd64_asm.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-expansion-to-defined -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -DCRCUTIL_USE_MM_CRC32=0 -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/tests -I/usr/include/python3.12 -c src/crcutil-1.0/code/multiword_64_64_gcc_i386_mmx.cc -o build/src/crcutil-1.0/code/multiword_64_64_gcc_i386_mmx.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-expansion-to-defined -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -DCRCUTIL_USE_MM_CRC32=0 -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/tests -I/usr/include/python3.12 -c src/crcutil-1.0/code/multiword_64_64_intrinsic_i386_mmx.cc -o build/src/crcutil-1.0/code/multiword_64_64_intrinsic_i386_mmx.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-expansion-to-defined -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -DCRCUTIL_USE_MM_CRC32=0 -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/tests -I/usr/include/python3.12 -c src/crcutil-1.0/code/multiword_128_64_gcc_amd64_sse2.cc -o build/src/crcutil-1.0/code/multiword_128_64_gcc_amd64_sse2.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-expansion-to-defined -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -DCRCUTIL_USE_MM_CRC32=0 -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/tests -I/usr/include/python3.12 -c src/crcutil-1.0/examples/interface.cc -o build/src/crcutil-1.0/examples/interface.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-expansion-to-defined -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yenc.cc -o build/src/yenc.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/unlocked_ssl.cc -o build/src/unlocked_ssl.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-unused-parameter -Wno-missing-field-initializers
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/examples -I/usr/include/python3.12 -c src/crc32.cc -o build/src/crc32.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/sparse.cc -o build/src/sparse.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/utils.cc -o build/src/utils.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-unused-parameter
building 'sabctools.sabctools' extension
creating build/temp.linux-riscv64-cpython-312
creating build/temp.linux-riscv64-cpython-312/src
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/sabctools.cc -o build/temp.linux-riscv64-cpython-312/src/sabctools.o -std=c++11
riscv64-linux-gnu-g++ -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-riscv64-cpython-312/src/sabctools.o -L/usr/lib/riscv64-linux-gnu -o build/lib.linux-riscv64-cpython-312/sabctools/sabctools.cpython-312-riscv64-linux-gnu.so -ldl build/src/yencode/platform.o build/src/yencode/encoder.o build/src/yencode/decoder.o build/src/yencode/crc.o build/src/yencode/encoder_sse2.o build/src/yencode/decoder_sse2.o build/src/yencode/encoder_ssse3.o build/src/yencode/decoder_ssse3.o build/src/yencode/crc_folding.o build/src/yencode/crc_folding_256.o build/src/yencode/encoder_avx.o build/src/yencode/decoder_avx.o build/src/yencode/encoder_avx2.o build/src/yencode/decoder_avx2.o build/src/yencode/encoder_vbmi2.o build/src/yencode/decoder_vbmi2.o build/src/yencode/encoder_neon.o build/src/yencode/decoder_neon64.o build/src/yencode/crc_arm.o build/src/yencode/crc_arm_pmull.o build/src/yencode/encoder_rvv.o build/src/yencode/decoder_rvv.o build/src/yencode/crc_riscv.o build/src/crcutil-1.0/code/crc32c_sse4.o build/src/crcutil-1.0/code/multiword_64_64_cl_i386_mmx.o build/src/crcutil-1.0/code/multiword_64_64_gcc_amd64_asm.o build/src/crcutil-1.0/code/multiword_64_64_gcc_i386_mmx.o build/src/crcutil-1.0/code/multiword_64_64_intrinsic_i386_mmx.o build/src/crcutil-1.0/code/multiword_128_64_gcc_amd64_sse2.o build/src/crcutil-1.0/examples/interface.o build/src/yenc.o build/src/unlocked_ssl.o build/src/crc32.o build/src/sparse.o build/src/utils.o
sander@bananapif3:~/git/sabctools$
My attempt to cross build isn't working due to setuptools sending flags the compiler doesn't like.
I can give you ssh access to my RVV 1.0 hardware. Preferably via IPv6, as I'm behind IPV4-CGNAT.
And if you want, I can give you root access. The system is 2 days old, so clean, and I can reflash/reinstall if things go wrong.
Ah, progress ... via an ugly hack: forcing "-march=rv64gcv" as cflags in setup.py:
sander@bananapif3:~/git/sabctools$ diff setup.py.ORG setup.py
123a124,125
> cflags.append("-march=rv64gcv") # Sander hack
>
... and ... bingo ... v-commands in the resulting sabctools .so.
So detecting or setting -march=rv64gcv
is not going well in the non-hacked setup.py?
sander@bananapif3:~/git/sabctools$ objdump -d build/lib.linux-riscv64-cpython-312/sabctools/sabctools.cpython-312-riscv64-linux-gnu.so | awk '{ print $3 }' | sort -u | grep -E "^v" | head -20
vadd.vi
vadd.vv
vand.vi
vcompress.vm
vcpop.m
vid.v
viota.m
vle64.v
vle8.v
vmadc.vi
vmadc.vv
vmand.mm
vmandn.mm
vmerge.vxm
vmnor.mm
vmnot.m
vmor.mm
vmsbf.m
vmseq.vi
vmseq.vv
Ah, I think I messed some code in setup.py. Could you try replacing all instances of gcc_rv_flags
with gcc_flags
in that file, and try again?
Could you try replacing all instances of
gcc_rv_flags
withgcc_flags
in that file, and try again?
Bingo! The resulting .so contains v-commands! And compiling is now a normal time (1 minute), not 3+ minutes like with my ugly hack (where each compile line had that option forced in).
$ sed -i -e 's/gcc_rv_flags/gcc_flags/g' setup.py
Looks good:
sander@bananapif3:~/git/sabctools$ diff setup.py.ORG setup.py
291c291
< "gcc_rv_flags": gcc_rvv_flags,
---
> "gcc_flags": gcc_rvv_flags,
296c296
< "gcc_rv_flags": gcc_rvzbkc_flags,
---
> "gcc_flags": gcc_rvzbkc_flags,
WAIT: gcc_rvv_flags (double v) should still be there? It works, so looks good, but just checking ...
sander@bananapif3:~/git/sabctools$ objdump -d build/lib.linux-riscv64-cpython-312/sabctools/sabctools.cpython-312-riscv64-linux-gnu.so | awk '{ print $3 }' | sort -u | grep -E "^v" | head -10
vadd.vi
vadd.vv
vcompress.vm
vcpop.m
viota.m
vle8.v
vmadc.vi
vmadc.vv
vmand.mm
vmandn.mm
sander@bananapif3:~/git/sabctools$ time python3 setup.py build
running build
running build_py
running build_ext
==> Baseline detection: ARM=False, x86=False, macOS=False
==> Checking support for flag: -std=c++11
==> Please ignore any errors shown below!
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c /tmp/tmpp4bp8htk.cc -o tmp/tmpp4bp8htk.o -std=c++11
==> Success!
==> Checking support for flag: -march=rv64gcv
==> Please ignore any errors shown below!
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c /tmp/tmpx80zysr5.cc -o tmp/tmpx80zysr5.o -march=rv64gcv
==> Success!
==> Checking support for flag: -march=rv64gc_zbkc
==> Please ignore any errors shown below!
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c /tmp/tmpf8z0mjzf.cc -o tmp/tmpf8z0mjzf.o -march=rv64gc_zbkc
==> Success!
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/examples -I/usr/include/python3.12 -c src/yencode/platform.cc -o build/src/yencode/platform.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/examples -I/usr/include/python3.12 -c src/yencode/encoder.cc -o build/src/yencode/encoder.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/examples -I/usr/include/python3.12 -c src/yencode/decoder.cc -o build/src/yencode/decoder.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/examples -I/usr/include/python3.12 -c src/yencode/crc.cc -o build/src/yencode/crc.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/encoder_sse2.cc -o build/src/yencode/encoder_sse2.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/decoder_sse2.cc -o build/src/yencode/decoder_sse2.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/encoder_ssse3.cc -o build/src/yencode/encoder_ssse3.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/decoder_ssse3.cc -o build/src/yencode/decoder_ssse3.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/crc_folding.cc -o build/src/yencode/crc_folding.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/crc_folding_256.cc -o build/src/yencode/crc_folding_256.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/encoder_avx.cc -o build/src/yencode/encoder_avx.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/decoder_avx.cc -o build/src/yencode/decoder_avx.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/encoder_avx2.cc -o build/src/yencode/encoder_avx2.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/decoder_avx2.cc -o build/src/yencode/decoder_avx2.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/encoder_vbmi2.cc -o build/src/yencode/encoder_vbmi2.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/decoder_vbmi2.cc -o build/src/yencode/decoder_vbmi2.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/encoder_neon.cc -o build/src/yencode/encoder_neon.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/decoder_neon64.cc -o build/src/yencode/decoder_neon64.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/crc_arm.cc -o build/src/yencode/crc_arm.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/crc_arm_pmull.cc -o build/src/yencode/crc_arm_pmull.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/encoder_rvv.cc -o build/src/yencode/encoder_rvv.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -march=rv64gcv
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/decoder_rvv.cc -o build/src/yencode/decoder_rvv.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -march=rv64gcv
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yencode/crc_riscv.cc -o build/src/yencode/crc_riscv.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -march=rv64gc_zbkc
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -DCRCUTIL_USE_MM_CRC32=0 -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/tests -I/usr/include/python3.12 -c src/crcutil-1.0/code/crc32c_sse4.cc -o build/src/crcutil-1.0/code/crc32c_sse4.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-expansion-to-defined -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -DCRCUTIL_USE_MM_CRC32=0 -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/tests -I/usr/include/python3.12 -c src/crcutil-1.0/code/multiword_64_64_cl_i386_mmx.cc -o build/src/crcutil-1.0/code/multiword_64_64_cl_i386_mmx.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-expansion-to-defined -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -DCRCUTIL_USE_MM_CRC32=0 -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/tests -I/usr/include/python3.12 -c src/crcutil-1.0/code/multiword_64_64_gcc_amd64_asm.cc -o build/src/crcutil-1.0/code/multiword_64_64_gcc_amd64_asm.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-expansion-to-defined -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -DCRCUTIL_USE_MM_CRC32=0 -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/tests -I/usr/include/python3.12 -c src/crcutil-1.0/code/multiword_64_64_gcc_i386_mmx.cc -o build/src/crcutil-1.0/code/multiword_64_64_gcc_i386_mmx.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-expansion-to-defined -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -DCRCUTIL_USE_MM_CRC32=0 -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/tests -I/usr/include/python3.12 -c src/crcutil-1.0/code/multiword_64_64_intrinsic_i386_mmx.cc -o build/src/crcutil-1.0/code/multiword_64_64_intrinsic_i386_mmx.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-expansion-to-defined -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -DCRCUTIL_USE_MM_CRC32=0 -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/tests -I/usr/include/python3.12 -c src/crcutil-1.0/code/multiword_128_64_gcc_amd64_sse2.cc -o build/src/crcutil-1.0/code/multiword_128_64_gcc_amd64_sse2.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-expansion-to-defined -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -DCRCUTIL_USE_MM_CRC32=0 -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/tests -I/usr/include/python3.12 -c src/crcutil-1.0/examples/interface.cc -o build/src/crcutil-1.0/examples/interface.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-expansion-to-defined -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/yenc.cc -o build/src/yenc.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/unlocked_ssl.cc -o build/src/unlocked_ssl.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-unused-parameter -Wno-missing-field-initializers
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -Isrc/crcutil-1.0/code -Isrc/crcutil-1.0/examples -I/usr/include/python3.12 -c src/crc32.cc -o build/src/crc32.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/sparse.cc -o build/src/sparse.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-unused-parameter
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/utils.cc -o build/src/utils.o -Wall -Wextra -Wno-unused-function -fomit-frame-pointer -fno-rtti -fno-exceptions -O3 -fPIC -fwrapv -std=c++11 -Wno-unused-parameter
building 'sabctools.sabctools' extension
creating build/temp.linux-riscv64-cpython-312
creating build/temp.linux-riscv64-cpython-312/src
riscv64-linux-gnu-gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O2 -Wall -fPIC -I/usr/include/python3.12 -c src/sabctools.cc -o build/temp.linux-riscv64-cpython-312/src/sabctools.o -std=c++11
riscv64-linux-gnu-g++ -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-riscv64-cpython-312/src/sabctools.o -L/usr/lib/riscv64-linux-gnu -o build/lib.linux-riscv64-cpython-312/sabctools/sabctools.cpython-312-riscv64-linux-gnu.so -ldl build/src/yencode/platform.o build/src/yencode/encoder.o build/src/yencode/decoder.o build/src/yencode/crc.o build/src/yencode/encoder_sse2.o build/src/yencode/decoder_sse2.o build/src/yencode/encoder_ssse3.o build/src/yencode/decoder_ssse3.o build/src/yencode/crc_folding.o build/src/yencode/crc_folding_256.o build/src/yencode/encoder_avx.o build/src/yencode/decoder_avx.o build/src/yencode/encoder_avx2.o build/src/yencode/decoder_avx2.o build/src/yencode/encoder_vbmi2.o build/src/yencode/decoder_vbmi2.o build/src/yencode/encoder_neon.o build/src/yencode/decoder_neon64.o build/src/yencode/crc_arm.o build/src/yencode/crc_arm_pmull.o build/src/yencode/encoder_rvv.o build/src/yencode/decoder_rvv.o build/src/yencode/crc_riscv.o build/src/crcutil-1.0/code/crc32c_sse4.o build/src/crcutil-1.0/code/multiword_64_64_cl_i386_mmx.o build/src/crcutil-1.0/code/multiword_64_64_gcc_amd64_asm.o build/src/crcutil-1.0/code/multiword_64_64_gcc_i386_mmx.o build/src/crcutil-1.0/code/multiword_64_64_intrinsic_i386_mmx.o build/src/crcutil-1.0/code/multiword_128_64_gcc_amd64_sse2.o build/src/crcutil-1.0/examples/interface.o build/src/yenc.o build/src/unlocked_ssl.o build/src/crc32.o build/src/sparse.o build/src/utils.o
real 1m3.101s
user 0m59.747s
sys 0m3.330s
Great, thanks for testing!
gcc_rvv_flags (double v) should still be there?
Originally I intended it to be a contraction of RISC-V, so not RVV, but in the end, it's not really needed.
pinging @animetosho
I received my "Banana Pi BPI-F3 SpacemiT K1 8 Core RISC-V", which should have risc-v vector 1.0 (aka RVV 1.0). Running Armbian Ubuntu noble on it.
After
python3 setup.py build
, I do not see commands starting with "v" (assumption: vector commands) in the objdump of the generated sabctools .so libary.Wrong method? Wrong gcc? Wrong ... ?
Help appreciated.
System info: