mirror of
https://github.com/opencv/opencv.git
synced 2026-07-21 19:33:03 +04:00
Fixed MLAS build with older versions of GCC.
This commit is contained in:
Vendored
+3
-3
@@ -313,7 +313,7 @@ operator!=(const MLFloat16& left, const MLFloat16& right)
|
||||
|
||||
#endif // BUILD_MLAS_NO_ONNXRUNTIME
|
||||
|
||||
static_assert(sizeof(MLAS_FP16) == FP16_SIZE);
|
||||
static_assert(sizeof(MLAS_FP16) == FP16_SIZE, "");
|
||||
|
||||
|
||||
//
|
||||
@@ -3080,7 +3080,7 @@ MLAS_FORCEINLINE
|
||||
void
|
||||
MlasSetInt4Element(uint8_t* Output, size_t ElemIndex, UnpackedType Value)
|
||||
{
|
||||
static_assert(std::is_same_v<UnpackedType, uint8_t> || std::is_same_v<UnpackedType, int8_t>);
|
||||
static_assert(std::is_same<UnpackedType, uint8_t>::value || std::is_same<UnpackedType, int8_t>::value, "");
|
||||
|
||||
const size_t OutputIndex = ElemIndex >> 1; // which byte
|
||||
const size_t NibbleIndex = ElemIndex & 0x1; // which 4-bit elem in the byte
|
||||
@@ -3097,6 +3097,6 @@ MLAS_FORCEINLINE
|
||||
void
|
||||
MlasPackInt4Elements(uint8_t* Output, UnpackedType ValueLow, UnpackedType ValueHigh)
|
||||
{
|
||||
static_assert(std::is_same_v<UnpackedType, uint8_t> || std::is_same_v<UnpackedType, int8_t>);
|
||||
static_assert(std::is_same<UnpackedType, uint8_t>::value || std::is_same<UnpackedType, int8_t>::value, "");
|
||||
*Output = static_cast<uint8_t>(((ValueHigh & 0xF) << 4) | (ValueLow & 0xF));
|
||||
}
|
||||
|
||||
@@ -335,7 +335,8 @@ struct ModelFusionAttention
|
||||
bool modified = false;
|
||||
std::set<int> removed_ops;
|
||||
|
||||
for (auto& [inp_idx, matmul_indices] : qkv_candidates) {
|
||||
for (auto& candidate : qkv_candidates) {
|
||||
auto matmul_indices = candidate.second;
|
||||
if (matmul_indices.size() < 3) continue;
|
||||
|
||||
for (size_t qi = 0; qi + 2 < matmul_indices.size(); qi++)
|
||||
|
||||
@@ -147,7 +147,8 @@ struct ModelFusionSharedGemm
|
||||
std::set<int> removed_ops;
|
||||
vector<std::pair<int, vector<Ptr<Layer>>>> insertions; // (insert_pos, fused-and-slice layers)
|
||||
|
||||
for (auto& [key, infos] : groups) {
|
||||
for (auto& group : groups) {
|
||||
auto infos = group.second;
|
||||
if (infos.size() < 2) continue;
|
||||
|
||||
bool all_have_bias = infos[0].has_bias;
|
||||
|
||||
Reference in New Issue
Block a user