Skip to content

Commit

Permalink
new check boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
oflatt committed Feb 6, 2025
1 parent addf9c5 commit 5eba591
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 31 deletions.
2 changes: 1 addition & 1 deletion infra/nightly-resources/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function parseDataForChart() {
data[mode] = {};
benchmarks.forEach((benchmark) => {
const entry = getEntry(benchmark, mode);
if (entry) {
if (entry && GLOBAL_DATA.enabledSuites.has(entry.suite)) {
data[mode][benchmark] = {
mode: mode,
benchmark: benchmark,
Expand Down
9 changes: 4 additions & 5 deletions infra/nightly-resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ <h2>Nightlies</h2>
<button onclick="selectAllModes(false)">Select None</button>
</div>
<div id="modeCheckboxes"></div>
<div id="suiteCheckboxes"></div>
</div>
<div class="filters">
<div>
Expand Down Expand Up @@ -84,12 +85,10 @@ <h2> Latex Macros </h2>



<h2>Overall Stats</h2>
<t>Warning: compile-time statistics are not very trustworthy in parallel mode.</t>
<div id="overall-stats-table"></div>
<div id="tables"></div>



<h2>Detailed Table</h2>
<div id="profile"></div>
</div>
<h2>Raw</h2>
<p>
Expand Down
65 changes: 50 additions & 15 deletions infra/nightly-resources/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const treatments = [

const GLOBAL_DATA = {
enabledModes: new Set(),
enabledSuites: new Set(),
enabledBenchmarks: new Set(),
warnings: new Set(),
currentRun: [],
Expand All @@ -33,11 +34,11 @@ function clearWarnings() {
GLOBAL_DATA.warnings.clear();
}

function addTableTo(element, data) {
// clear elements in element
while (element.firstChild) {
element.removeChild(element.firstChild);
}
function addTableTo(element, data, title) {
// add a h2 element with the title
const h2 = document.createElement("h2");
h2.innerText = title;
element.appendChild(h2);

// add a button that copies latex for table
const copyButton = document.createElement("button");
Expand All @@ -64,13 +65,11 @@ function addTableTo(element, data) {
element.appendChild(tableDiv);
}

function refreshView() {
if (!GLOBAL_DATA.baselineRun) {
addWarning("no baseline to compare to");
}

function tableForSuite(suite) {
const byBench = {};
GLOBAL_DATA.enabledBenchmarks.forEach((benchmark) => {
Array.from(GLOBAL_DATA.enabledBenchmarks)
.filter((benchmark) => getRow(benchmark, BASELINE_MODE).suite === suite)
.forEach((benchmark) => {
byBench[benchmark] = getDataForBenchmark(benchmark);
});
const tableData = Object.keys(byBench).map((bench) => ({
Expand All @@ -80,15 +79,42 @@ function refreshView() {
executions: { data: byBench[bench] },
}));
tableData.sort((l, r) => l.name - r.name);
return tableData;
}


function dedup(arr) {
return Array.from(new Set(arr));
}

function getSuites() {
return dedup(GLOBAL_DATA.currentRun).map((benchmark) => benchmark.suite);
}


function refreshView() {
if (!GLOBAL_DATA.baselineRun) {
addWarning("no baseline to compare to");
}

addTableTo(document.getElementById("profile"), tableData);
// clear the tables element
while (document.getElementById("tables").firstChild) {
document.getElementById("tables").removeChild(document.getElementById("tables").firstChild);
}

// fill in the overall stats table
const overallStats = getOverallStatistics();
console.log(overallStats);

const overallTable = document.getElementById("overall-stats-table");
addTableTo(overallTable, overallStats);
addTableTo(document.getElementById("tables"), overallStats, "Overall Stats");


for (const suite of getSuites()) {
const tableData = tableForSuite(suite);
addTableTo(document.getElementById("tables"), tableData, suite + " Stats");
}




renderWarnings();
refreshChart();
Expand Down Expand Up @@ -136,6 +162,15 @@ function makeSelectors() {
checkbox.onchange = () => toggleCheckbox(mode, GLOBAL_DATA.enabledModes);
});

const suites = getSuites();
suites.forEach((suite) => {
const checkbox = makeCheckbox(
document.getElementById("suiteCheckboxes"),
suite,
);
checkbox.onchange = () => toggleCheckbox(suite, GLOBAL_DATA.enabledSuites);
});

const benchmarks = Array.from(
new Set(GLOBAL_DATA.currentRun.map((o) => o.benchmark)),
).sort();
Expand Down
39 changes: 29 additions & 10 deletions infra/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,21 +192,40 @@ def should_have_llvm_ir(runMethod):
"llvm-eggcc-O3-O0",
]

def get_suite(path):
# get the absolute path to the benchmark
benchmark_path = os.path.abspath(path)
suite_name = "unknown"

while not os.path.basename(benchmark_path) == "passing":
suite_name = os.path.basename(benchmark_path)
print(f"Suite name: {suite_name}")
# go up one dir
benchmark_path = os.path.dirname(benchmark_path)

# if we are at the root, break
if benchmark_path == "/":
suite_name = "unknown"
break
return suite_name



# aggregate all profile info into a single json array.
def aggregate(compile_data, bench_times, paths):
res = []
res = []

for path in sorted(compile_data.keys()):
name = path.split("/")[-2]
runMethod = path.split("/")[-1]
result = {"runMethod": runMethod, "benchmark": name, "cycles": bench_times[path], "path": paths[name]}
for path in sorted(compile_data.keys()):
name = path.split("/")[-2]
runMethod = path.split("/")[-1]
result = {"runMethod": runMethod, "benchmark": name, "cycles": bench_times[path], "path": paths[name], "suite": get_suite(paths[name])}

# add compile time info
for key in compile_data[path]:
result[key] = compile_data[path][key]
# add compile time info
for key in compile_data[path]:
result[key] = compile_data[path][key]

res.append(result)
return res
res.append(result)
return res

if __name__ == '__main__':
# expect two arguments
Expand Down

0 comments on commit 5eba591

Please sign in to comment.