From 2a8b48385854a10251a15807103354048efe6122 Mon Sep 17 00:00:00 2001 From: tignear Date: Tue, 20 Oct 2026 23:22:32 +0900 Subject: [PATCH] fix(bench): enable parallel execution in the Heliodor tiered runner Pass HELIODOR_CELOX_THREADS (default: nproc) to celox-tiered on AArch64 and x86-64. Previously only celox-parallel received --threads, so tiered measurements always used the default single simulation thread. The compiled tier can now use the existing parallel native kernels; HELIODOR_CELOX_THREADS=1 retains the previous configuration. Reject invalid tiered thread counts before preparation and invalidate successful multi-threaded results whose logs do not record the requested count. Document the configuration and the difference from historical single-threaded tiered measurements. Validation: - Bash syntax checks and Heliodor result/gate fixture suites passed. - 22 suite, workflow, and publication Node tests passed. - Regression fixtures cover ARM/QEMU argument forwarding, missing/wrong thread markers, the single-thread override, and invalid thread counts. - git diff --check passed. ARM hardware performance measurements and full Linux boot benchmarks were not run; this changes runner configuration, not backend code. Change-Id: I3e9e1831b9914e4a55a10ffd4bc935be1cb561b6 --- docs/benchmarks/heliodor.md | 7 ++++ docs/ja/benchmarks/heliodor.md | 6 +++ scripts/heliodor-suite.mjs | 4 +- scripts/run-heliodor-bench.sh | 15 ++++++-- scripts/tests/run-heliodor-bench-results.sh | 41 +++++++++++++++++++-- 5 files changed, 64 insertions(+), 9 deletions(-) diff --git a/docs/benchmarks/heliodor.md b/docs/benchmarks/heliodor.md index b96eb9fb0c8..2b1fdb2663a 100644 --- a/docs/benchmarks/heliodor.md +++ b/docs/benchmarks/heliodor.md @@ -161,6 +161,13 @@ host vCPU (`HELIODOR_CELOX_THREADS`, default `nproc`). Its own job keeps the comparison groups' time budgets unchanged. The dashboard shows it as "multi-threaded" next to single-threaded native execution. +`celox-tiered` also uses `HELIODOR_CELOX_THREADS` on both AArch64 and x86-64. +It starts on the interpreter and adopts native kernels with parallel execution +enabled once compilation finishes. The scheduler can keep sequential kernels +when parallel execution is not worthwhile. Set `HELIODOR_CELOX_THREADS=1` for +the previous single-threaded tiered configuration. Earlier tiered measurements +used one simulation thread; account for this when comparing historical timings. + Recent complete eight-hart runs total 10–13 hours on x86-64 and 17–18 hours on AArch64. AArch64 four-hart runs total 5–7 hours, so splitting them into equivalent execution modes preserves useful same-CPU comparisons with time for builds. diff --git a/docs/ja/benchmarks/heliodor.md b/docs/ja/benchmarks/heliodor.md index b8af813d6be..88337d3efd7 100644 --- a/docs/ja/benchmarks/heliodor.md +++ b/docs/ja/benchmarks/heliodor.md @@ -148,6 +148,12 @@ Linux バージョンはシミュレーション内で起動するゲストの 別ジョブにすることで、比較グループの実行時間の上限は変わりません。ダッシュボードでは シングルスレッドの native 実行と並べて「multi-threaded」として表示します。 +`celox-tiered` も AArch64・x86-64 の両方で `HELIODOR_CELOX_THREADS` を使います。 +インタープリターで実行を始め、コンパイル完了後に並列実行を有効にした native カーネルへ移行します。 +並列化の効果が小さい処理には、スケジューラーが逐次カーネルを選ぶことがあります。 +従来のシングルスレッド設定で測定する場合は `HELIODOR_CELOX_THREADS=1` を指定してください。 +過去の tiered 計測はシミュレーションを1スレッドで実行していたため、履歴との比較ではこの違いに注意してください。 + 直近の完走結果では、8 hart の合計は x86-64 で 10〜13 時間、AArch64 で 17〜18 時間です。 AArch64 の 4 hart も合計 5〜7 時間なので、同じ実行方式のペアに分け、ビルド時間を確保しつつ Celox と Veryl-CC を同じ CPU で比較します。別グループ間では同じ CPU を保証しません。 diff --git a/scripts/heliodor-suite.mjs b/scripts/heliodor-suite.mjs index 9dde905494b..4c8ddcc5e9f 100644 --- a/scripts/heliodor-suite.mjs +++ b/scripts/heliodor-suite.mjs @@ -18,8 +18,8 @@ export const workloads = [ "test_soc_71v_linux_boot", ]; export const runners = ["veryl-cc-sync", "celox", "celox-tiered", "veryl-cc-tiered"]; -// Multi-threaded Celox runs only on SMP workloads, in its own group so the -// existing comparison groups keep their time budgets. +// The synchronous multi-threaded Celox runner runs only on SMP workloads, +// in its own group so the existing comparison groups keep their time budgets. export const parallelRunner = "celox-parallel"; export const allRunners = [...runners, parallelRunner]; const isSmp = test => /_smp_linux_boot_\d+hart$/.test(test); diff --git a/scripts/run-heliodor-bench.sh b/scripts/run-heliodor-bench.sh index e4f65f1426f..342c8717639 100755 --- a/scripts/run-heliodor-bench.sh +++ b/scripts/run-heliodor-bench.sh @@ -119,7 +119,7 @@ Environment: HELIODOR_CELOX_TIMEOUT_MULTIPLIER timeout Celox after N times the fastest successful Veryl baseline HELIODOR_CELOX_THREADS - simulation threads of the celox-parallel runner (default: nproc) + simulation threads of celox-parallel and celox-tiered (default: nproc) CELOX_OPT_LEVEL O0, O1, or O2 for the Celox runner (default: O2) CELOX_SIR_PASS_OVERRIDES space-separated SIR pass overrides, e.g. "-vectorize_concat +gvn" @@ -1580,7 +1580,8 @@ run_one() { run_in_heliodor "$timeout_sec" "$log" \ "${celox_execution_command[@]}" \ --project "$HELIODOR_DIR" --test "$test" \ - "${celox_args[@]}" --backend tiered --opt-level "${CELOX_OPT_LEVEL,,}" + "${celox_args[@]}" --backend tiered --opt-level "${CELOX_OPT_LEVEL,,}" \ + --threads "$HELIODOR_CELOX_THREADS" process_status="$?" ;; celox-interpreter) @@ -1658,9 +1659,10 @@ run_one() { result_valid=0 echo "error: $CELOX_RESULT_DIAGNOSTIC" >&2 fi - if [[ "$runner" == celox-parallel && "$semantic_status" == pass ]] \ + if [[ ( "$runner" == celox-parallel || "$runner" == celox-tiered ) \ + && "$HELIODOR_CELOX_THREADS" -gt 1 && "$semantic_status" == pass ]] \ && ! grep -Fxq "CELOX_TEST_THREADS test=$test threads=$HELIODOR_CELOX_THREADS" "$log"; then - echo "error: celox-parallel log does not record $HELIODOR_CELOX_THREADS threads" >&2 + echo "error: $runner log does not record $HELIODOR_CELOX_THREADS threads" >&2 semantic_status=invalid result_valid=0 fi @@ -1733,6 +1735,11 @@ publish_result() { run_all() { validate_compile_only_runners || return "$?" validate_native_image_mode || return "$?" + if runner_enabled celox-tiered \ + && { ! is_uint "$HELIODOR_CELOX_THREADS" || ((HELIODOR_CELOX_THREADS < 1)); }; then + echo "error: HELIODOR_CELOX_THREADS must be at least 1 for celox-tiered" >&2 + return 2 + fi prepare mkdir -p "$HELIODOR_RESULTS_DIR" ensure_results_schema "$HELIODOR_RESULTS_DIR/results.tsv" || return "$?" diff --git a/scripts/tests/run-heliodor-bench-results.sh b/scripts/tests/run-heliodor-bench-results.sh index 14847b62078..66a5409ffd5 100644 --- a/scripts/tests/run-heliodor-bench-results.sh +++ b/scripts/tests/run-heliodor-bench-results.sh @@ -360,6 +360,7 @@ run_in_heliodor() { ensure_results_schema "$integration_results/results.tsv" HELIODOR_COMPILE_ONLY=0 CELOX_OPT_LEVEL=O2 +HELIODOR_CELOX_THREADS=4 HELIODOR_CELOX_BUILD_CACHE_DIR="$TMP/build-cache" CELOX_SIR_PASS_OVERRIDES="-branchify_mux +gvn" FIXTURE_RESULT_LINE=$'CELOX_TEST_TIMING test=integration_pass compile_ns=20 execute_ns=30 jit_execute_ns=25\nCELOX_TEST_RESULT test=integration_pass status=pass elapsed_ns=71' @@ -462,11 +463,13 @@ assert_eq "$(awk -F '\t' 'NR == 8 { print $10 }' "$integration_results/results.t assert_eq "$(awk -F '\t' 'NR == 8 { print $11 }' "$integration_results/results.tsv")" NA \ "run_one Veryl CLI execute elapsed" -FIXTURE_RESULT_LINE=$'CELOX_TEST_TIMING test=integration_tiered compile_ns=12 execute_ns=34 jit_execute_ns=NA\nCELOX_TIERED_STATS test=integration_tiered tier=compiled promotion=promoted interpreted_evaluations=10 compiled_evaluations=20 promoted_after_interpreted_evaluations=10 promotion_elapsed_ns=15 safe_point_polls=11 split_apply_deferrals=0 threshold_deferrals=0\nCELOX_TEST_RESULT test=integration_tiered status=pass elapsed_ns=48' +FIXTURE_RESULT_LINE=$'CELOX_TEST_THREADS test=integration_tiered threads=4\nCELOX_TEST_TIMING test=integration_tiered compile_ns=12 execute_ns=34 jit_execute_ns=NA\nCELOX_TIERED_STATS test=integration_tiered tier=compiled promotion=promoted interpreted_evaluations=10 compiled_evaluations=20 promoted_after_interpreted_evaluations=10 promotion_elapsed_ns=15 safe_point_polls=11 split_apply_deferrals=0 threshold_deferrals=0\nCELOX_TEST_RESULT test=integration_tiered status=pass elapsed_ns=48' run_one celox-tiered integration_tiered >/dev/null \ || fail "run_one rejected a fixture tiered pass" [[ " ${FIXTURE_RUN_ARGS[*]} " == *" --backend tiered "* ]] \ || fail "tiered runner did not select the tiered backend" +[[ " ${FIXTURE_RUN_ARGS[*]} " == *" --threads 4 "* ]] \ + || fail "tiered runner did not request parallel execution" assert_eq "$(awk -F '\t' 'NR == 9 { print $1 }' "$integration_results/results.tsv")" \ celox-tiered "run_one tiered runner name" assert_eq "$(awk -F '\t' 'NR == 9 { print $12 }' "$integration_results/results.tsv")" NA \ @@ -486,13 +489,15 @@ assert_eq "$(awk -F '\t' 'NR == 10 { print $1 }' "$integration_results/results.t # host-qemu mode. Native host codegen is handled separately by run_one. HELIODOR_CELOX_NATIVE_IMAGE_MODE=host-qemu CELOX_EXECUTION_PREFIX=(qemu-aarch64 -L /fixture-sysroot) -FIXTURE_RESULT_LINE=$'CELOX_TEST_TIMING test=integration_qemu_tiered compile_ns=12 execute_ns=34 jit_execute_ns=NA\nCELOX_TIERED_STATS test=integration_qemu_tiered tier=compiled promotion=promoted interpreted_evaluations=10 compiled_evaluations=20 promoted_after_interpreted_evaluations=10 promotion_elapsed_ns=15 safe_point_polls=11 split_apply_deferrals=0 threshold_deferrals=0\nCELOX_TEST_RESULT test=integration_qemu_tiered status=pass elapsed_ns=48' +FIXTURE_RESULT_LINE=$'CELOX_TEST_THREADS test=integration_qemu_tiered threads=4\nCELOX_TEST_TIMING test=integration_qemu_tiered compile_ns=12 execute_ns=34 jit_execute_ns=NA\nCELOX_TIERED_STATS test=integration_qemu_tiered tier=compiled promotion=promoted interpreted_evaluations=10 compiled_evaluations=20 promoted_after_interpreted_evaluations=10 promotion_elapsed_ns=15 safe_point_polls=11 split_apply_deferrals=0 threshold_deferrals=0\nCELOX_TEST_RESULT test=integration_qemu_tiered status=pass elapsed_ns=48' run_one celox-tiered integration_qemu_tiered >/dev/null \ || fail "run_one rejected a host-qemu tiered fixture" assert_eq "${FIXTURE_RUN_ARGS[0]}" qemu-aarch64 "tiered execution prefix command" assert_eq "${FIXTURE_RUN_ARGS[1]}" -L "tiered execution prefix option" assert_eq "${FIXTURE_RUN_ARGS[2]}" /fixture-sysroot "tiered execution prefix argument" assert_eq "${FIXTURE_RUN_ARGS[3]}" "$CELOX_RUNNER_BIN" "tiered target runner" +[[ " ${FIXTURE_RUN_ARGS[*]} " == *" --threads 4 "* ]] \ + || fail "ARM tiered runner did not request parallel execution" FIXTURE_RESULT_LINE=$'CELOX_TEST_TIMING test=integration_qemu_interpreter compile_ns=8 execute_ns=55 jit_execute_ns=NA\nCELOX_TEST_RESULT test=integration_qemu_interpreter status=pass elapsed_ns=65' run_one celox-interpreter integration_qemu_interpreter >/dev/null \ @@ -502,6 +507,36 @@ assert_eq "${FIXTURE_RUN_ARGS[3]}" "$CELOX_RUNNER_BIN" "interpreter target runne HELIODOR_CELOX_NATIVE_IMAGE_MODE=off CELOX_EXECUTION_PREFIX=() +# A successful result without the requested thread count cannot be published. +FIXTURE_RESULT_LINE=$'CELOX_TEST_TIMING test=tiered_threads compile_ns=12 execute_ns=34 jit_execute_ns=NA\nCELOX_TEST_RESULT test=tiered_threads status=pass elapsed_ns=48' +for marker in "" "CELOX_TEST_THREADS test=tiered_threads threads=2"; do + ( + FIXTURE_RESULT_LINE="$marker"$'\n'"$FIXTURE_RESULT_LINE" + if run_one celox-tiered tiered_threads >/dev/null 2>&1; then + fail "tiered accepted a missing or incorrect thread count" + fi + assert_eq "$(tail -n 1 "$integration_results/results.tsv" | cut -f 6)" invalid \ + "tiered thread mismatch must invalidate the result" + ) +done +( + HELIODOR_CELOX_THREADS=1 + run_one celox-tiered tiered_threads >/dev/null \ + || fail "tiered rejected explicit sequential execution" + [[ " ${FIXTURE_RUN_ARGS[*]} " == *" --threads 1 "* ]] \ + || fail "tiered did not honor the sequential override" +) +for invalid_threads in 0 -1 invalid; do + ( + HELIODOR_RUNNERS=celox-tiered + HELIODOR_CELOX_THREADS="$invalid_threads" + prepare() { fail "invalid thread count reached benchmark preparation"; } + status=0 + run_all >/dev/null 2>&1 || status=$? + assert_eq "$status" 2 "invalid tiered thread count" + ) +done + previous_cache="$FIXTURE_AOT_CACHE_DIR" FIXTURE_RESULT_LINE=$'VERYL_TEST_CONFIG test=integration_veryl_tiered backend=cc aot_c_async=true compile_only=false\nVERYL_TEST_TIMING test=integration_veryl_tiered compile_ns=8 execute_ns=50\nVERYL_TIERED_STATS test=integration_veryl_tiered compiled_dispatches=100 fallback_dispatches=200\nVERYL_TEST_RESULT test=integration_veryl_tiered status=pass elapsed_ns=59' run_one veryl-cc-tiered integration_veryl_tiered >/dev/null \ @@ -552,7 +587,7 @@ fi HELIODOR_PUBLISH_ARCH=x86_64 HELIODOR_COMPILE_ONLY=0 HELIODOR_CELOX_NATIVE_IMAGE_MODE=off - FIXTURE_RESULT_LINE=$'CELOX_TEST_TIMING test=publish_tiered compile_ns=12 execute_ns=34 jit_execute_ns=NA\nCELOX_TIERED_STATS test=publish_tiered tier=compiled promotion=promoted interpreted_evaluations=10 compiled_evaluations=20 promoted_after_interpreted_evaluations=10 promotion_elapsed_ns=15 safe_point_polls=11 split_apply_deferrals=0 threshold_deferrals=0\nCELOX_TEST_RESULT test=publish_tiered status=pass elapsed_ns=48' + FIXTURE_RESULT_LINE=$'CELOX_TEST_THREADS test=publish_tiered threads=4\nCELOX_TEST_TIMING test=publish_tiered compile_ns=12 execute_ns=34 jit_execute_ns=NA\nCELOX_TIERED_STATS test=publish_tiered tier=compiled promotion=promoted interpreted_evaluations=10 compiled_evaluations=20 promoted_after_interpreted_evaluations=10 promotion_elapsed_ns=15 safe_point_polls=11 split_apply_deferrals=0 threshold_deferrals=0\nCELOX_TEST_RESULT test=publish_tiered status=pass elapsed_ns=48' run_one celox-tiered publish_tiered >/dev/null \ || fail "publishing rejected a completed tiered run" FIXTURE_RESULT_LINE="${FIXTURE_RESULT_LINE/compiled_evaluations=20/compiled_evaluations=0}"