* Copyright (c) 2024 Huawei Technologies Co., Ltd.
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
* CANN Open Software License Agreement Version 2.0 (the "License").
* Please refer to the License for details. You may not use this file except in compliance with the License.
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
* See LICENSE in the root of the software repository for the full text of the License.
*/
#ifndef ASDOPS_PARAMS_MATMUL_H
#define ASDOPS_PARAMS_MATMUL_H
#include <mki/types.h>
#include <mki/utils/SVector/SVector.h>
#include <sstream>
#include <string>
namespace AsdOps {
namespace OpParam {
struct MatMul {
enum class MatMulType : uint32_t {
MATMUL_DEFAULT = 0,
MATMUL_DEQUANT,
MATMUL_ACCUM_ATOMIC,
MATMUL_WITH_BIAS,
MATMUL_EIN_SUM
};
enum class QuantMode : uint32_t {
PER_CHANNEL_SYMM = 0,
PER_CHANNEL_ASYMM,
PER_TOKEN_SYMM
};
bool transposeA = false;
bool transposeB = false;
Mki::SVector<int64_t> oriShape = {0, 0, 0};
bool withBias = false;
bool enDequant = false;
uint32_t tilingN = 0;
uint32_t tilingK = 0;
bool enShuffleK = false;
Mki::TensorDType outDtype = Mki::TENSOR_DTYPE_FLOAT16;
QuantMode quantMode = QuantMode::PER_CHANNEL_SYMM;
MatMulType matmulType = MatMulType::MATMUL_DEFAULT;
bool operator==(const MatMul &other) const
{
return this->transposeA == other.transposeA && this->transposeB == other.transposeB &&
this->oriShape == other.oriShape && this->withBias == other.withBias &&
this->enDequant == other.enDequant && this->tilingN == other.tilingN && this->tilingK == other.tilingK &&
this->outDtype == other.outDtype && this->matmulType == other.matmulType &&
this->quantMode == other.quantMode;
}
};
}
}
#endif