Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class CudnnConfig {
void set_mode(const cudnnConvolutionMode_t &mode) { mode_ = mode; }
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; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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".

void set_function(const std::string &str) { function_str_ = str; }
void set_auto_algo(bool auto_algo) { auto_algo_ = auto_algo; }

Expand All @@ -96,7 +96,7 @@ class CudnnConfig {
cudnnConvolutionMode_t &get_mode() { return mode_; }
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_; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

std::string &get_name() { return name; }
cudnn_function_name_enum get_e_name() { return e_name; }
std::string &get_function_str() { return function_str_; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ template <> void rand(half **input, std::vector<int> dims_, int random_seed) {
CUDA_SAFE_CALL(cudaMalloc((void **)input, sizeof(half) * size));
half *host_input;
CUDA_SAFE_CALL(cudaMallocHost(&host_input, sizeof(half) * size));
srand(random_seed);
for (int i = 0; i < size; i++) {
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));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.py on 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_json keeps input_type=HALF, conv_type=FLOAT.
  • Optionally add an inputType 2, convType 2 custom case.

CUDA_SAFE_CALL(cudaFreeHost(host_input));
}
} // namespace cudnn_test
Loading