-
Notifications
You must be signed in to change notification settings - Fork 307
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
raid: R-V V pq_gen xor_gen #318
base: master
Are you sure you want to change the base?
Conversation
hleft
commented
Mar 21, 2025
banana_f3: new: pq_gen_warm: runtime = 3062397 usecs, bandwidth 4737 MB in 3.0624 sec = 1546.92 MB/s old: pq_gen_warm: runtime = 3005894 usecs, bandwidth 2851 MB in 3.0059 sec = 948.80 MB/s Signed-off-by: sunyuechi <sunyuechi@iscas.ac.cn>
raid/raid_base.c
Outdated
@@ -139,6 +139,6 @@ xor_check_base(int vects, int len, void **array) | |||
} | |||
} | |||
if (fail && len > 0) | |||
return len; | |||
return (len % 256 == 0) ? 1 : len; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand this fix. "len" is an int, so it shouldn't return a 0 when len is multiple of 256. Said this, I have looked into the x86 and aarch64 implementations and both return a 1 when the check fails, so I'm inclined to change this to return 1 in case of failure here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manually setting the return value in the test program to 256, 512, etc., will still pass the test. I guess it's because POSIX specifies that the return value range is 0–255, so it's evaluated as (% 256) before checking whether it's zero.
Returning len
or 1
should both be fine; it's just that the original intention might have been to preserve some information, so it wasn't changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If SIMD uses empty code, make check will pass, but running raid/xor_check_test will result in an error and return 1024.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see... What do you mean about empty code? And also, why 1024?
I'd say we should then change the base function to return 1 in case of failure, so it is consistent with the other implementations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before implementing the SIMD code, I wrote an empty assembly function that simply returns, and then ran make check
, which passed. However, the raid/xor_check_test
output was 1024 (because the TEST_LEN used in the test program is 1024), so I noticed the issue.
I've now updated it to return 1.
If len > 255, the return value will be % 256, which causes the test to incorrectly pass Signed-off-by: sunyuechi <sunyuechi@iscas.ac.cn>
banana_f3: new: xor_gen_warm: runtime = 3006459 usecs, bandwidth 10685 MB in 3.0065 sec = 3554.17 MB/s old: xor_gen_warm: runtime = 3060970 usecs, bandwidth 514 MB in 3.0610 sec = 168.21 MB/s Signed-off-by: sunyuechi <sunyuechi@iscas.ac.cn>