Simple ParallelArray workload using Math.abs bails out only when using more then 2 threads

RESOLVED FIXED in mozilla26

Status

()

RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: masterofhats, Assigned: shu)

Tracking

Other Branch
mozilla26
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [PJS])

Attachments

(2 attachments)

(Reporter)

Description

5 years ago
Created attachment 785931 [details]
simple workload to test

When running the simple test case

var a = [];
 
for (var i = 0; i < 50000; ++i) {
  a[i] = Math.random();
}
 
var pa = new ParallelArray(a);

pa.map(function(x) {
  return Math.abs(x);
});

the workloads runs fine if JS_THREADPOOL_SIZE is set to a value <=2. For more than two threads, the workload bails out with the following error(s):

[Parallel:M]   Compilation complete (final worklist length 1)
[^[[7m^[[34mParallel:3^[[0m]   Up
[^[[7m^[[34mParallel:3^[[0m]   ^[[33mBailout^[[0m: AbortPar / ^[[36mAbortPar^[[0m (block 11 lir 94) (PAabs.js:2)
[^[[7m^[[34mParallel:3^[[0m]   Parallel abort with cause 12 in 7f05fc555700:self-hosted:3760 (7f05fc555c40:PAabs.js:1 at line 2)
[^[[7m^[[32mParallel:1^[[0m]   Up
[^[[7m^[[32mParallel:1^[[0m]   ^[[33mBailout^[[0m: CheckOverRecursedPar / ^[[36mCheckOverRecursedPar^[[0m (block 0 lir 14) (self-hosted:3761)
[^[[7m^[[32mParallel:1^[[0m]   Propagate parallel abort via 7f05fc555700:self-hosted:3760 (7f05fc555700:self-hosted:3760)
[^[[7m^[[34mParallel:3^[[0m]   Down
[^[[7m^[[32mParallel:1^[[0m]   Down
[^[[7m^[[31mParallel:0^[[0m]   Up
[^[[7m^[[31mParallel:0^[[0m]   ^[[33mBailout^[[0m: CheckOverRecursedPar / ^[[36mCheckOverRecursedPar^[[0m (block 0 lir 14) (self-hosted:3761)
[^[[7m^[[31mParallel:0^[[0m]   Propagate parallel abort via 7f05fc555700:self-hosted:3760 (7f05fc555700:self-hosted:3760)
[^[[7m^[[31mParallel:0^[[0m]   Down
[^[[7m^[[33mParallel:2^[[0m]   Up
[^[[7m^[[33mParallel:2^[[0m]   ^[[33mBailout^[[0m: CheckOverRecursedPar / ^[[36mCheckOverRecursedPar^[[0m (block 0 lir 14) (self-hosted:3761)
[^[[7m^[[33mParallel:2^[[0m]   Propagate parallel abort via 7f05fc555700:self-hosted:3760 (7f05fc555700:self-hosted:3760)
[^[[7m^[[33mParallel:2^[[0m]   Down
PAabs.js:1:0 warning: Bailed out of parallel operation: unsupported at PAabs.js:2
[Parallel:M]   Bailout from thread 3: cause 12 at loc PAabs.js:2
[Parallel:M]   ^[[1m^[[33mBAILOUT 1^[[0m: 12 at PAabs.js:2:2
[Parallel:M]   Enqueued 7f05fc555700:self-hosted:3760
[Parallel:M]   Bailout from thread 0: cause 0, topScript 7f05fc555700:self-hosted:3760
[Parallel:M]   Invalidating script 7f05fc555700:self-hosted:3760 due to cause 0
[Parallel:M]   Skipping 7f05fc555700:self-hosted:3760, already in worklist
[Parallel:M]   Bailout from thread 1: cause 0, topScript 7f05fc555700:self-hosted:3760
[Parallel:M]   Bailout from thread 2: cause 0, topScript 7f05fc555700:self-hosted:3760
[Parallel:M]   Bailout from thread 3: cause 12, topScript 7f05fc555700:self-hosted:3760
(Reporter)

Updated

5 years ago
Blocks: 801869
Whiteboard: [PJS]
(Assignee)

Comment 1

5 years ago
Created attachment 786650 [details] [diff] [review]
bug901676-mergetypes-assoc.patch

This bug is because:
 - Math.abs not being able to be inlined, because
 - its input MIRType is Value, because...
 - it is the result of merging types for a phi, because...
 - ion::MergeTypes is not associative with respect to empty type sets.

Suppose there are two values v1, v2. v1 has a MIRType of Value and an empty typeset. v2 has a MIRType of T where T is not Value, and has a non-empty typeset. MergeTypes will specialize phi(v1, v2) to Value, but phi(v2, v1) to T.
Assignee: general → shu
Attachment #786650 - Flags: review?(bhackett1024)
Comment on attachment 786650 [details] [diff] [review]
bug901676-mergetypes-assoc.patch

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

Good catch, I think I've added workarounds for this at several times in the past without investigating why the MIRTypes on the phis were unnecessarily imprecise.
Attachment #786650 - Flags: review?(bhackett1024) → review+
https://hg.mozilla.org/mozilla-central/rev/b18be598f92e
Status: UNCONFIRMED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in before you can comment on or make changes to this bug.