Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RVV: add cmake toolchain for use Spike #395

Merged
merged 6 commits into from
Apr 10, 2024

Conversation

WojciechMula
Copy link
Collaborator

The current state of tests:

Test project /home/wojtek/github/simdutf/rvvbuild
      Start  1: amalgamation_demo
      Start  2: readme_tests
      Start  3: random_fuzzer
      Start  4: special_tests
      Start  5: validate_ascii_basic_tests
      Start  6: validate_ascii_with_errors_tests
      Start  7: bele_tests
      Start  8: validate_utf8_basic_tests
      Start  9: select_implementation
      Start 10: validate_utf8_brute_force_tests
 1/70 Test  #1: amalgamation_demo .............................***Failed    0.01 sec
      Start 11: validate_utf8_puzzler_tests
 2/70 Test  #2: readme_tests ..................................   Passed    0.02 sec
      Start 12: validate_utf8_with_errors_tests
 3/70 Test  #3: random_fuzzer .................................***Failed    0.03 sec
      Start 13: validate_utf16le_basic_tests
 4/70 Test  #4: special_tests .................................   Passed    0.03 sec
      Start 14: validate_utf16be_basic_tests
 5/70 Test  #5: validate_ascii_basic_tests ....................   Passed    0.03 sec
      Start 15: validate_utf16le_with_errors_tests
 6/70 Test #11: validate_utf8_puzzler_tests ...................   Passed    0.02 sec
      Start 16: validate_utf16be_with_errors_tests
 7/70 Test  #9: select_implementation .........................   Passed    0.03 sec
      Start 17: validate_utf32_basic_tests
 8/70 Test  #8: validate_utf8_basic_tests .....................   Passed    0.03 sec
      Start 18: validate_utf32_with_errors_tests
 9/70 Test  #7: bele_tests ....................................   Passed    0.03 sec
      Start 19: convert_latin1_to_utf8_tests
10/70 Test  #6: validate_ascii_with_errors_tests ..............   Passed    4.11 sec
      Start 20: convert_latin1_to_utf16le_tests
11/70 Test #19: convert_latin1_to_utf8_tests ..................   Passed    4.85 sec
      Start 21: convert_latin1_to_utf16be_tests
12/70 Test #15: validate_utf16le_with_errors_tests ............***Failed    5.08 sec
      Start 22: convert_latin1_to_utf32_tests
13/70 Test #20: convert_latin1_to_utf16le_tests ...............   Passed    2.52 sec
      Start 23: convert_utf8_to_latin1_tests
14/70 Test #14: validate_utf16be_basic_tests ..................   Passed    7.06 sec
      Start 24: convert_utf8_to_latin1_with_errors_tests
15/70 Test #16: validate_utf16be_with_errors_tests ............   Passed    7.06 sec
      Start 25: convert_valid_utf8_to_latin1_tests
16/70 Test #13: validate_utf16le_basic_tests ..................***Failed    7.55 sec
      Start 26: convert_valid_utf8_to_utf16le_tests
17/70 Test #22: convert_latin1_to_utf32_tests .................   Passed    2.88 sec
      Start 27: convert_valid_utf8_to_utf16be_tests
18/70 Test #21: convert_latin1_to_utf16be_tests ...............   Passed    3.65 sec
      Start 28: convert_valid_utf8_to_utf32_tests
19/70 Test #17: validate_utf32_basic_tests ....................   Passed   11.56 sec
      Start 29: convert_utf8_to_utf16le_tests
20/70 Test #18: validate_utf32_with_errors_tests ..............   Passed   13.25 sec
      Start 30: convert_utf8_to_utf16be_tests
21/70 Test #10: validate_utf8_brute_force_tests ...............   Passed   17.02 sec
      Start 31: convert_utf8_to_utf16le_with_errors_tests
22/70 Test #25: convert_valid_utf8_to_latin1_tests ............   Passed   32.72 sec
      Start 32: convert_utf8_to_utf16be_with_errors_tests
23/70 Test #23: convert_utf8_to_latin1_tests ..................   Passed   48.45 sec
      Start 33: convert_utf8_to_utf32_tests
24/70 Test #12: validate_utf8_with_errors_tests ...............   Passed   71.03 sec
      Start 34: convert_utf8_to_utf32_with_errors_tests
25/70 Test #27: convert_valid_utf8_to_utf16be_tests ...........   Passed   74.95 sec
      Start 35: convert_utf16le_to_latin1_tests
26/70 Test #35: convert_utf16le_to_latin1_tests ...............   Passed    6.36 sec
      Start 36: convert_utf16be_to_latin1_tests
27/70 Test #36: convert_utf16be_to_latin1_tests ...............   Passed    4.67 sec
      Start 37: convert_utf16le_to_latin1_tests_with_errors
28/70 Test #37: convert_utf16le_to_latin1_tests_with_errors ...   Passed    3.42 sec
      Start 38: convert_utf16be_to_latin1_tests_with_errors
29/70 Test #38: convert_utf16be_to_latin1_tests_with_errors ...   Passed    5.81 sec
      Start 39: convert_valid_utf16le_to_latin1_tests
30/70 Test #39: convert_valid_utf16le_to_latin1_tests .........   Passed    2.47 sec
      Start 40: convert_valid_utf16be_to_latin1_tests
31/70 Test #40: convert_valid_utf16be_to_latin1_tests .........   Passed    2.54 sec
      Start 41: convert_utf16le_to_utf8_tests
32/70 Test #30: convert_utf8_to_utf16be_tests .................   Passed  109.34 sec
      Start 42: convert_utf16be_to_utf8_tests
33/70 Test #41: convert_utf16le_to_utf8_tests .................   Passed   29.07 sec
      Start 43: convert_utf16le_to_utf8_with_errors_tests
34/70 Test #28: convert_valid_utf8_to_utf32_tests .............   Passed  137.52 sec
      Start 44: convert_utf16be_to_utf8_with_errors_tests
35/70 Test #43: convert_utf16le_to_utf8_with_errors_tests .....   Passed    9.06 sec
      Start 45: convert_utf32_to_latin1_tests
36/70 Test #42: convert_utf16be_to_utf8_tests .................   Passed   31.71 sec
      Start 46: convert_valid_utf32_to_latin1_tests
37/70 Test #46: convert_valid_utf32_to_latin1_tests ...........   Passed    0.04 sec
      Start 47: convert_utf32_to_latin1_with_errors_tests
38/70 Test #44: convert_utf16be_to_utf8_with_errors_tests .....   Passed   11.46 sec
      Start 48: convert_utf32_to_utf8_tests
39/70 Test #48: convert_utf32_to_utf8_tests ...................   Passed    8.77 sec
      Start 49: convert_utf32_to_utf8_with_errors_tests
40/70 Test #34: convert_utf8_to_utf32_with_errors_tests .......   Passed   99.59 sec
      Start 50: convert_utf32_to_utf16le_tests
41/70 Test #33: convert_utf8_to_utf32_tests ...................   Passed  120.03 sec
      Start 51: convert_utf32_to_utf16be_tests
42/70 Test #49: convert_utf32_to_utf8_with_errors_tests .......   Passed    9.81 sec
      Start 52: convert_utf32_to_utf16le_with_errors_tests
43/70 Test #50: convert_utf32_to_utf16le_tests ................   Passed   10.17 sec
      Start 53: convert_utf32_to_utf16be_with_errors_tests
44/70 Test #52: convert_utf32_to_utf16le_with_errors_tests ....   Passed   12.77 sec
      Start 54: convert_valid_utf16le_to_utf8_tests
45/70 Test #51: convert_utf32_to_utf16be_tests ................   Passed   16.73 sec
      Start 55: convert_valid_utf16be_to_utf8_tests
46/70 Test #53: convert_utf32_to_utf16be_with_errors_tests ....   Passed   12.13 sec
      Start 56: convert_valid_utf32_to_utf8_tests
47/70 Test #56: convert_valid_utf32_to_utf8_tests .............   Passed    8.42 sec
      Start 57: convert_valid_utf32_to_utf16le_tests
48/70 Test #57: convert_valid_utf32_to_utf16le_tests ..........   Passed    8.79 sec
      Start 58: convert_valid_utf32_to_utf16be_tests
49/70 Test #55: convert_valid_utf16be_to_utf8_tests ...........   Passed   21.53 sec
      Start 59: convert_utf16le_to_utf32_tests
50/70 Test #54: convert_valid_utf16le_to_utf8_tests ...........   Passed   30.11 sec
      Start 60: convert_utf16be_to_utf32_tests
51/70 Test #58: convert_valid_utf32_to_utf16be_tests ..........   Passed   11.80 sec
      Start 61: convert_utf16le_to_utf32_with_errors_tests
52/70 Test #61: convert_utf16le_to_utf32_with_errors_tests ....   Passed   10.30 sec
      Start 62: convert_utf16be_to_utf32_with_errors_tests
53/70 Test #59: convert_utf16le_to_utf32_tests ................   Passed   19.16 sec
      Start 63: convert_valid_utf16le_to_utf32_tests
54/70 Test #60: convert_utf16be_to_utf32_tests ................   Passed   17.78 sec
      Start 64: convert_valid_utf16be_to_utf32_tests
55/70 Test #63: convert_valid_utf16le_to_utf32_tests ..........   Passed   10.84 sec
      Start 65: count_utf8
56/70 Test #62: convert_utf16be_to_utf32_with_errors_tests ....   Passed   13.19 sec
      Start 66: count_utf16le
57/70 Test #64: convert_valid_utf16be_to_utf32_tests ..........   Passed   11.61 sec
      Start 67: count_utf16be
58/70 Test #26: convert_valid_utf8_to_utf16le_tests ...........   Passed  242.81 sec
      Start 68: detect_encodings_tests
59/70 Test #31: convert_utf8_to_utf16le_with_errors_tests .....   Passed  235.06 sec
      Start 69: basic_fuzzer
60/70 Test #32: convert_utf8_to_utf16be_with_errors_tests .....   Passed  224.16 sec
      Start 70: base64_tests
61/70 Test #67: count_utf16be .................................   Passed   33.00 sec
62/70 Test #68: detect_encodings_tests ........................   Passed   59.57 sec
63/70 Test #29: convert_utf8_to_utf16le_tests .................   Passed  323.21 sec
64/70 Test #66: count_utf16le .................................   Passed  119.81 sec
65/70 Test #65: count_utf8 ....................................   Passed  189.87 sec
66/70 Test #70: base64_tests ..................................   Passed  181.19 sec
67/70 Test #47: convert_utf32_to_latin1_with_errors_tests .....   Passed  314.39 sec
68/70 Test #45: convert_utf32_to_latin1_tests .................   Passed  339.30 sec
69/70 Test #24: convert_utf8_to_latin1_with_errors_tests ......   Passed  792.23 sec
70/70 Test #69: basic_fuzzer ..................................   Passed  781.01 sec

94% tests passed, 4 tests failed out of 70

Total Test time (real) = 1033.10 sec

The following tests FAILED:
	  1 - amalgamation_demo (Failed)
	  3 - random_fuzzer (Failed)
	 13 - validate_utf16le_basic_tests (Failed)
	 15 - validate_utf16le_with_errors_tests (Failed)

const auto rhs = (b); \
if (lhs != rhs) { \
std::stringstream lhs_str; \
lhs_str << lhs; \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are getting errors such as...


D:\a\simdutf\simdutf\tests\base64_tests.cpp(95,5): message : did you mean to call the c_str() method? [D:\a\simdutf\simdutf\build\tests\base64_tests.vcxproj]

D:\a\simdutf\simdutf\tests\..\tests/helpers/test.h(52,34): message : expanded from macro 'ASSERT_EQUAL' [D:\a\simdutf\simdutf\build\tests\base64_tests.vcxproj]

D:\a\simdutf\simdutf\tests\base64_tests.cpp(95,5): error : cannot pass non-trivial object of type '_Mystr' (aka 'basic_string<char, std::char_traits<char>, std::allocator<char>>') to variadic function; expected type from format string was 'char *' [-Wnon-pod-varargs] [D:\a\simdutf\simdutf\build\tests\base64_tests.vcxproj]

D:\a\simdutf\simdutf\tests\..\tests/helpers/test.h(53,34): message : expanded from macro 'ASSERT_EQUAL' [D:\a\simdutf\simdutf\build\tests\base64_tests.vcxproj]

D:\a\simdutf\simdutf\tests\base64_tests.cpp(95,5): message : did you mean to call the c_str() method? [D:\a\simdutf\simdutf\build\tests\base64_tests.vcxproj]

D:\a\simdutf\simdutf\tests\..\tests/helpers/test.h(53,34): message : expanded from macro 'ASSERT_EQUAL' [D:\a\simdutf\simdutf\build\tests\base64_tests.vcxproj]

lhs_str << lhs; \
std::stringstream rhs_str; \
rhs_str << rhs; \
printf("lhs: %s = %s\n", #a, lhs_str.str()); \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
printf("lhs: %s = %s\n", #a, lhs_str.str()); \
printf("lhs: %s = %s\n", #a, lhs_str.str().c_str()); \

std::stringstream rhs_str; \
rhs_str << rhs; \
printf("lhs: %s = %s\n", #a, lhs_str.str()); \
printf("rhs: %s = %s\n", #b, rhs_str.str()); \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
printf("rhs: %s = %s\n", #b, rhs_str.str()); \
printf("rhs: %s = %s\n", #b, rhs_str.str().c_str()); \

@lemire
Copy link
Member

lemire commented Apr 9, 2024

Note that in modern C++ (C++20), we would just use std::format or std::print.

Or, we could use fmt: https://github.com/fmtlib/fmt

Use of std::cout or std:cerr makes impossible to run programs
under Spike & proxy kernel (`pk`). The initialization of these
standard streams depends on futexes (in glibc) and `pk` does
not implement all system calls.

A side effect is being ready for use the `fmt` library.
std::cout << " implementation.convert_utf16_to_utf32.second return " << utf16_to_utf32.second << std::endl;
printf("%s\n", (is_ok_utf16.second ? "UTF-16 is ok" : "UTF-16 is not ok"));
printf(" size = %llu\n", input.size() / sizeof(char16_t));
printf(" implementation.convert_utf16_to_utf8.second return %llu\n", utf16_to_utf8.second);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The recommended expression to print a size_t value is %zu and not %llu.

See https://en.cppreference.com/w/c/types/size_t

@@ -374,8 +373,7 @@ TEST(roundtrip_base64) {
printf("=====input size %zu\n", len);
for (size_t i = 0; i < len; i++) {
if (back[i] != source[i]) {
std::cerr << "Mismatch at position " << i << " trial " << trial
<< std::endl;
printf("Mismatch at position %llu trial %llu\n", i, trial);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here, should be %zu and not %llu.

@lemire
Copy link
Member

lemire commented Apr 9, 2024

@WojciechMula Your changes have triggered another bug in our test framework, see #404

Eventually, you should rebase on top of #404

Sorry.

@lemire
Copy link
Member

lemire commented Apr 10, 2024

@WojciechMula Can you rebase? I think I fixed the issue your work outlined.

@lemire
Copy link
Member

lemire commented Apr 10, 2024

Running tests.

@lemire
Copy link
Member

lemire commented Apr 10, 2024

I am going to merge and then fix the issues.

@lemire lemire merged commit 6e6644a into simdutf:master Apr 10, 2024
9 of 45 checks passed
@lemire
Copy link
Member

lemire commented Apr 10, 2024

I have resolved the issue directly in the main branch.

@WojciechMula
Copy link
Collaborator Author

Thanks a lot!

@WojciechMula WojciechMula deleted the rvv-spike-support branch April 10, 2024 18:07
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.

None yet

2 participants