Repository navigation
Benchmarks: Decouple cuDNN workload and legacy execution setup - #853
gusui-msft wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Prepared-plan descriptor ownership, full-sample qualification, and execution-mode validation issues remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds opt-in prepared cuDNN backward-filter execution while preserving legacy behavior through immutable workloads, screened plans, numerical qualification, separate metrics, tests, and documentation.
Changes:
- Adds prepared plan construction, policy-based selection, and FP64 qualification.
- Integrates prepared execution, configuration validation, and metrics.
- Adds regression tests, build targets, and user documentation.
File summaries
| File | Summary |
|---|---|
tests/benchmarks/micro_benchmarks/test_cudnn_workload.cpp |
Workload immutability tests |
tests/benchmarks/micro_benchmarks/test_cudnn_prepared.py |
Python boundary and metric tests |
tests/benchmarks/micro_benchmarks/test_cudnn_prepared.cpp |
Native prepared execution tests |
tests/benchmarks/micro_benchmarks/test_cudnn_plan_policy.cpp |
Policy and selection tests |
superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_reference.h |
Numerical reference qualification |
superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_prepared_selection.h |
Candidate qualification and selection |
superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_prepared_plan.h |
cuDNN backend plan management |
superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_plan_policy.h |
Plan and accuracy policies |
superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_function.h |
Prepared execution lifecycle |
superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_function_helper.h |
Prepared configuration and dispatch |
superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_convolution_workload.h |
Immutable workload snapshot |
superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_config.h |
Prepared configuration state |
superbench/benchmarks/micro_benchmarks/cudnn_function/convolution_backward_filter.h |
Prepared backward-filter executor |
superbench/benchmarks/micro_benchmarks/cudnn_function/CMakeLists.txt |
Test targets and linking |
superbench/benchmarks/micro_benchmarks/cudnn_function.py |
CLI normalization and prepared metrics |
docs/user-tutorial/benchmarks/micro-benchmarks.md |
Prepared execution contract and validation documentation |
Review details
Suppressed comments (3)
superbench/benchmarks/micro_benchmarks/cudnn_function.py:389
- When
--execution_mode preparedis selected, a custom JSON containingexecutionMode: "legacy"is silently overwritten by theconfig.updatebelow and then runs through prepared screening. An explicit execution-mode contract should reject a mismatched value (or require the field to be omitted) rather than changing its meaning.
if self._args.enable_auto_algo:
raise ValueError('Prepared execution does not use legacy auto algorithm selection.')
superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_prepared_plan.h:125
- This
engineoutput handle has the same ownership problem as the engine-config array:cudnnBackendGetAttributecan overwrite the placeholder returned bycreate, but only the placeholder remains registered indescriptors_.values. The returned engine descriptor is then left unmanaged for every candidate, so repeated prepared selections leak cuDNN backend resources.
auto engine = create(CUDNN_BACKEND_ENGINE_DESCRIPTOR);
int64_t returned = 0;
CHECK_CUDNN_ERROR(cudnnBackendGetAttribute(candidate, CUDNN_ATTR_ENGINECFG_ENGINE,
CUDNN_TYPE_BACKEND_DESCRIPTOR, 1, &returned, &engine));
superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_reference.h:254
- This returns as soon as any output in the current sample fails, so later screening samples (including the actual operands) are never executed. That contradicts the five-input/full-output qualification and can leave the device operands on a probe when no later candidate runs; continue through all samples and return
failures_ == 0after the loop.
if (failures_ != 0) {
return false;
}
- Files reviewed: 14/14 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🔵 Needs a closer look
Two review issues remain, and full CUDA/cuDNN build and GPU runtime qualification are pending.
Review details
Suppressed comments (2)
superbench/benchmarks/micro_benchmarks/cudnn_function/convolution_backward_filter.h:29
plan_build_ms_measures the entireCudnnPreparedSelectionconstruction, not just backend plan construction: it includes reference generation, CPU cross-checks, workspace allocation, and full-output qualification for every candidate. Emitting this asplan_build_ms(and documenting it as plan-build time) misattributes the expensive qualification cost and leaves no metric for distinguishing selection/qualification from plan creation; measure the phases separately or rename this field to reflect selection/qualification time.
auto start = std::chrono::steady_clock::now();
const CudnnConvolutionWorkload workload(*this);
const CudnnPlanPolicy policy(this->get_use_tensor_op(), this->get_workspace_limit_mib());
prepared_.reset(
new CudnnPreparedSelection(this->cudnn_handle, workload, policy, this->x, this->filter, this->h));
plan_build_ms_ =
std::chrono::duration<double, std::milli>(std::chrono::steady_clock::now() - start).count();
superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_function_helper.h:203
from_jsonexplicitly acceptsexecutionMode: "legacy", butcontainsalso sends that mode through the new rethrow path at lines 246-248. An explicit legacy configuration therefore changes the existing behavior for runtime errors from printingErrorand returning normally to propagating out ofrun_benchmark; only prepared mode should enable fail-fast handling.
explicit_execution_mode = function_config.contains("executionMode");
- Files reviewed: 14/14 changed files
- Comments generated: 0 new
- Review effort level: Lite
There was a problem hiding this comment.
🟡 Changes recommended
The new configuration test fails to compile because of an include cycle.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #853 +/- ##
=======================================
Coverage 86.36% 86.36%
=======================================
Files 107 107
Lines 8258 8258
=======================================
Hits 7132 7132
Misses 1126 1126
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
16c0d8f to
14f665b
Compare
14f665b to
c51181f
Compare
c51181f to
1021848
Compare
Snapshot the convolution workload and legacy execution policy before descriptor setup. Preserve algorithm selection, input initialization, benchmark timing, defaults, and result format.
The CUDA build registers cudnn_config_test, but no pipeline runs CTest, so its snapshot assertions never execute in CI. Run the CPU-labelled tests after building the benchmarks, and fail if no test is registered. Include <functional> and <numeric> in cudnn_helper.h, which uses std::multiplies and std::accumulate, so the header compiles on its own. Drop the workaround include from cudnn_execution_config.h. Co-authored-by: Copilot <[email protected]>
1021848 to
69db692
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The CUDA/cuDNN runtime-preparation refactor lacks full SDK linking, GPU runtime, and representative numerical/performance validation, so human confirmation of legacy behavior is needed.
No open issues 🎉
1 resolved since last review
Review effort: Lite

Description
Refactor existing legacy cuDNN initialization into immutable workload/policy inputs and separate descriptor, algorithm/workspace, and input preparation. No new execution mode.
The CUDA unit-test pipeline now runs the new host regression through CTest after building the benchmarks, and the step fails if the test is not registered.
cudnn_helper.hnow includes<functional>and<numeric>for thestd::multipliesandstd::accumulatecalls it already makes, so it compiles without relying on include order.Scope
main: 6 files, +151/-20, including one 62-line host regression and a 5-line CI step.Validation
cudnn_helper.h,cudnn_config.handcudnn_execution_config.heach compile as the first include. Native benchmark objects compile, and clang-format 14 and no-CUDA CMake configuration pass.Prepared experiments remain preserved on the separate
experiment/cudnn-prepared-plan-20260916branch. This PR contains only the legacy workload/policy refactor and the supporting test, CI and include changes.