|
| 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('<','<').replaceAll('>','>').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 | + |
0 commit comments