mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
Fix some warnings in mlas (#10034)
This commit is contained in:
parent
af71da0ac6
commit
e0a0f385bb
12 changed files with 66 additions and 27 deletions
|
|
@ -1016,7 +1016,10 @@ Return Value:
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 26451)
|
||||
#endif
|
||||
void
|
||||
MLASCALL
|
||||
MlasConvPrepare(
|
||||
|
|
@ -1289,3 +1292,6 @@ Return Value:
|
|||
*WorkingBufferSize = TargetThreadCount * MLAS_CONV_WORKING_BUFFER_SIZE_PER_THREAD;
|
||||
}
|
||||
}
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
|
@ -803,7 +803,10 @@ Return Value:
|
|||
Data->alpha, A, lda, B, ldb, Data->beta, C, ldc);
|
||||
}
|
||||
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 26451)
|
||||
#endif
|
||||
void
|
||||
MLASCALL
|
||||
MlasGemmBatch(
|
||||
|
|
@ -880,5 +883,7 @@ MlasGemmBatch(
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ MlasQLinearAddKernelAvx2Helper(
|
|||
if (k > 0) {
|
||||
const __m256i mask = _mm256_cmpgt_epi32(_mm256_set1_epi32(k), _mm256_set_epi32(7, 6, 5, 4, 3, 2, 1, 0));
|
||||
_mm256_maskstore_epi32((int*)OutputC, mask, vc);
|
||||
OutputC += k * 4;
|
||||
OutputC += static_cast<ptrdiff_t>(k) * 4;
|
||||
}
|
||||
|
||||
int r = static_cast<int>(n % 4);
|
||||
|
|
|
|||
|
|
@ -933,6 +933,11 @@ MlasPartitionWork(
|
|||
//
|
||||
// Helpers to cast a floating point type to and from an integer bit format.
|
||||
//
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#pragma warning(push)
|
||||
// VC++ suggests we can attempt to make 'MlasBitsOfFp32' constexpr, but it is not valid.
|
||||
#pragma warning(disable:26497)
|
||||
#endif
|
||||
|
||||
MLAS_FORCEINLINE
|
||||
uint32_t
|
||||
|
|
@ -961,7 +966,9 @@ MlasFp32FromBits(
|
|||
u.IntegerValue = IntegerValue;
|
||||
return u.FloatValue;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#if defined(MLAS_TARGET_WASM_SCALAR)
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ void
|
|||
|
||||
struct MLAS_MAXIMUM_POOLING
|
||||
{
|
||||
static float InitialValue()
|
||||
static constexpr float InitialValue()
|
||||
{
|
||||
return std::numeric_limits<float>::lowest();
|
||||
}
|
||||
|
|
@ -76,7 +76,7 @@ struct MLAS_MAXIMUM_POOLING
|
|||
return MlasBroadcastFloat32x4(InitialValue());
|
||||
}
|
||||
|
||||
static float Reduce(float Reduction, float Value)
|
||||
static constexpr float Reduce(float Reduction, float Value)
|
||||
{
|
||||
return std::max(Reduction, Value);
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ struct MLAS_MAXIMUM_POOLING
|
|||
return MlasReduceMaximumFloat32x4(Reduction);
|
||||
}
|
||||
|
||||
static float AveragePool(float Reduction, float Size)
|
||||
static constexpr float AveragePool(float Reduction, float Size)
|
||||
{
|
||||
MLAS_UNREFERENCED_PARAMETER(Size);
|
||||
|
||||
|
|
@ -147,7 +147,7 @@ struct MLAS_AVERAGE_POOLING
|
|||
return MlasZeroFloat32x4();
|
||||
}
|
||||
|
||||
static float Reduce(float Reduction, float Value)
|
||||
static constexpr float Reduce(float Reduction, float Value)
|
||||
{
|
||||
return Reduction + Value;
|
||||
}
|
||||
|
|
@ -162,7 +162,7 @@ struct MLAS_AVERAGE_POOLING
|
|||
return MlasReduceAddFloat32x4(Reduction);
|
||||
}
|
||||
|
||||
static float AveragePool(float Reduction, float Size)
|
||||
static constexpr float AveragePool(float Reduction, float Size)
|
||||
{
|
||||
return Reduction / Size;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,11 @@ Return Value:
|
|||
{
|
||||
MlasGemmBatch(Shape, &DataParams, 1, ThreadPool);
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#pragma warning(push)
|
||||
// VC++ suggests we can attempt to make 'MlasBitsOfFp32' constexpr, but it is not valid.
|
||||
#pragma warning(disable : 26451)
|
||||
#endif
|
||||
void
|
||||
MLASCALL
|
||||
MlasGemmBatch(
|
||||
|
|
@ -216,7 +220,9 @@ MlasGemmBatch(
|
|||
MlasGemmQuantThreaded(&WorkBlock, &Shape, &DataParams[gemm_i], blk_i);
|
||||
});
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
size_t
|
||||
MLASCALL
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ MlasGemmQuantTryGemvKernel(
|
|||
}
|
||||
|
||||
template <typename KernelType>
|
||||
MLAS_FORCEINLINE
|
||||
MLAS_FORCEINLINE constexpr
|
||||
int32_t
|
||||
MlasGemmQuantFixupZeroPointA(
|
||||
int32_t ZeroPointA,
|
||||
|
|
@ -84,7 +84,7 @@ MlasGemmQuantFixupZeroPointA(
|
|||
}
|
||||
|
||||
template<typename KernelType>
|
||||
int32_t
|
||||
int32_t constexpr
|
||||
MlasGemmQuantFixupZeroPointB(
|
||||
int32_t ZeroPointB,
|
||||
bool BIsSigned
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ MlasGemmQuantTryGemvKernel<MLAS_GEMM_U8S8_KERNEL_AVX2>(
|
|||
}
|
||||
|
||||
template<>
|
||||
MLAS_FORCEINLINE
|
||||
MLAS_FORCEINLINE constexpr
|
||||
int32_t
|
||||
MlasGemmQuantFixupZeroPointB<MLAS_GEMM_U8S8_KERNEL_AVX2>(
|
||||
int32_t ZeroPointB,
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ constexpr MLAS_GEMM_QUANT_STRIDES MLAS_GEMM_QUANT_KERNEL_DEFAULT::Strides;
|
|||
constexpr MLAS_GEMM_QUANT_STRIDES MLAS_GEMM_QUANT_KERNEL_DEFAULT::PackedStrides;
|
||||
|
||||
template<>
|
||||
MLAS_FORCEINLINE
|
||||
MLAS_FORCEINLINE constexpr
|
||||
int32_t
|
||||
MlasGemmQuantFixupZeroPointA<MLAS_GEMM_QUANT_KERNEL_DEFAULT>(
|
||||
int32_t ZeroPointA,
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ constexpr size_t MLAS_GEMM_U8X8_KERNEL_SSE::PackedK;
|
|||
constexpr MLAS_GEMM_QUANT_STRIDES MLAS_GEMM_U8X8_KERNEL_SSE::Strides;
|
||||
|
||||
template<>
|
||||
MLAS_FORCEINLINE
|
||||
MLAS_FORCEINLINE constexpr
|
||||
int32_t
|
||||
MlasGemmQuantFixupZeroPointB<MLAS_GEMM_U8X8_KERNEL_SSE>(
|
||||
int32_t ZeroPointB,
|
||||
|
|
|
|||
|
|
@ -624,28 +624,37 @@ MlasQLinearGlobalAveragePoolNhwcSingleBatch(
|
|||
#if defined(MLAS_TARGET_IX86)
|
||||
switch (ImageSize) {
|
||||
case 1:
|
||||
i1 = ZeroBuffer; /* fall through */
|
||||
i1 = ZeroBuffer;
|
||||
[[fallthrough]];
|
||||
case 2:
|
||||
i2 = ZeroBuffer; /* fall through */
|
||||
i2 = ZeroBuffer;
|
||||
[[fallthrough]];
|
||||
case 3:
|
||||
i3 = ZeroBuffer; /* fall through */
|
||||
i3 = ZeroBuffer;
|
||||
[[fallthrough]];
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#else
|
||||
switch (ImageSize) {
|
||||
case 1:
|
||||
i1 = ZeroBuffer; /* fall through */
|
||||
i1 = ZeroBuffer;
|
||||
[[fallthrough]];
|
||||
case 2:
|
||||
i2 = ZeroBuffer; /* fall through */
|
||||
i2 = ZeroBuffer;
|
||||
[[fallthrough]];
|
||||
case 3:
|
||||
i3 = ZeroBuffer; /* fall through */
|
||||
i3 = ZeroBuffer;
|
||||
[[fallthrough]];
|
||||
case 4:
|
||||
i4 = ZeroBuffer; /* fall through */
|
||||
i4 = ZeroBuffer;
|
||||
[[fallthrough]];
|
||||
case 5:
|
||||
i5 = ZeroBuffer; /* fall through */
|
||||
i5 = ZeroBuffer;
|
||||
[[fallthrough]];
|
||||
case 6:
|
||||
i6 = ZeroBuffer; /* fall through */
|
||||
i6 = ZeroBuffer;
|
||||
[[fallthrough]];
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1552,7 +1552,10 @@ Return Value:
|
|||
DataParams->alpha, A, lda, B, ldb, DataParams->beta, C, ldc);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 26451)
|
||||
#endif
|
||||
void
|
||||
MLASCALL
|
||||
MlasGemmBatch(
|
||||
|
|
@ -1631,6 +1634,9 @@ MlasGemmBatch(
|
|||
TransA, TransB, M, N, K, &(Data[GemmIdx]), ThreadIdx);
|
||||
});
|
||||
}
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
size_t
|
||||
MLASCALL
|
||||
|
|
|
|||
Loading…
Reference in a new issue