Skip to content

Commit 26066cc

Browse files
committed
fixes based on new tests
1 parent 2e8fc7f commit 26066cc

File tree

3 files changed

+24
-36
lines changed

3 files changed

+24
-36
lines changed

src/libkernelbot/report.py

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -269,24 +269,29 @@ def generate_system_info(system: SystemInfo):
269269
"""
270270

271271

272+
def _handle_crash_report(report: RunResultReport, run_result: EvalResult):
273+
if run_result.compilation is not None and not run_result.compilation.success:
274+
_generate_compile_report(report, run_result.compilation)
275+
return True
276+
277+
if not run_result.run.success:
278+
_generate_crash_report(report, run_result.run)
279+
return True
280+
281+
return False
282+
283+
272284
def generate_report(result: FullResult) -> RunResultReport: # noqa: C901
273285
runs = result.runs
274286
report = RunResultReport()
275287
report.add_text(generate_system_info(result.system))
276288

277289
if "test" in runs:
278290
test_run = runs["test"]
279-
280-
if test_run.compilation is not None and not test_run.compilation.success:
281-
_generate_compile_report(report, test_run.compilation)
291+
if _handle_crash_report(report, test_run):
282292
return report
283293

284294
test_run = test_run.run
285-
286-
if not test_run.success:
287-
_generate_crash_report(report, test_run)
288-
return report
289-
290295
if not test_run.passed:
291296
_generate_test_report(report, test_run)
292297
return report
@@ -296,47 +301,30 @@ def generate_report(result: FullResult) -> RunResultReport: # noqa: C901
296301

297302
if "benchmark" in runs:
298303
bench_run = runs["benchmark"]
299-
if bench_run.compilation is not None and not bench_run.compilation.success:
300-
_generate_compile_report(report, bench_run.compilation)
301-
return report
302-
303-
bench_run = bench_run.run
304-
if not bench_run.success:
305-
_generate_crash_report(report, bench_run)
304+
if _handle_crash_report(report, bench_run):
306305
return report
307306

308307
report.add_log(
309308
"Benchmarks",
310-
make_benchmark_log(bench_run),
309+
make_benchmark_log(bench_run.run),
311310
)
312311

313312
if "profile" in runs:
314313
prof_run = runs["profile"]
315-
if prof_run.compilation is not None and not prof_run.compilation.success:
316-
_generate_compile_report(report, prof_run.compilation)
317-
return report
318-
319-
prof_run = prof_run.run
320-
if not prof_run.success:
321-
_generate_crash_report(report, prof_run)
314+
if _handle_crash_report(report, prof_run):
322315
return report
323316

324317
report.add_log(
325318
"Profiling",
326-
make_profile_log(prof_run),
319+
make_profile_log(prof_run.run),
327320
)
328321

329322
if "leaderboard" in runs:
330323
bench_run = runs["leaderboard"]
331-
if bench_run.compilation is not None and not bench_run.compilation.success:
332-
_generate_compile_report(report, bench_run.compilation)
324+
if _handle_crash_report(report, bench_run):
333325
return report
334326

335327
bench_run = bench_run.run
336-
if not bench_run.success:
337-
_generate_crash_report(report, bench_run)
338-
return report
339-
340328
report.add_log(
341329
"Ranked Benchmark",
342330
make_benchmark_log(bench_run),

src/libkernelbot/submission.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def _get_popcorn_directives(submission: str) -> dict: # noqa: C901
150150
arg = args[1].strip().lower()
151151
if len(args) < 3:
152152
raise KernelBotError(f"!POPCORN directive missing argument: {line}")
153+
153154
# allow both versions of the argument
154155
if arg == "gpu":
155156
arg = "gpus"
@@ -163,11 +164,7 @@ def _get_popcorn_directives(submission: str) -> dict: # noqa: C901
163164
if arg == "gpus":
164165
popcorn_info["gpus"] = args[2:]
165166
elif arg == "leaderboard":
166-
popcorn_info["leaderboard"] = args[2].strip()
167-
if len(popcorn_info["leaderboard"]) == 0:
168-
raise KernelBotError(
169-
"No leaderboard specified in !POPCORN Leaderboard directive"
170-
)
167+
popcorn_info["leaderboard"] = args[2]
171168
return popcorn_info
172169

173170

@@ -194,6 +191,6 @@ def compute_score(result: FullResult, task: LeaderboardTask, submission_id: int)
194191
elif task.ranking_by == RankCriterion.GEOM:
195192
score = math.pow(math.prod(scores), 1.0 / num_benchmarks)
196193
else:
197-
raise KernelBotError(f"Invalid submission mode {task.ranking_by}")
194+
raise KernelBotError(f"Invalid ranking criterion {task.ranking_by}")
198195

199196
return score

src/libkernelbot/task.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,5 +196,8 @@ def build_task_config(
196196
return {
197197
"sources": sources,
198198
"headers": headers,
199+
"defines": task.config.defines,
200+
"compile_flags": task.config.compile_flags,
199201
"include_dirs": task.config.include_dirs,
202+
**common,
200203
}

0 commit comments

Comments
 (0)