Closed Bug 1228579 Opened 9 years ago Closed 9 years ago

BacktrackingAllocator: computeSpillWeight does a lot of L1 cache misses.

Categories

(Core :: JavaScript Engine: JIT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox45 --- affected
firefox46 --- fixed

People

(Reporter: nbp, Assigned: nbp)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

I profiled the BacktrackingAllocator within callgrind with almost everything enabled.  The result highlighted that BacktrackingAllocator::computeSpillWeight does a lot of L1 cache misses (37% of GenerateLIR cache misses), including one line which represents 72% of the cache misses of this function.

Which means that this one line is accountable for ~27% of the L1 cache misses of GenerateLIR.  More over, we approximately use 14 bytes (because multiples structures might be adjacent) per cache line.

We should figure a different way of storing/computing data such that we improve our cache usage in BacktrackingAllocator::computeSpillWeight.
Blocks: 1229043
This patch removes 25.5% of the L1 cache misses under GenerateLIR. This
patch avoid loading new cache lines by making a copy of the LUse::Policy on
the UsePosition structure.  Thus we no longer have to access the content of
the LUse pointer, only for reading the policy bits out of it.

This patch removed a bit more than half of the cache misses of the
computeSpillWeight function, the remaining cache misses are caused by random
accesses of the UsePosition structures.  This is another issue which should
probably be solved by improving the data locality of the UsePosition list elements.
Comment on attachment 8693775 [details] [diff] [review]
BacktrackingAllocator: Pack the LUse::Policy next to the LUse pointer of UsePosition.

(works better with a reviewer)
Attachment #8693775 - Flags: review?(bhackett1024)
Comment on attachment 8693775 [details] [diff] [review]
BacktrackingAllocator: Pack the LUse::Policy next to the LUse pointer of UsePosition.

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

Cool!

::: js/src/jit/BacktrackingAllocator.h
@@ +148,4 @@
>      CodePosition pos;
>  
> +    LUse* use() const {
> +        // printf("UsePosition::use: %p %p %x\n", this, use_, use_->policy());

rm
Attachment #8693775 - Flags: review?(bhackett1024) → review+
https://hg.mozilla.org/mozilla-central/rev/66921f340b4c
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: