Fix some prefast warnings (#12936)

This commit is contained in:
Hariharan Seshadri 2022-09-13 13:04:37 -07:00 committed by GitHub
parent 64466c2d62
commit 9edc9465f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -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;

View file

@ -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));

View file

@ -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];
}
}
@ -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];
}
}