Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upbabylon drumming demo thrashes the ion JIT #25971
Comments
|
The following script shows a hotspot of compiling and a really long tail of scripts that get compiled once: import sys
scripts = {}
with open(sys.argv[1]) as f:
for line in f.readlines():
if not line.startswith('[IonScripts]'):
continue
print(line)
if 'Compiling' in line:
script = line.split()[3]
if not script in scripts:
scripts[script] = 0
scripts[script] += 1
ordered = sorted(scripts.items(), key=lambda item: item[1])
for (script, count) in ordered:
print(script.split('/')[-1] + ": " + str(count))
|
|
One set of frequent bailouts turns out to be calling |
|
The following script identifies the most common invalidations from a log with import sys
scripts = {}
with open(sys.argv[1]) as f:
for line in f.readlines():
if not line.startswith('[IonInvalidate]'):
continue
print(line)
if 'Invalidate ' in line:
script = line.split()[2]
if not script in scripts:
scripts[script] = 0
scripts[script] += 1
ordered = sorted(scripts.items(), key=lambda item: item[1])
for (script, count) in ordered:
print(script.split('/')[-1] + ": " + str(count)) |
|
I've written up my steps for diagnosing so far as https://github.com/servo/servo/wiki/Diagnosing-SpiderMonkey-JIT-issues. |
|
We've tracked this down to a reproducible bailout in the spidermonkey arm64 simulator running this snippet: var intensity = 1;
var Color3 = function(r) {
this.r = r;
};
Color3.prototype.scale = function(t) {
this.r = this.r * t;
};
var groundColor = new Color3(0);
for (var i = 0; i < 10000; i++) {
groundColor.scale(intensity);
}This means there's a codegen bug in ionmonkey in the arm64 backend for integer multiplication, and a JS team member is looking into it. |
|
Turns out this TODO has significant implications: "the answer to your puzzle appears to be "ionmonkey is incredibly dumb on arm64 when compiling integer multiplications that produce zero"" |
|
The patch from https://phabricator.services.mozilla.com/D67485 lets us hit ~40 FPS once the JIT settles down after a few seconds. |
Here's the jitspew output when I run the demo (even when it's showing the default view in windowed mode with no change in rendering):