Skip to content

Commit

Permalink
Fix some prefast warnings (#12936)
Browse files Browse the repository at this point in the history
  • Loading branch information
hariharans29 authored Sep 13, 2022
1 parent 64466c2 commit 9edc946
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Status QOrderedMatMul::QOrderedMatMul::ComputeInternal(OpKernelContext* context)
TensorShape output_shape(tensor_A.Shape());
output_shape[output_shape.NumDimensions() - 1] = cols_B;

const float zero = 0.0f;
constexpr float zero = 0.0f;
const float* scale_C = &zero;

const int8_t* C = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Status QOrdered_MatMul(cublasLtHandle_t cublasLt_handle, cudaStream_t stream,
cublasLtMatrixLayout_t desc_D = nullptr;
auto clean_desc_D = gsl::finally([&desc_D]() {if (desc_D) cublasLtMatrixLayoutDestroy(desc_D); });

const float beta_zero = 0.0f;
constexpr float beta_zero = 0.0f;
beta = (C == nullptr ? &beta_zero : beta);

CUBLAS_RETURN_IF_ERROR(cublasLtMatmulDescCreate(&matmul_desc, CUBLAS_COMPUTE_32I, CUDA_R_32F));
Expand Down
4 changes: 2 additions & 2 deletions onnxruntime/core/providers/cuda/math/binary_elementwise_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct BinaryElementwisePreparation {
auto offset = out_rank - lhs_rank;
for (auto i = offset; i < out_rank; ++i) {
// the stride for broadcast dimension is kept as 0
if (lhs_shape.GetDims()[i - offset] != 1) {
if (lhs_shape.GetDims()[static_cast<size_t>(i) - offset] != 1) {
lhs_padded_strides[i] = original_lhs_padded_strides[i];
}
}
Expand All @@ -92,7 +92,7 @@ struct BinaryElementwisePreparation {
auto offset = out_rank - rhs_rank;
for (auto i = offset; i < out_rank; ++i) {
// the stride for broadcast dimension is kept as 0
if (rhs_shape.GetDims()[i - offset] != 1) {
if (rhs_shape.GetDims()[static_cast<size_t>(i) - offset] != 1) {
rhs_padded_strides[i] = original_rhs_padded_strides[i];
}
}
Expand Down

0 comments on commit 9edc946

Please sign in to comment.