Closed Bug 1184388 Opened 9 years ago Closed 9 years ago

270% Kraken crypto-aes regression caused by eager unboxing analysis for large array literals

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox42 --- affected
firefox43 --- fixed

People

(Reporter: till, Assigned: bhackett1024)

References

Details

Attachments

(3 files, 1 obsolete file)

A few other tests maybe also regressed, but this one certainly did.

Details:
A regression/improvement was reported on AWFY:
- slave: Mac OS X 10.10 32-bit (Mac Pro, shell)
- mode: Ion, unboxed objects

Regression(s)/Improvement(s):
- kraken: 14.93% (regression)
- asmjs-ubench: life: -0.73% (improvement)
- kraken: gaussian-blur: -5.15% (improvement)
- kraken: darkroom: 2.73% (regression)
- kraken: desaturate: 5.99% (regression)
- kraken: crypto-aes: 273.12% (regression)
- octane: Richards: 1.83% (improvement)
- octane: Crypto: -2.28% (regression)
- octane: Typescript: -2.55% (regression)

Recorded range:
- http://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=53ffaa2b1ce2&tochange=b32e6d86fd89

More details: http://arewefastyet.com/regressions/#/regression/1792290
Flags: needinfo?(bhackett1024)
Attached patch patch (obsolete) — Splinter Review
We're using unboxed arrays in more places in this benchmark now, and some hot access sites are polymorphic on arrays that are either unboxed int32 arrays or unboxed double arrays.  We end up emitting element caches for these, which are really slow (even if everything happens in jitcode).  There isn't a good, easy fix for this, unfortunately.  A more specialized instruction that can get elements from arrays with multiple different layouts would be faster than caches, but still a lot slower than plain inline accesses.  If we could generate multiple copies of a loop depending on the layouts of the arrays it manipulates that would be really nifty, but also a big departure from IonMonkey's design (though maybe not too different from loop unrolling, which we already support).  This patch goes for an easier solution, though, which just converts unboxed arrays to their native representation if we find multiple different array layouts at an access site during Ion compilation.  This reduces the slowdown for --unboxed-arrays vs. normal behavior on kraken-stanford-crypto-aes to 30% or so (x86 10.9).  I'll write more patches to try to address the remaining regression.
Assignee: nobody → bhackett1024
Flags: needinfo?(bhackett1024)
Attachment #8645191 - Flags: review?(jdemooij)
Comment on attachment 8645191 [details] [diff] [review]
patch

After more tinkering, I don't think this is a good approach; we should try to keep things unboxed where possible and doing it more often opens up a can of worms.

The reason we are seeing polymorphic sites in this benchmark seems to be because the benchmark creates a giant literal which contains objects which can have either unboxed int32 arrays or unboxed double arrays for certain properties.  I'm going to try a more targeted fix that tries to give such structures more homogenous contents.
Attachment #8645191 - Flags: review?(jdemooij)
(In reply to Brian Hackett (:bhackett) from comment #2)
> After more tinkering, I don't think this is a good approach; we should try
> to keep things unboxed where possible and doing it more often opens up a can
> of worms.

Bleh, "doing it" == "converting objects to natives"
Attached patch patchSplinter Review
Here's a more targeted patch to improve parsing of literals like:

[ [1,2,3,4], [1.5,2.5,3.5,4.5] ]

and:

[ {p:[1,2,3,4]}, {p:[1.5,2.5,3.5,4.5]} ]

So that the inner arrays in the multidimensional array have a consistent group and unboxed/native layout.  With this change, stanford-crypto-aes runs at about the same speed with/without unboxed arrays.
Attachment #8645191 - Attachment is obsolete: true
Attachment #8645517 - Flags: review?(jdemooij)
Attachment #8645517 - Flags: review?(jdemooij) → review+
https://hg.mozilla.org/mozilla-central/rev/25b53d012913
Status: NEW → RESOLVED
Closed: 9 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
Attached patch followupSplinter Review
Here is a followup patch to fix a crash that is now happening on the kraken benchmark with --unboxed-arrays.
Attachment #8651845 - Flags: review?(jdemooij)
Comment on attachment 8651845 [details] [diff] [review]
followup

Review of attachment 8651845 [details] [diff] [review]:
-----------------------------------------------------------------

Makes sense.
Attachment #8651845 - Flags: review?(jdemooij) → review+
Attached patch followup #2Splinter Review
In another followup, the original patch transposed the arguments to GiveObjectGroup at all its call sites.  CombinePlainObjectPropertyTypes would work as expected when running stanford-crypto-aes by itself, but in the full shell harness the structures would still end up with heterogenous layouts.
Attachment #8652920 - Flags: review?(jdemooij)
Attachment #8652920 - Flags: review?(jdemooij) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: