/** * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /*! * \file kernel_tpipe_impl.h * \brief */ #ifndef ASCENDC_MODULE_TPIPE_BASE_H #define ASCENDC_MODULE_TPIPE_BASE_H #include "kernel_tensor_impl.h" #if __CCE_AICORE__ == 100 #include "dav_c100/kernel_operator_common_impl.h" #elif __CCE_AICORE__ == 200 #include "dav_m200/kernel_operator_common_impl.h" #elif __CCE_AICORE__ == 220 #include "dav_c220/kernel_operator_common_impl.h" #include "dav_c220/kfc/kfc_comm.h" #elif __CCE_AICORE__ == 300 #include "dav_m300/kernel_operator_common_impl.h" #elif __CCE_AICORE__ == 310 #include "dav_m300/kernel_operator_common_impl.h" #endif namespace AscendC { // begin base define of tquebind template struct TBufHandleAux { using T = TBufHandle[depth]; }; template <> struct TBufHandleAux<1> { using T = TBufHandle; }; constexpr TEventID INVALID_TEVENTID = (static_cast(-1)); // begin base define of tpipe struct TEventPool { uint64_t eventOccupy; }; struct TPipeBufPool { uint32_t maxAddr; }; #if defined(__CCE_KT_TEST__) && __CCE_KT_TEST__ == 1 struct BufPoolExtra { uint8_t* absAddr; uint32_t phySpace; }; #endif struct TShareBuf { enum class ShareHard : uint8_t { // Redefine to save resources L1 = 0, L0C = 1, UB = 2, MAX, }; int32_t start[static_cast(ShareHard::MAX)]; int32_t maxAddr[static_cast(ShareHard::MAX)]; DEBUG_CODE(uint32_t length[static_cast(ShareHard::MAX)]); }; struct SpmInfo { uint64_t spmAddr; int32_t spmBuffSize; uint8_t spmBufType; }; struct TPipeImpl { struct TEventPool eventPool_[EVENT_NUM]; struct TPipeBufPool bufPool_[static_cast(Hardware::MAX)]; #if defined(__CCE_KT_TEST__) && __CCE_KT_TEST__ == 1 BufPoolExtra bufPoolBaseAddr_[(uint8_t)Hardware::MAX]; #endif struct TBufType buf_[QBUF_MAX_LEN]; TShareBuf shareBufPool_; SpmInfo spmInfo_; // the tscm buffer addr uint32_t tscmBufferPtr_; uint8_t curBufSize_; bool isDestroy; }; constexpr uint32_t defaultBufIDSize = 4; template struct TBufPoolImpl { struct TBufType buf_[bufIDSize]; uint32_t startAddr_; uint32_t maxAddr_; uint32_t maxLen_; uint8_t curBufSize_; uint8_t isReset_; }; } #endif // ASCENDC_MODULE_TPIPE_BASE_H