Skip to content

Commit c4e7370

Browse files
committed
Add HTML for codesize and gisel.
Change-Id: I4f4d3b60643fe185cf31e22ace00a23555a0176b
1 parent 0496625 commit c4e7370

File tree

2 files changed

+280
-0
lines changed

2 files changed

+280
-0
lines changed

codesize.html

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8">
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
5+
<title>AArch64 Cost model tests</title>
6+
<script>
7+
document.addEventListener("DOMContentLoaded", function() {
8+
fetch("data-int.json")
9+
.then(response => response.json())
10+
.then(json => drawTable(json, 'int'))
11+
.catch(reason => console.log(reason));
12+
fetch("data-fp.json")
13+
.then(response => response.json())
14+
.then(json => drawTable(json, 'fp'))
15+
.catch(reason => console.log(reason));
16+
});
17+
18+
function drawTable(json, label) {
19+
var instrs = {};
20+
var tys = []
21+
json.forEach(j => {
22+
instrs[j.instr] ??= {};
23+
instrs[j.instr][j.variant] ??= {};
24+
instrs[j.instr][j.variant][j.ty] = j
25+
if (!tys.includes(j.ty))
26+
tys.push(j.ty);
27+
});
28+
29+
var table = document.getElementById('table-'+label)
30+
while (table.childNodes.length != 0)
31+
table.removeChild(table.childNodes[0]);
32+
33+
head = table.createTHead();
34+
tr = head.insertRow(0);
35+
tr.insertCell().outerHTML = "<th>Instr</th>"
36+
tr.insertCell().outerHTML = "<th>Variant</th>"
37+
for (var ty in tys) {
38+
tr.insertCell().outerHTML = "<th>"+tys[ty]+"</th>"
39+
}
40+
41+
body = table.createTBody();
42+
for (var instr in instrs) {
43+
var first = true
44+
for (var variant in instrs[instr]) {
45+
tr = body.insertRow();
46+
if (first) {
47+
console.log(Object.keys(instrs[instr]).length)
48+
console.log(instrs[instr])
49+
tr.insertCell().outerHTML = "<th rowspan='"+Object.keys(instrs[instr]).length+"' valign='top'>"+instr+"</th>"
50+
first = false
51+
}
52+
tr.insertCell().outerHTML = "<th>"+variant+"</th>"
53+
for (var ty in tys) {
54+
cell = tr.insertCell()
55+
j = instrs[instr][variant][tys[ty]]
56+
if (!j) {
57+
cell.innerHTML = "-"
58+
} else {
59+
cell.innerHTML = j.codesize - j.size
60+
cell.onclick = function() {
61+
let _j = j
62+
let _label = label
63+
return function() { drawDetails(_label, _j); }
64+
}()
65+
}
66+
}
67+
}
68+
}
69+
}
70+
71+
function escape(s) {
72+
return s.replaceAll('<','&lt;').replaceAll('>','&gt;').replaceAll('#', '\#')
73+
}
74+
75+
function drawDetails(label, j) {
76+
var details = document.getElementById('details-'+label);
77+
txt = "<h3>Details</h3>"
78+
txt += j.instr + " " + j.variant + " " + j.ty + "\n";
79+
txt += "Codesize cost:"+j.codesize+"\n"
80+
txt += "Measured size:"+j.size+" (gisize:"+j.gisize+")\n"
81+
txt += "Othercosts: thru:"+j.thru+" lat:"+j.lat+" sizelat:"+j.sizelat+"\n"
82+
txt += "\nIR:\n<code>"+escape(j.ll)+"</code>\n"
83+
txt += "\nAsm:\n<code>"+escape(j.asm)+"</code>\n"
84+
txt += "\nCodesize cost output:\n<code>"+escape(j.costoutput)+"</code>\n"
85+
details.innerHTML = txt.replaceAll('\n', '<br>');
86+
}
87+
</script>
88+
<style>
89+
h1 {
90+
font-family: verdana;
91+
font-size: 24px;
92+
}
93+
h3 {
94+
font-family: verdana;
95+
font-size: 20px;
96+
}
97+
table {
98+
width: 60%;
99+
margin: 10px auto;
100+
border-collapse: collapse;
101+
background: white;
102+
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
103+
}
104+
th, td {
105+
padding: 10px;
106+
border: 1px solid #ddd;
107+
text-align: left;
108+
}
109+
th {
110+
background-color: #4c79aa;
111+
color: white;
112+
}
113+
tr:nth-child(even) {
114+
background-color: #f2f2f2;
115+
}
116+
td:hover {
117+
background-color: #ddd;
118+
}
119+
code {
120+
font-family: Consolas,"courier new";
121+
}
122+
</style>
123+
</head>
124+
<body>
125+
<h1>Cost model tests</h1>
126+
<p>This attempts to compare the first-order output of the cost model compared to the measured codesize. It generates simple snippets of IR and compares the output of opt -passes=print<cost-model> -cost-kind=codesize and the assembly generated from llc. The assembly output of llc is sometimes filtered to remove loop invariant instructions.</p>
127+
<p>The table lists the difference between the two cost models (i.e. zero is good). Not all the scores are expected to match exactly. More details and the costs can be found by clicking on a table entry.</p>
128+
<h3>Integer errors</h3>
129+
<div style="display: flex;">
130+
<div width="60%"><table id="table-int" class="dataframe" border="1"><th>Loading</th></table></div>
131+
<div width="40%" style="white-space: pre; padding: 10px;" id="details-int"><h3>Details</h3></div>
132+
</div>
133+
<h3>FP errors</h3>
134+
<div style="display: flex;">
135+
<div width="60%"><table id="table-fp" class="dataframe" border="1"><th>Loading</th></table></div>
136+
<div width="40%" style="white-space: pre; padding: 10px;" id="details-fp"><h3>Details</h3></div>
137+
</div>
138+
</body>
139+
</html>
140+

gisel.html

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
<html>
2+
<head>
3+
<meta charset="UTF-8">
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
5+
<title>AArch64 GISel coverage tests</title>
6+
<script>
7+
document.addEventListener("DOMContentLoaded", function() {
8+
fetch("data-int.json")
9+
.then(response => response.json())
10+
.then(json => drawTable(json, 'int'))
11+
.catch(reason => console.log(reason));
12+
fetch("data-fp.json")
13+
.then(response => response.json())
14+
.then(json => drawTable(json, 'fp'))
15+
.catch(reason => console.log(reason));
16+
});
17+
18+
function drawTable(json, label) {
19+
var instrs = {};
20+
var tys = []
21+
json.forEach(j => {
22+
instrs[j.instr] ??= {};
23+
instrs[j.instr][j.variant] ??= {};
24+
instrs[j.instr][j.variant][j.ty] = j
25+
if (!tys.includes(j.ty))
26+
tys.push(j.ty);
27+
});
28+
29+
var table = document.getElementById('table-'+label)
30+
while (table.childNodes.length != 0)
31+
table.removeChild(table.childNodes[0]);
32+
33+
head = table.createTHead();
34+
tr = head.insertRow(0);
35+
tr.insertCell().outerHTML = "<th>Instr</th>"
36+
tr.insertCell().outerHTML = "<th>Variant</th>"
37+
for (var ty in tys) {
38+
tr.insertCell().outerHTML = "<th>"+tys[ty]+"</th>"
39+
}
40+
41+
body = table.createTBody();
42+
for (var instr in instrs) {
43+
var first = true
44+
for (var variant in instrs[instr]) {
45+
tr = body.insertRow();
46+
if (first) {
47+
tr.insertCell().outerHTML = "<th rowspan='"+Object.keys(instrs[instr]).length+"' valign='top'>"+instr+"</th>"
48+
first = false
49+
}
50+
tr.insertCell().outerHTML = "<th>"+variant+"</th>"
51+
for (var ty in tys) {
52+
cell = tr.insertCell()
53+
j = instrs[instr][variant][tys[ty]]
54+
if (!j) {
55+
cell.innerHTML = "-"
56+
} else {
57+
if (j.gisize == "-1")
58+
cell.innerHTML = "Error"
59+
else
60+
cell.innerHTML = j.gisize - j.size
61+
cell.onclick = function() {
62+
let _j = j
63+
let _label = label
64+
return function() { drawDetails(_label, _j); }
65+
}()
66+
}
67+
}
68+
}
69+
}
70+
}
71+
72+
function escape(s) {
73+
return s.replaceAll('<','&lt;').replaceAll('>','&gt;').replaceAll('#', '\#')
74+
}
75+
76+
function drawDetails(label, j) {
77+
var details = document.getElementById('details-'+label);
78+
txt = "<h3>Details</h3>"
79+
txt += j.instr + " " + j.variant + " " + j.ty + "\n";
80+
txt += "Measured size:"+j.size+"\n"
81+
txt += "GISel gisize:"+j.gisize+"\n"
82+
txt += "(Costs: thru:"+j.thru+" codesize:"+j.codesize+" lat:"+j.lat+" sizelat:"+j.sizelat+"\n"
83+
txt += "\nIR:\n<code>"+escape(j.ll)+"</code>\n"
84+
txt += "\nAsm:\n<code>"+escape(j.asm)+"</code>\n"
85+
txt += "\nGISel:\n<code>"+escape(j.giasm)+"</code>\n"
86+
details.innerHTML = txt.replaceAll('\n', '<br>');
87+
}
88+
</script>
89+
<style>
90+
h1 {
91+
font-family: verdana;
92+
font-size: 24px;
93+
}
94+
h3 {
95+
font-family: verdana;
96+
font-size: 20px;
97+
}
98+
table {
99+
width: 60%;
100+
margin: 10px auto;
101+
border-collapse: collapse;
102+
background: white;
103+
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
104+
}
105+
th, td {
106+
padding: 10px;
107+
border: 1px solid #ddd;
108+
text-align: left;
109+
}
110+
th {
111+
background-color: #4c79aa;
112+
color: white;
113+
}
114+
tr:nth-child(even) {
115+
background-color: #f2f2f2;
116+
}
117+
td:hover {
118+
background-color: #ddd;
119+
}
120+
code {
121+
font-family: Consolas,"courier new";
122+
}
123+
</style>
124+
</head>
125+
<body>
126+
<h1>AArch64 GISel coverage tests</h1>
127+
<p>The table lists the difference between the number of instructions generated from gisel vs sdag (+ve means gisel is worse). More details and the asm can be found by clicking on a table entry.</p>
128+
<h3>Integer errors</h3>
129+
<div style="display: flex;">
130+
<div width="60%"><table id="table-int" class="dataframe" border="1"><th>Loading</th></table></div>
131+
<div width="40%" style="white-space: pre; padding: 10px;" id="details-int"><h3>Details</h3></div>
132+
</div>
133+
<h3>FP errors</h3>
134+
<div style="display: flex;">
135+
<div width="60%"><table id="table-fp" class="dataframe" border="1"><th>Loading</th></table></div>
136+
<div width="40%" style="white-space: pre; padding: 10px;" id="details-fp"><h3>Details</h3></div>
137+
</div>
138+
</body>
139+
</html>
140+

0 commit comments

Comments
 (0)