6.8% regression on Kraken-imaging-darkroom (Windows) and 8.5% on gaussian-blur (Linux) on 7Aug2025
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr128 | --- | unaffected |
| firefox-esr140 | --- | unaffected |
| firefox141 | --- | unaffected |
| firefox142 | --- | unaffected |
| firefox143 | --- | fixed |
People
(Reporter: mayankleoboy1, Assigned: jandem)
References
(Regression)
Details
(Keywords: regression)
Attachments
(2 files)
Suspect: bug 1981133 (backfills in progress)
Given the magnitude of improvements I dont think this regsression is serious. But filing for posterity.
| Reporter | ||
Comment 1•1 year ago
|
||
bisection confirmed bug 1981133 as the regressor.
Comment 2•1 year ago
|
||
Set release status flags based on info from the regressing bug 1981133
:jandem, since you are the author of the regressor, bug 1981133, could you take a look? Also, could you set the severity field?
For more information, please visit BugBot documentation.
Updated•1 year ago
|
| Assignee | ||
Comment 3•1 year ago
|
||
Very interesting. I can reproduce the regression locally. Our machine code looks more compact now, but we're slower. It seems related to this code:
function FastLog2(x) {
return Math.log(x) / Math.LN2;
}
var LOG2_HALF = FastLog2(0.5);
function FastBias(b, x) {
return Math.pow(x, FastLog2(b) / LOG2_HALF);
}
We inline FastLog2 into FastBias.
With my constant-global optimization, the JIT knows that LOG2_HALF is -1, so we can turn the Div instruction into a NegD instruction:
[MathD:Div]
vdivsd %xmm1, %xmm0, %xmm1
==>
[NegD]
pcmpeqw %xmm15, %xmm15
psllq $63, %xmm15
xorpd %xmm15, %xmm0
This is fine but it results in a small register allocation difference further down:
[PowD]
vmovapd %xmm2, %xmm0
call .Lfrom549
==>
[PowD]
xorpd %xmm0, %xmm1
xorpd %xmm1, %xmm0
xorpd %xmm0, %xmm1
call .Lfrom440
Apparently the CPU doesn't like this XOR-swap idiom. If I comment out that optimization we're faster locally, even though the swap now goes through memory instead of using the scratch double register..
| Reporter | ||
Comment 4•1 year ago
•
|
||
Linux,
- it is 6.5% improvement.
- BUT a 8.5% regression on gaussian-blur
OSX1470
- 10.4% regression on darkroom
- 3.7% improvement on desaturate
| Reporter | ||
Updated•1 year ago
|
| Assignee | ||
Comment 5•1 year ago
|
||
This fixes the imaging-darkroom regression in the bug and eliminates a third of all
resource-stalls according to perf. Baking in global constants is now an improvement
on that test.
Wikipedia also mentions that XOR-swap can be slower than plain moves on modern CPUs:
https://en.wikipedia.org/wiki/XOR_swap_algorithm#Reasons_for_avoidance_in_practice
Most 'optimized cycles' have a swapCount of 1 but other cases do show up
and it's pretty easy to handle them too. This avoids falling back to a memory
slot.
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 7•1 year ago
|
||
I found another codegen problem with gaussian-blur. We're now generating extra code for MKeepAliveObject, to load the constant object into a register that then isn't used anywhere. This has a pretty large effect on # of cycles and getting rid of that makes the test > 15% faster locally...
Comment 8•1 year ago
|
||
| bugherder | ||
| Reporter | ||
Comment 9•1 year ago
•
|
||
(In reply to Pulsebot from comment #6)
Pushed by jdemooij@mozilla.com:
https://github.com/mozilla-firefox/firefox/commit/d457a2ad7b56
https://hg.mozilla.org/integration/autoland/rev/e02c6e10f828
Don't use XOR-swap idiom for simple float register cycles. r=iain
Win: Lead to a 14% improvement on the regression, which is also a 8% improvement on the baseline.
OSX: 17.6% improvement on regerssion, which is also a 7% improvement on baseline
Win: 2.9% improvement in Jetstream3-gaussian-blur
| Assignee | ||
Comment 10•1 year ago
|
||
The check for constants failed for the data array in the gaussian-blur test
because it was wrapped by MGuardShape.
Also add a check for nursery objects because it's a similar case.
| Assignee | ||
Updated•1 year ago
|
Comment 11•1 year ago
|
||
| Reporter | ||
Comment 12•1 year ago
|
||
(In reply to Pulsebot from comment #11)
Pushed by jdemooij@mozilla.com:
https://github.com/mozilla-firefox/firefox/commit/9763f5ef0a1a
https://hg.mozilla.org/integration/autoland/rev/2e49fc049de0
Improve check for constants in AddKeepAliveInstructions. r=iain
18.1% improvement on regression numbers on gaussian-blur only on Linux, which is a 2.5% on pre-baseline numbers.
Comment 13•1 year ago
|
||
| bugherder | ||
Updated•1 year ago
|
Description
•