Repository navigation
Benchmarks: Separate cuDNN workload setup from algorithm selection - #853
gusui-msft wants to merge 4 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 <223556219+Copilot@users.noreply.github.com>
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
Resolve each operation to a single typed algorithm without overwriting the request. Use that result for both workspace sizing and execution. Exercise manual and automatic selection and distinguish convolution stride from dilation in the host regression. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reuse the executor configuration and reject empty or failed search results before querying workspace. Check the algorithm IDs at the real cuDNN calls for all three directions and build the regression explicitly in CUDA CI. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain, and the change includes targeted regression coverage with registered CUDA CI tests for consistent algorithm selection and execution.
No open issues 🎉
1 resolved since last review
Review effort: Lite


What changed
Split legacy cuDNN initialization into descriptor creation, algorithm/workspace setup, and tensor preparation. Each direction resolves one typed algorithm: manual mode keeps the requested ID; automatic mode requires one successful cuDNN search result. The workspace query and convolution consume that same ID. Geometry is read from the executor's existing configuration, without copying eight vectors into a second configuration object.
Scope
The PR changes eight files: five native headers (the shared executor, the descriptor helper, and the three operations), one regression test, its CMake registration, and the CUDA CI pipeline. No new production header, backend, or CLI option. Default workloads, precision dispatch, warm-up/timing, and output are unchanged by this PR. The default-algorithm fix is #901; storage/compute precision remains separate in #852.
Validation (
1d761695, H100 80GB, CUDA 13.0, cuDNN 9.12)mainata647f2b4(Benchmarks: Restore valid timings for two default cuDNN convolutions #901): 18/18 manual and 18/18 automatic produced three finite, positive timing samples each. The two obsolete manual Winograd settings on the topic branch still reportCUDNN_STATUS_NOT_SUPPORTED; there is no silent fallback.6.91e-6over 5,152 values. This is a functional check, not a mixed-precision or performance qualification.Prepared-plan experiments remain on the separate
experiment/cudnn-prepared-plan-20260916branch.