-
Notifications
You must be signed in to change notification settings - Fork 287
Rust stable version 4x times performance loss in avx2 #674
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
Comments
Weird. I think it would be better to fill this issue in rust-lang/rust, since it appears to be a compiler issue. Do you have a small self-contained snippet of code that reproduces the issue? |
The problem is in the It is closely related to rust-lang/rust#50154. But it also happens with a debug build. As seen in this zzau13/v_escape#19, with There are several cases, I will reduce them to the minimum cases and put it in a repository in the minimum possible time. |
https://github.com/rust-iendo/bench_stdsimd code that fails the only difference is that the logic of writing by a counter has changed. I can not make it fail, it's cut and paste. https://travis-ci.org/rust-iendo/bench_stdsimd and https://travis-ci.org/rust-iendo/v_htmlescape/builds/485079457 . I will be working on this repository until I fail. https://travis-ci.org/rust-iendo/v_htmlescape. Fail |
@botika I think it will be best to wait if it is fixed in the next beta, and if so, we can close this. I don't think we will backport any fixes for the stable versions. |
|
I'm wrong these changes do not solve my performance problems. https://travis-ci.org/rust-iendo/v_htmlescape/jobs/493398064#L1355 They have solved the tests in release. The safest thing is to always return a -1. |
@botika it would be great to have a single crate without any dependencies that reproduces this issue. I can take over minimizing from there. |
I do not really use any external libraries in runtime. I use #[macro_use]
extern crate v_escape;
// generate struct and function _escape
new_escape!(
MyEs,
"#0->zero || #1->one || #2->two || #3->three || #4->four || #5->five || \
#6->six || #7->seven || #8->eight || #9->nine", print = true
);
// you can use unsafe _escape(&[u8], fmt::Formatter) -> fmt::Result
fn main() {
print!("{}", escape("foo bar more than 32 bytes....");
} |
I guess what I am saying is that I want to help you, but I have very little time to invest in this. If the code that reproduces this does have dependencies, is larger than a couple of 100 LOC, does not compile in the playground, etc. then I am going to need more time that's what minimally necessary to figure out what's wrong and fix it, and for that, I'm going to have to find a long time slot for this, and that might take some time. It would be great if you could, e.g., expand the result of all those macros, and chunk it down to a dependency free code / function that shows the issue. If you provide a test case that feeds it raw input bytes or similar that trigger the issue, that would be great. With something like that, I might be able to find out what's wrong and fix it in a 15min or 30 min slot, which would mean I'd get to this sooner. Hope that makes sense. If you don't manage to chunk this down more, I'd try to look into this ASAP anyways, but am currently not sure when that will be. |
I am new to these issues but I can try to debug. @gnzlbg Any recommendations before putting me? |
You can try to use So in this first step, you'd end up with a pretty big Then you can try to remove all the unused stuff, and simplify the code while making sure that the issue is still reproduced. |
OK thank you very much. I have already taken it apart, with the case of the add + cmpgt which is the one that should give performance problems. https://github.com/rust-iendo/bench_stdsimd/blob/master/src/debug.rs |
|
Ok, whatever, I thought it was indifferent as long as it launched with a processor with this flag. |
It is indifferent if you compile with |
It does not solve it, the attribute is set in the library. https://github.com/rust-iendo/v_htmlescape/blob/master/v_escape/src/ranges/mod.rs#L13 |
I put a daily CRON in the travis. The results, according to my criteria, reflect that the error is located in the function I do not know, I attached the link. https://travis-ci.org/rust-iendo/v_htmlescape/jobs/502697796#L1525 Functions
Thanks for your time. |
This is still blocked on the test case being reduced even further. |
Ok, I will try to reduce it to the minimum. Thanks again. |
In version 1.35 the problem is not observed, https://travis-ci.org/rust-iendo/v_htmlescape/jobs/515338745#L1355 . Step to close. thanks for your patience. |
Lost 4 times the performance in
avx2
with the same sources of previous version. This error is random from the new stable version 1.32.0 (9fda7c223 2019-01-16).The algorithm in
avx2
usescmpeq_epi8
,cmpgt_epi8
,or
andadd_epi8
for comparisons andloadu
,load
,set1_epi8
,movemask_epi8
for move memory.The text was updated successfully, but these errors were encountered: