Repository navigation
Benchmarks: Fix cuDNN storage/compute types and FP16 initialization - #852
gusui-msft wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review issues remain.
Pull request overview
Fixes cuDNN storage/compute type handling and FP16 buffer initialization.
Changes:
- Separates convolution compute type from tensor storage type.
- Corrects seeded FP16 host-to-device initialization.
File summaries
| File | Summary |
|---|---|
superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_helper.cpp |
Corrects seeded FP16 initialization and device copy direction. |
superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_config.h |
Preserves independent input and convolution types. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #852 +/- ##
==========================================
- Coverage 86.62% 85.88% -0.74%
==========================================
Files 114 114
Lines 9224 9224
==========================================
- Hits 7990 7922 -68
- Misses 1234 1302 +68
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:
|
Keep storage and convolution compute precision independent, seed and transfer half data correctly, and fix workspace, descriptor, and exception safety. Add native, CLI, and parser regressions and document FP16 baseline migration. Preserve the host-wall timing loop, default cases, and metric names.
Keep independent storage and compute types, seeded half initialization, and two direct native regressions. Defer documentation, parser, resource, stride, and exception-handling changes to separate work.
827d80e to
bb7391a
Compare
| void set_use_tensor_op(bool use_tensor_op) { use_tensor_op_ = use_tensor_op; } | ||
| void set_input_type(const cudnnDataType_t &input_type) { input_type_ = input_type; } | ||
| void set_conv_type(const cudnnDataType_t &conv_type) { input_type_ = conv_type; } | ||
| void set_conv_type(const cudnnDataType_t &conv_type) { conv_type_ = conv_type; } |
There was a problem hiding this comment.
[SHOULD-FIX] Unsupported inputType/convType pairs now abort via an uncaught const char*
With this change, run_benchmark (cudnn_function_helper.h) sees the real (input_type, conv_type) pair. Before, set_conv_type overwrote input_type_, so the final else branch was unreachable. Now pairs such as inputType 0, convType 2 reach:
throw "invalid input and conv type";That throws a const char*. Both run_benchmark and main in cudnn_test.cpp only catch (std::exception &e), so the process calls std::terminate (SIGABRT) and prints no Error: line.
Impact: Custom configs that previously ran (with the wrong types) now abort without a diagnostic. The Python wrapper records only a generic execution failure.
Recommendation:
throw std::invalid_argument("invalid input/conv type combination: inputType=" +
std::to_string(function.get_input_type()) + ", convType=" + std::to_string(function.get_conv_type()));Apply the same fix to the sibling throw "invalid function name" / throw "ERROR: invalid input function name".
| host_input[i] = __float2half((float)std::rand() / (float)(RAND_MAX)); | ||
| } | ||
| CUDA_SAFE_CALL(cudaMemcpy(host_input, *input, sizeof(half) * size, cudaMemcpyHostToDevice)); | ||
| CUDA_SAFE_CALL(cudaMemcpy(*input, host_input, sizeof(half) * size, cudaMemcpyHostToDevice)); |
There was a problem hiding this comment.
[SHOULD-FIX] Default FP16 path becomes live but has no GPU validation or type-separation regression test
Nine default configs in cudnn_function.py use inputType: 2, convType: 0. Before this PR they actually ran <float,float>, so CudnnFunction<half,float> and this rand<half> (with its reversed memcpy) never ran in practice. The PR notes say there was no GPU run after the rebase. test_cudnn_functions only asserts 0 < values[0] < math.inf, so it would still pass if conv_type_ were overwritten again. <half,half> is still not exercised.
Impact: If any default half/float algo or tensor-op combination is unsupported, it yields a -1 timing that only shows up on GPU CI or in production runs.
Recommendation:
- Run
pytest tests/benchmarks/micro_benchmarks/test_cudnn_function.pyon at least one GPU SKU and attach the results. - Add a cheap regression check: emit the resolved types from the binary and assert on them, or add a host-only check that
from_jsonkeepsinput_type=HALF, conv_type=FLOAT. - Optionally add an
inputType 2, convType 2custom case.
| bool get_use_tensor_op() { return use_tensor_op_; } | ||
| cudnnDataType_t &get_input_type() { return input_type_; } | ||
| cudnnDataType_t &get_conv_type() { return input_type_; } | ||
| cudnnDataType_t &get_conv_type() { return conv_type_; } |
There was a problem hiding this comment.
[NON-BLOCKING] inputtype_2 metrics change meaning without changing names
_process_raw_result builds metric names from the requested config. This fix changes what *_inputtype_2_*_time actually measures (from FP32/FP32 to FP16 storage with FP32 compute) while keeping the same names.
Impact: Historical baselines and diagnosis rules will show a step change that looks like a regression or improvement.
Recommendation: Add a release note naming the affected metrics and the revision boundary, and refresh the stored cudnn-function baselines.
Description
Fix the cuDNN configuration's convolution compute type without overwriting the tensor storage type. Previously, requesting FP16 storage with FP32 compute changed
input_type_to FP32, so dispatch could execute FP32 while the configuration still described FP16.Correct FP16 dispatch also exposes the half initializer's reversed host-to-device copy arguments. This PR includes the necessary initialization fix.
Major Revision
set_conv_type()andget_conv_type()useconv_type_independently ofinput_type_.Minor Revision
Validation
mainat5411041d809c7573984acdc2a989057b589b8366on September 11; published head isbb7391a9e6796604f0e250e1ef38d84595b31e17.git diff --checkpasses.