* Copyright (c) 2026 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.
*/
* \file flat_quant_basic_cmct.h
* \brief
*/
#ifndef FLAT_QUANT_BASIC_CMCT_H
#define FLAT_QUANT_BASIC_CMCT_H
#include "cmct/block/block_scheduler_policy.h"
#include "cmct/block/block_scheduler_utils.h"
#include "cmct/kernel/kernel_flat_quant.h"
#include "block_scheduler_flat_quant.h"
namespace FlatQuantNS {
using namespace Cmct;
using namespace Cmct::Gemm;
template <class X_TYPE, class Y_TYPE, class SCALE_TYPE, class C_LAYOUT>
__aicore__ inline void FlatQuantCmctKernel(
GM_ADDR aGM, GM_ADDR p1GM, GM_ADDR p2GM, GM_ADDR cGM, GM_ADDR scaleGM, GM_ADDR workspaceGM,
const FlatQuantTilingData& tilingData)
{
using L1TileShape = AscendC::Shape<_0, _0, _0>;
using L0TileShape = AscendC::Shape<_0, _0, _0>;
using AType = X_TYPE;
using BType = X_TYPE;
using BiasType = SCALE_TYPE;
using OutType = Y_TYPE;
using LayoutA = C_LAYOUT;
using LayoutB = C_LAYOUT;
using LayoutC = C_LAYOUT;
using BlockScheduler = BuiltInFlatQuantScheduler;
using DispatchPolicy = MatmulFlatQuant<>;
using BlockMmad = Block::BlockMmadBuilder<
AType, LayoutA, BType, LayoutB, OutType, LayoutC, BiasType, LayoutC, L1TileShape, L0TileShape, BlockScheduler,
DispatchPolicy>;
using FusionOp = Block::DefaultFusion<OutType, OutType>;
using BlockEpilogue = Block::BlockEpilogueFlatQuant<AType, OutType, BiasType, DispatchPolicy>;
using ProblemShape = MatmulShape;
using MatmulKernel = Kernel::KernelFlatQuant<ProblemShape, BlockMmad, BlockEpilogue, BlockScheduler>;
using Params = typename MatmulKernel::Params;
Params params = {
{tilingData.M, tilingData.N, tilingData.N, tilingData.K},
{aGM, p1GM, p2GM},
{cGM, scaleGM},
{&tilingData}};
MatmulKernel mm;
mm(params);
}
}
#endif