diff --git a/superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_config.h b/superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_config.h index 913ec7fc8..0343255b5 100644 --- a/superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_config.h +++ b/superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_config.h @@ -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; } void set_function(const std::string &str) { function_str_ = str; } void set_auto_algo(bool auto_algo) { auto_algo_ = auto_algo; } @@ -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_; } std::string &get_name() { return name; } cudnn_function_name_enum get_e_name() { return e_name; } std::string &get_function_str() { return function_str_; } diff --git a/superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_helper.cpp b/superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_helper.cpp index 26b8877c2..b0e8aa2a5 100644 --- a/superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_helper.cpp +++ b/superbench/benchmarks/micro_benchmarks/cudnn_function/cudnn_helper.cpp @@ -77,10 +77,11 @@ template <> void rand(half **input, std::vector 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)); CUDA_SAFE_CALL(cudaFreeHost(host_input)); } } // namespace cudnn_test