Skip to content

Commit

Permalink
Merge pull request #624 from egraphs-good/ajpal-nightly
Browse files Browse the repository at this point in the history
[Nightly] Small fixes
  • Loading branch information
ajpal committed Jun 13, 2024
2 parents 2051557 + 992680c commit cf0807b
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 41 deletions.
10 changes: 10 additions & 0 deletions infra/nightly-resources/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ function shouldHaveLlvm(runMethod) {
].includes(runMethod);
}

function getBrilPathForBenchmark(benchmark) {
const o = GLOBAL_DATA.currentRun.find((o) => o.benchmark === benchmark);
if (!o) {
console.error(
`couldn't find entry for ${benchmark} (this shouldn't happen)`,
);
}
return o.metadata.path;
}

function getDataForBenchmark(benchmark) {
const executions = GLOBAL_DATA.currentRun
?.filter((o) => o.benchmark === benchmark)
Expand Down
4 changes: 3 additions & 1 deletion infra/nightly-resources/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ function selectAllBenchmarks(enabled, category) {
let checkboxes = Array.from(checkboxContainer.getElementsByTagName("input"));
if (category === "looped") {
const loopedBenchmarks = new Set(
GLOBAL_DATA.currentRun.filter((x) => x.looped).map((x) => x.benchmark),
GLOBAL_DATA.currentRun
.filter((x) => x.metadata.looped)
.map((x) => x.benchmark),
);
checkboxes = checkboxes.filter((x) => loopedBenchmarks.has(x.id));
}
Expand Down
2 changes: 1 addition & 1 deletion infra/nightly-resources/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function refreshView() {
byBench[benchmark] = getDataForBenchmark(benchmark);
});
const tableData = Object.keys(byBench).map((bench) => ({
name: bench,
name: `<a target="_blank" rel="noopener noreferrer" href="https://github.com/egraphs-good/eggcc/tree/main/${getBrilPathForBenchmark(bench)}">${bench}</a>`,
executions: { data: byBench[bench] },
}));
tableData.sort((l, r) => l.name - r.name);
Expand Down
4 changes: 2 additions & 2 deletions infra/nightly-resources/llvm.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<h2 id="llvm-header">LLVM</h2>
<button class="collapsible" onclick="toggleAllPngs(this)">Expand All</button>
<div id="llvm-cfg"></div>
<button type="button" class="collapsible" onclick="toggle(this, '\u25B6 Show LLVM', '\u25BC Hide LLVM')">\u25BC Hide LLVM</button>
<div id="llvm-ir" style="display: block;"></div>
<button type="button" class="collapsible" onclick="toggle(this, '\u25B6 Show LLVM', '\u25BC Hide LLVM')">&#x25BC; Hide LLVM</button>
<div id="llvm-ir" class="expanded"></div>
</body>

</html>
59 changes: 27 additions & 32 deletions infra/nightly-resources/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,42 +121,37 @@ function ConvertJsonToTable(
var value = parsedJson[i][headers[j]];
var isUrl = urlRegExp.test(value) || javascriptRegExp.test(value);

if (isUrl)
// If value is URL we auto-create a link
tbCon += tdRow.format(link.format(value));
else {
if (value) {
if (typeof value == "object") {
// special case for adding class to <td> elts:
// if the value has exactly the form {class: ..., value: ...}
// treat it as just value.value, and set the class of the <td> element to value.class
if (
Object.keys(value).length === 2 &&
value.hasOwnProperty("value") &&
value.hasOwnProperty("class")
) {
tbCon += '<td class="{0}">{1}</td>'.format(
value.class,
value.value,
);
} else {
//for supporting nested tables
tbCon += tdRow.format(
ConvertJsonToTable(
eval(value.data),
value.tableId,
value.tableClassName,
value.linkText,
),
);
}
if (value) {
if (typeof value == "object") {
// special case for adding class to <td> elts:
// if the value has exactly the form {class: ..., value: ...}
// treat it as just value.value, and set the class of the <td> element to value.class
if (
Object.keys(value).length === 2 &&
value.hasOwnProperty("value") &&
value.hasOwnProperty("class")
) {
tbCon += '<td class="{0}">{1}</td>'.format(
value.class,
value.value,
);
} else {
tbCon += tdRow.format(value);
//for supporting nested tables
tbCon += tdRow.format(
ConvertJsonToTable(
eval(value.data),
value.tableId,
value.tableClassName,
value.linkText,
),
);
}
} else {
// If value == null we format it like PhpMyAdmin NULL values
tbCon += tdRow.format(italic.format(value).toUpperCase());
tbCon += tdRow.format(value);
}
} else {
// If value == null we format it like PhpMyAdmin NULL values
tbCon += tdRow.format(italic.format(value).toUpperCase());
}
}
trCon += tr.format(tbCon);
Expand Down
10 changes: 5 additions & 5 deletions infra/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ def should_have_llvm_ir(runMethod):
]

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

for path in sorted(compile_times.keys()):
name = path.split("/")[-2]
runMethod = path.split("/")[-1]
result = {"runMethod": runMethod, "benchmark": name, "hyperfine": bench_times[path], "compileTime": compile_times[path], "looped": looped[name]}
result = {"runMethod": runMethod, "benchmark": name, "hyperfine": bench_times[path], "compileTime": compile_times[path], "metadata": benchmark_metadata[name]}

res.append(result)
return res
Expand Down Expand Up @@ -142,10 +142,10 @@ def is_looped(bril_file):
else:
profiles = [bril_dir]

looped = {}
benchmark_metadata = {}
for profile in profiles:
name = profile.split("/")[-1][:-len(".bril")]
looped[name] = is_looped(profile)
benchmark_metadata[name] = {"looped": is_looped(profile), "path": profile}

to_run = []
index = 0
Expand Down Expand Up @@ -190,7 +190,7 @@ def is_looped(bril_file):
(path, _bench_data) = res
bench_data[path] = _bench_data

nightly_data = aggregate(compile_times, bench_data, looped)
nightly_data = aggregate(compile_times, bench_data, benchmark_metadata)
with open(f"{DATA_DIR}/profile.json", "w") as profile:
json.dump(nightly_data, profile, indent=2)

Expand Down

0 comments on commit cf0807b

Please sign in to comment.