feat(hipblaslt): add HIPBLASLT_TUNING_MODE=online #15312
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #15312"
general
weight: 0.35
yzhang93
JIRA ID : AIHPBLAS-4906
Motivation
tunemode finds better kernels than the heuristic, but its search blocks the first call of each shape.onlinemode gets those gains from the application's ownhipblasLtMatmulcalls, with no separate tuning run and no call waiting on the GPU.Technical details
Online works like
tune: same cache key, one search per key, one row per key appended toHIPBLASLT_TUNING_CACHE_PATH, rows marked with the mode that measured them, and later calls replayed by the existing cache path. A key the file already covers is replayed, not explored.The differences:
hipEventElapsedTime(nohipEventQuery), so reading a pair never touches a stream and cannot invalidate a graph capture on any thread. Event pairs are pre-set with their timestamps reversed, so a pair the launch never recorded reads ≤ 0 and is discarded.hipblasLtMatmulwith a null algo is tuned. Never explored or timed: caller-supplied algos;hipblasLtMatmulAlgoGetHeuristic(it never reaches the tuner and is answered from the cache file, as incachemode); thehipblaslt_extGEMM and grouped GEMM APIs; pointer-array batches;HIPBLASLT_ADAPTIVE_SM_COUNTcalls; fused GEMM+all-to-all calls; calls dispatched to rocRoller (block-scaled MX problems by default, or all withHIPBLASLT_USE_ROCROLLER=1). Graph-captured calls are never explored or timed either; they get the winner once there is one. Online mode never replaces an algo the caller passes, including one returned byhipblasLtMatmulAlgoGetHeuristic: a caller that passes an algo gets exactly that kernel.Unchanged: with mode off each hook is a single branch;
cacheandtunebehaviour and logs are unchanged apart from the new mode column.Reviewing
The branch is split into commits so it can be reviewed one step at a time; each step's code commit is followed by its tests, and every commit builds on its own. It will be squash-merged.
1.
feat: record the measuring mode in tuning-cache rows — a mode column sotuneandonlinerows never cover each other.2.
test: cover thetuning_modecolumn.3.
feat: add best-effort launch events toSolutionAdapter— optional start/stop events around a launch (EventRecording::BestEffort), where an event failure never fails the launch.4.
test: cover best-effort and strict launch events.5.
feat: add theOnlineTunerengine — exploration, sampling and the event-pair pool, not yet called from anywhere.6.
test:OnlineTunerunit tests.7.
feat: wire online tuning intohipblasLtMatmul— the mode, its hooks and scope rules.8.
test: end-to-end online tuning tests.9.
docs: documentHIPBLASLT_TUNING_MODE=online.Commits 1–4 are small and independent of the tuner; most of the review is in 5 and 7. Changes made after review started are additional commits on top (with develop merged in), so they can be reviewed separately.
Configuration
Online reads
tune's variables with smaller defaults, and the startup line shows the values in effect; seeenv-variables.rst.| Variable |
onlinedefault ||---|---|
|
HIPBLASLT_TUNING_MAX_CANDIDATES(K; below 2 turns online off) | 5 ||
HIPBLASLT_TUNING_HOT_ITERS(R) | 3 ||
HIPBLASLT_TUNING_COLD_ITERS| 3 ||
HIPBLASLT_TUNING_MIN_IMPROVEMENT_PCT(new, online only) | 0 ||
HIPBLASLT_TUNING_MAX_EVENT_PAIRS(new, online only) | 4096 |Test Plan
TuningStore: the row mode column, old rows reading astune, modes never covering each other.HipSolutionAdapterEventTest_multi_gpu(two GPUs; there is no single-GPU variant): best-effort and strict launch events.OnlineTuner(+_multi_gpu): engine unit tests (budgets, sampling ownership, claim-once, event-pair cap and reclaim, unrecorded pairs, read-back during a capture of the pair's stream, the caller's HIP error state, per-device pools).TuningOnline_pre_checkin: end-to-end explore, record and replay, replay after an in-process reset that stands in for a later process (no test spawns a second process for this), out-of-scope calls, graph capture on this and another thread (on a created stream and on the null stream, which must leave no HIP error),hipStreamLegacy, the cap, and several threads dispatching two keys at once (correct results, one row per key, no HIP error left).Negative controls: targeted mutations of the engine were confirmed to fail the corresponding tests.
Test Result
On gfx950, release build, ROCm 7.2.3, with develop merged in. No failures; the only tests not on develop are this PR's.
TuningOnline_pre_checkinandOnlineTuneralso passed on ROCm 7.0.2 before review.| Suite | this branch |
|---|---|
| Tuning gate suites (cache, tune, store, scratch, adapter) | 188 pass, 5 skip |
|
TuningOnline_pre_checkin| 16 pass ||
OnlineTuner| 12 pass || Quick tier (smoke, HostUnit, TuningStore, OnlineTuner) | 1230 pass, 10 skip |
|
multi_gpu(2 GPUs) | 4 pass (before review; not re-run) |In coverage builds,
AProblemOnTheLegacyStreamIsExploredAndRecordedis skipped: clang's coverage runtime callshipStreamGetDeviceon the launch stream, which fails forhipStreamLegacy(the same reasonStreamKNullStreamis excluded from coverage runs).Performance
cachemode pays too.Known limitations
HIPBLASLT_TUNING_MIN_IMPROVEMENT_PCTcan require a margin over the heuristic's pick. The defaults may be retuned.Submission Checklist
🤖 Generated with Claude Code