refactor: ワークロードエントリポイント main() を common/runner.hh テンプレートに集約 (#102)#112
Merged
Conversation
各プロトコルの `<workload>_<proto>.cc` が抱えていた ~90-120 行のスレッド生成・ バリア・時間ループ・結果集計ボイラープレートを `common/runner.hh` の `ccbench::run<Tx, TransactionStatus, Workload>(...)` テンプレートに集約。 エントリポイントは数十行に縮小。 ## API - factory functor が `Tx` を構築 (silo は backoff 無し、cicada/ermia/mvto/oze/si は `Backoff&` を受け取る) - `WorkerInit` hook: MasstreeWrapper::thread_init / setThreadAffinity / WAL log / `gcob.decideFirstRange()` 等 - `WorkerAfterStart` hook: `epoch_timer_start_ = rdtscp()` (silo/oze 等) / `gcstart_ = rdtscp()` (ermia/si) - `RunnerOptions`: `show_actual_extime` / `pass_op_num` (+`max_ope`/`batch_max_ope`) / `display_per_tx` / `enable_bomb_dispatcher` - `BombDispatcherFn`: BoMB mixed-mode dispatcher の関数ポインタ - 制約: `requires TxExecutorLike<Tx>` で #31 の concept を流用 ## 設計判断 - `FLAGS_max_ope` / `FLAGS_batch_max_ope` / `FLAGS_bomb_mixed_mode` は runner.hh から直接参照しない (一部プロトコルだけに定義された FLAGS なので、参照すると Debug ビルドで他プロトコルの binary が link 失敗する)。caller が値を `opts` に 詰め込む形に変更 - `<Proto>Result` 廃止 (#101 完了) により runner は `CCBenchResults` のみ参照 - d2pl は `dbomb`/`sbomb` のみ、mvto は `tpcc`/`bomb` のみ等の workload 非対称性は維持 ## 削除 - 各プロトコル直下の死んだ `<proto>.cc` (silo.cc / cicada.cc / oze.cc / si.cc / mocc.cc / ermia.cc / tictoc.cc) — CMake から参照されない orphan main、新旧 エントリポイントの混在を避けるため除去 ## 検証 - CI と同じ GCC 13 で Release / Debug+ASan の両モードで全 34 binary build 成功 - 代表 6 binary を short run: ycsb_silo/oze/ermia, bomb_oze/si (thread_num=8), tpcc_mvto すべて正常完了 (commit/abort カウントが想定オーダー) Closes #102
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<workload>_<proto>.ccが抱えていた ~90-120 行のスレッド生成・バリア・時間ループ・結果集計ボイラープレートをcommon/runner.hhのccbench::run<Tx, TransactionStatus, Workload>(...)テンプレートに集約WorkerInithook (masstree init / setThreadAffinity / WAL /gcob.decideFirstRange())・WorkerAfterStarthook (epoch_timer_start_/gcstart_の rdtscp)・RunnerOptionsstruct で吸収requires TxExecutorLike<Tx>で [P1] TxExecutorコントラクトをC++20 conceptで明示する #31 の concept を流用、<Proto>Result廃止 ([P2] per-protocol result.cc を撲滅し initResult を共通化する #101 完了) により runner はCCBenchResultsのみ参照cc/<proto>/<proto>.cc(silo/cicada/oze/si/mocc/ermia/tictoc) — CMake から参照ゼロの orphan main を 7 個削除設計判断
FLAGS_max_ope/FLAGS_batch_max_ope/FLAGS_bomb_mixed_modeは一部プロトコルだけに定義された FLAGS なので、runner から直接参照すると他プロトコルの binary が Debug build で link 失敗する。caller が値をRunnerOptionsに詰める形に変更dbomb/sbombのみ、mvto はtpcc/bombのみ等の workload 非対称性は維持Closes #102
Test plan