fn fguv_32x32xn_rust: fix performance regression introduced in 6751f65c - #558
fn fguv_32x32xn_rust: fix performance regression introduced in 6751f65c#558fbossen wants to merge 1 commit into
fn fguv_32x32xn_rust: fix performance regression introduced in 6751f65c#558Conversation
fn fguv_32x32xn_rust: fix performance regression introduced in 6751f65cfn fguv_32x32xn_rust: fix performance regression introduced in 6751f65c
fn fguv_32x32xn_rust: fix performance regression introduced in 6751f65cfn fguv_32x32xn_rust: fix performance regression introduced in 6751f65c
Hmm, that's pretty weird. fc5dbe2 I didn't really change anything except move everything into a closure, but the code is doing the same thing. Maybe it wasn't inlined? Do you know how to mark a closure as |
I'm not sure what specifically caused the slowdown here but in general, it is harder for a compiler to optimize across function boundaries. It is nice that Frank was able to fix the regression while keeping the closure in this case. However, sometimes it is perfectly fine not to eliminate duplication especially on hot code paths. Once you need three copies of something, it's usually time to deduplicate. |
|
For fc5dbe2 adding |
I added the closure to match the C, which used a macro here, and it was duplicated 4 times each (and it's a good sized chunk of code). Perhaps an inner |
The fix in this PR doesn't do anything with |
That would most likely work. I was just going for the fewest changes here. The |
Okay, I'll check what works. If the argument is limited to 0 and 1, I'd prefer to make the argument a As for benchmarking, you're doing this on |
aarch64 on macOS |
Oh yeah. I'm not sure how to cross-compile to I just opened #559 to fix the Are you sure the closure is the problem here and not just the bounds checks? For me, on |
|
So attributes like
That's been unstable for a long time, though. |
Yeah, #559 and #560 are meant to supercede this PR by fixing the same performance regressions more cleanly/thoroughly. I'll close this one now. |
…ession (#560) This elides bounds checks from indexing with `val` by clipping the index to a valid one. Initially, I copied #558's approach, which uses `cmp::min(val, scaling.as_ref().len() - 1)`, and this removes 3 bounds checks. But since the scaling size is a `const` and is `1 << BD::SCALING_BITS`, we can just truncate the other bits with `&`, which avoids a `csel` and 2 more bounds checks.
No description provided.