Skip to content

adding ci tests#1

Closed
lemire wants to merge 2 commits intocamel-cdr:masterfrom
lemire:riscv_ci
Closed

adding ci tests#1
lemire wants to merge 2 commits intocamel-cdr:masterfrom
lemire:riscv_ci

Conversation

@lemire
Copy link
Copy Markdown

@lemire lemire commented Mar 1, 2024

No description provided.

@camel-cdr
Copy link
Copy Markdown
Owner

camel-cdr commented Mar 1, 2024

@lemire Does "name: Ubuntu RISC-V" "arch: riscv64" give you a RISC-V system? If it does, does it support rvv?

I think it's safer to use cross-compilation with qemu, this would allow us to test with multiple vector lengths.

I'll try to set up the ci for this repository.

@camel-cdr camel-cdr force-pushed the master branch 6 times, most recently from 6e629fc to b912177 Compare March 1, 2024 21:59
@lemire
Copy link
Copy Markdown
Author

lemire commented Mar 1, 2024

"arch: riscv64" give you a RISC-V system? If it does, does it support rvv?

It provides a QEMU 64-bit RISC-V emulator running the latest Ubuntu: https://www.qemu.org/docs/master/system/target-riscv.html

I think it's safer to use cross-compilation with qemu, this would allow us to test with multiple vector lengths.

I am not very concerned with details but I often find it easier to use ready-made GitHub actions.

@camel-cdr
Copy link
Copy Markdown
Owner

I'll continue this tomorrow. The version I've got now worked in docker, but apparently github doesn't allow modifying /etc/apt/sources.list.
The problem is that ubuntu-latest doesn't have clang-17, that is solved by your suggestions, but it also doesn't have a qemu build that supports rvv. I don't know any better way to install a newer qemu, other than building from source.

@camel-cdr camel-cdr force-pushed the master branch 2 times, most recently from c7b0b6f to 573ac4d Compare March 2, 2024 13:00
@camel-cdr
Copy link
Copy Markdown
Owner

@lemire Ok, I figured it out, the ci test works now, see: https://github.com/camel-cdr/simdutf/actions/runs/8122950210

Does this look good, or should we also enable asan and test with different vector lengths?

@lemire
Copy link
Copy Markdown
Author

lemire commented Mar 2, 2024

Does this look good, or should we also enable asan and test with different vector lengths?

Everything else being equal, the more tests, the better but the trade-off is longer running tests... so we want to balance things out and not go overboard.

@camel-cdr camel-cdr force-pushed the master branch 5 times, most recently from 112155e to 099f26c Compare March 3, 2024 19:28
@camel-cdr
Copy link
Copy Markdown
Owner

Ok, I wasn't able to get the sanitizers to work with qemu, so I've now added two test runs, one with the minimum VLEN and one with the maximum VLEN that qemu supports (128, and 1024).

@camel-cdr camel-cdr closed this Mar 3, 2024
camel-cdr pushed a commit that referenced this pull request Nov 18, 2024
…imdutf#576)

==17876==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x517000000307 at pc 0x561dd0419320 bp 0x7ffd11808360 sp 0x7ffd11808358
WRITE of size 16 at 0x517000000307 thread T0
    #0 0x561dd041931f in simdutf::haswell::(anonymous namespace)::convert_masked_utf8_to_latin1(char const*, unsigned long, char*&) /home/pauldreik/code/delaktig/simdutf/src/haswell/avx2_convert_utf8_to_latin1.cpp:28:5
    #1 0x561dd037a5d7 in simdutf::haswell::(anonymous namespace)::utf8_to_latin1::validating_transcoder::convert(char const*, unsigned long, char*) /home/pauldreik/code/delaktig/simdutf/src/generic/utf8_to_latin1/utf8_to_latin1.h:178:29
    simdutf#2 0x561dd037a06b in simdutf::haswell::implementation::convert_utf8_to_latin1(char const*, unsigned long, char*) const /home/pauldreik/code/delaktig/simdutf/src/haswell/implementation.cpp:309:20
    simdutf#3 0x561dd0286e12 in test_impl_ossfuzz_372067232(simdutf::implementation const&) /home/pauldreik/code/delaktig/simdutf/tests/convert_utf8_to_latin1_tests.cpp:93:33
    simdutf#4 0x561dd028516f in ossfuzz_372067232(simdutf::implementation const&) /home/pauldreik/code/delaktig/simdutf/tests/convert_utf8_to_latin1_tests.cpp:20:1
    simdutf#5 0x561dd0299782 in simdutf::test::test_entry::operator()(simdutf::implementation const&) /home/pauldreik/code/delaktig/simdutf/tests/helpers/test.h:18:58
    simdutf#6 0x561dd02926ca in (anonymous namespace)::run((anonymous namespace)::CommandLine const&) /home/pauldreik/code/delaktig/simdutf/tests/helpers/test.cpp:179:9
    simdutf#7 0x561dd0290fc5 in simdutf::test::main(int, char**) /home/pauldreik/code/delaktig/simdutf/tests/helpers/test.cpp:207:3
    simdutf#8 0x561dd028d611 in main /home/pauldreik/code/delaktig/simdutf/tests/convert_utf8_to_latin1_tests.cpp:293:1
    simdutf#9 0x7f31b415adb9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    simdutf#10 0x7f31b415ae74 in __libc_start_main csu/../csu/libc-start.c:360:3
    simdutf#11 0x561dd01a9650 in _start (/home/pauldreik/code/delaktig/simdutf/build/paul_clang_18-Debug/tests/convert_utf8_to_latin1_tests+0x35650) (BuildId: ab54037bea01a246225d9f551b72ba81eb4f6416)

0x517000000307 is located 0 bytes after 647-byte region [0x517000000080,0x517000000307)
allocated by thread T0 here:
    #0 0x561dd0282be1 in operator new(unsigned long) (/home/pauldreik/code/delaktig/simdutf/build/paul_clang_18-Debug/tests/convert_utf8_to_latin1_tests+0x10ebe1) (BuildId: ab54037bea01a246225d9f551b72ba81eb4f6416)
    #1 0x561dd028f28e in std::__new_allocator<char>::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/new_allocator.h:151:27
    simdutf#2 0x561dd0290023 in std::allocator<char>::allocate(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/allocator.h:196:32
    simdutf#3 0x561dd0290023 in std::allocator_traits<std::allocator<char>>::allocate(std::allocator<char>&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/alloc_traits.h:478:20
    simdutf#4 0x561dd0290023 in std::_Vector_base<char, std::allocator<char>>::_M_allocate(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_vector.h:380:20
    simdutf#5 0x561dd028fe20 in std::_Vector_base<char, std::allocator<char>>::_M_create_storage(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_vector.h:398:33
    simdutf#6 0x561dd028f9d1 in std::_Vector_base<char, std::allocator<char>>::_Vector_base(unsigned long, std::allocator<char> const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_vector.h:334:9
    simdutf#7 0x561dd028e4d8 in std::vector<char, std::allocator<char>>::vector(unsigned long, std::allocator<char> const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_vector.h:557:9
    simdutf#8 0x561dd0286d70 in test_impl_ossfuzz_372067232(simdutf::implementation const&) /home/pauldreik/code/delaktig/simdutf/tests/convert_utf8_to_latin1_tests.cpp:92:21
    simdutf#9 0x561dd028516f in ossfuzz_372067232(simdutf::implementation const&) /home/pauldreik/code/delaktig/simdutf/tests/convert_utf8_to_latin1_tests.cpp:20:1
    simdutf#10 0x561dd0299782 in simdutf::test::test_entry::operator()(simdutf::implementation const&) /home/pauldreik/code/delaktig/simdutf/tests/helpers/test.h:18:58
    simdutf#11 0x561dd02926ca in (anonymous namespace)::run((anonymous namespace)::CommandLine const&) /home/pauldreik/code/delaktig/simdutf/tests/helpers/test.cpp:179:9
    simdutf#12 0x561dd0290fc5 in simdutf::test::main(int, char**) /home/pauldreik/code/delaktig/simdutf/tests/helpers/test.cpp:207:3
    simdutf#13 0x561dd028d611 in main /home/pauldreik/code/delaktig/simdutf/tests/convert_utf8_to_latin1_tests.cpp:293:1
    simdutf#14 0x7f31b415adb9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/pauldreik/code/delaktig/simdutf/src/haswell/avx2_convert_utf8_to_latin1.cpp:28:5 in simdutf::haswell::(anonymous namespace)::convert_masked_utf8_to_latin1(char const*, unsigned long, char*&)
Shadow bytes around the buggy address:
  0x517000000080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x517000000100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x517000000180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x517000000200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x517000000280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x517000000300:[07]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x517000000380: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x517000000400: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x517000000480: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x517000000500: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x517000000580: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==17876==ABORTING
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants