Merged
fix(simulation): Remove simulation_ca module #2717
zhengrongguiAdd on Apr 22
fix(simulation): Remove simulation_ca module #2717
Merged
zhengrongguiAdd on Apr 22
Total: 29 files changed+6-2605
@@ -96,7 +96,6 @@ if (ENABLE_FEATURE_PYTHON_FRONT_END)
96 tile_fwk_compiler96 tile_fwk_compiler
97 tile_fwk_runtime97 tile_fwk_runtime
98 tile_fwk_simulation98 tile_fwk_simulation
99- tile_fwk_simulation_ca
100 tile_fwk_simulation_pv99 tile_fwk_simulation_pv
101 )100 )
102 if (BUILD_WITH_CANN)101 if (BUILD_WITH_CANN)
@@ -156,13 +155,6 @@ if (ENABLE_FEATURE_PYTHON_FRONT_END)
156 PATTERN ".svn" EXCLUDE155 PATTERN ".svn" EXCLUDE
157 PATTERN ".git" EXCLUDE156 PATTERN ".git" EXCLUDE
158 )157 )
159- install(DIRECTORY framework/src/cost_model/simulation_ca/mock/
160- DESTINATION ${PyPTO_WhlName}/lib/include/mock
161- PATTERN "*.h"
162- PATTERN "*.hpp"
163- PATTERN ".svn" EXCLUDE
164- PATTERN ".git" EXCLUDE
165- )
166 install(DIRECTORY framework/src/interface/machine/device/tilefwk/158 install(DIRECTORY framework/src/interface/machine/device/tilefwk/
167 DESTINATION ${PyPTO_WhlName}/lib/include/tilefwk159 DESTINATION ${PyPTO_WhlName}/lib/include/tilefwk
168 PATTERN "*.h"160 PATTERN "*.h"
@@ -24,7 +24,6 @@ recursive-include framework/src/utils *
24recursive-include framework/src/adapter *24recursive-include framework/src/adapter *
25recursive-include framework/src/codegen *25recursive-include framework/src/codegen *
26recursive-include framework/src/cost_model/simulation *26recursive-include framework/src/cost_model/simulation *
27-recursive-include framework/src/cost_model/simulation_ca *
28recursive-include framework/src/cost_model/simulation_pv *27recursive-include framework/src/cost_model/simulation_pv *
29include framework/src/cost_model/CMakeLists.txt28include framework/src/cost_model/CMakeLists.txt
30recursive-include framework/src/interface *29recursive-include framework/src/interface *
@@ -172,27 +172,6 @@
172 ]172 ]
173 }173 }
174 },174 },
175- "libtile_fwk_simulation_ca.so": {
176- "Source-Header": {
177- "Self": [
178- "framework/src/cost_model/simulation_ca/"
179- ],
180- "Area": [
181- "framework/src/interface/",
182- "framework/src/passes/",
183- "framework/src/codegen/",
184- "framework/src/cost_model/simulation/"
185- ],
186- "Include": [
187- "framework/include/"
188- ],
189- "WhiteList": [
190- ],
191- "BlackList": [
192- "framework/src/interface/tileop/"
193- ]
194- }
195- },
196 "libtile_fwk_utils.so": {175 "libtile_fwk_utils.so": {
197 "Source-Header": {176 "Source-Header": {
198 "Self": [177 "Self": [
@@ -55,9 +55,6 @@
551. 请在`output/output_xxx/CostModelSimulationOutput/graphs`下的找到报错对应的dot文件进行分析551. 请在`output/output_xxx/CostModelSimulationOutput/graphs`下的找到报错对应的dot文件进行分析
562. 如果还无法定位到根因请联系管理员解决562. 如果还无法定位到根因请联系管理员解决
57 57 
58-#### FUNC_NOT_SUPPORT
59-1. 请在`framework/src/cost_model/simulation_ca/A2A3/model/def.h`的GetProgram中增加新的cce指令
60- 
61 58 
62 59 
63### PRECISION_SIM60### PRECISION_SIM
@@ -510,7 +510,6 @@ enum class ForwardSimErrorScene : uint32_t {
510 INVALID_PIPE_TYPE = 92001U,510 INVALID_PIPE_TYPE = 92001U,
511 INVALID_DATA_TYPE = 92002U,511 INVALID_DATA_TYPE = 92002U,
512 DEAD_LOCK = 92003U,512 DEAD_LOCK = 92003U,
513- FUNC_NOT_SUPPORT = 92004U,
514 UNKNOWN = 92099U513 UNKNOWN = 92099U
515};514};
516 515 
@@ -9,5 +9,4 @@
9# -----------------------------------------------------------------------------------------------------------9# -----------------------------------------------------------------------------------------------------------
10 10 
11add_subdirectory(simulation)11add_subdirectory(simulation)
12-add_subdirectory(simulation_ca)
13add_subdirectory(simulation_pv)12add_subdirectory(simulation_pv)
@@ -26,35 +26,10 @@
26#include "cost_model/simulation/arch/A5/PostSimulatorA5.h"26#include "cost_model/simulation/arch/A5/PostSimulatorA5.h"
27 27 
28namespace CostModel {28namespace CostModel {
29-UnifiedPipeMachinePtr CreatePipeSimulator(const std::string& simulator)
30-{
31- std::string soPath = "libtile_fwk_simulation_ca.so";
32- void* handle = dlopen(soPath.c_str(), RTLD_LAZY);
33- if (!handle) {
34- throw std::runtime_error("can not load library: " + std::string(dlerror()));
35- }
36- 
37- // 获取工厂函数符号
38- using CreateFunc = UnifiedPipeMachinePtr (*)();
39- std::string funcName = "CreatePipeSimulator" + simulator;
40- auto createFunc = (CreateFunc)(dlsym(handle, funcName.c_str()));
41- if (!createFunc) {
42- dlclose(handle);
43- throw std::runtime_error("can not find the factory func: " + std::string(dlerror()));
44- }
45- 
46- // 创建对象并返回
47- return createFunc();
48-}
49- 
50UnifiedPipeMachinePtr CreateSimulator(const std::string& archType, int accLevel)29UnifiedPipeMachinePtr CreateSimulator(const std::string& archType, int accLevel)
51{30{
52- if (archType == "A2A3") {31+ if (archType == "A2A3" && accLevel == 1) {
53- if (accLevel == 1) {32+ return CreatePipeSimulatorFast<PostSimulatorA2A3>();
54- return CreatePipeSimulatorFast<PostSimulatorA2A3>();
55- } else {
56- return CreatePipeSimulator("SimulatorA2A3");
57- }
58 } else if (archType == "A5" && accLevel == 1) {33 } else if (archType == "A5" && accLevel == 1) {
59 return CreatePipeSimulatorFast<PostSimulatorA5>();34 return CreatePipeSimulatorFast<PostSimulatorA5>();
60 } else {35 } else {
@@ -1,33 +0,0 @@
1-/**
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3- * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4- * CANN Open Software License Agreement Version 2.0 (the "License").
5- * Please refer to the License for details. You may not use this file except in compliance with the License.
6- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7- * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8- * See LICENSE in the root of the software repository for the full text of the License.
9- */
10- 
11-/*!
12- * \file SimulatorA2A3.cpp
13- * \brief
14- */
15- 
16-#include "SimulatorA2A3.h"
17-#include "cost_model/simulation_ca/A2A3/model/pipe.h"
18- 
19-namespace CostModel {
20-using namespace std;
21-uint64_t SimulatorA2A3::Run(std::vector<std::string> program)
22-{
23- auto prog = GetProgram(program);
24- auto pipe = std::make_shared<CostModelPipe>("cost", 0, 0);
25- uint32_t baseLatency = 0;
26- uint32_t rLatency = 307;
27- uint32_t wLatency = 153;
28- pipe->SetReadGmFactor(rLatency + baseLatency);
29- pipe->SetWriteGmFactor(wLatency + baseLatency);
30- uint64_t ret = pipe->GetOpCycle(prog);
31- return ret;
32-}
33-} // namespace CostModel
@@ -1,27 +0,0 @@
1-/**
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3- * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4- * CANN Open Software License Agreement Version 2.0 (the "License").
5- * Please refer to the License for details. You may not use this file except in compliance with the License.
6- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7- * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8- * See LICENSE in the root of the software repository for the full text of the License.
9- */
10- 
11-/*!
12- * \file SimulatorA2A3.h
13- * \brief
14- */
15- 
16-#pragma once
17- 
18-#include "cost_model/simulation/arch/Simulator.h"
19- 
20-namespace CostModel {
21-class SimulatorA2A3 : public Simulator {
22-public:
23- uint64_t Run(std::vector<std::string> program) override;
24- const int rGmLatency = 0;
25- const int wGmLatency = 0;
26-};
27-} // namespace CostModel
@@ -1,586 +0,0 @@
1-/**
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3- * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4- * CANN Open Software License Agreement Version 2.0 (the "License").
5- * Please refer to the License for details. You may not use this file except in compliance with the License.
6- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7- * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8- * See LICENSE in the root of the software repository for the full text of the License.
9- */
10- 
11-/*!
12- * \file pipe.cpp
13- * \brief
14- */
15- 
16-#include "pipe.h"
17-namespace CostModel {
18- 
19-using namespace std;
20- 
21-CostModelPipe::CostModelPipe(const std::string& moduleName, const uint32_t coreId, const uint32_t pipeId)
22- : pipeName(moduleName), coreId_(coreId), pipeId_(pipeId)
23-{}
24- 
25-CostModelPipe::~CostModelPipe() {}
26- 
27-bool CostModelPipe::Build() const { return true; }
28- 
29-void CostModelPipe::Attach(
30- const function<void(const uint32_t, const uint32_t, const uint32_t)>& popSetFlag,
31- const function<void(const uint32_t, const uint32_t, const uint32_t)>& rlsSetFlag,
32- const function<bool(const uint32_t, const uint32_t, const uint32_t)>& getFlag,
33- const std::function<void(const PInstrParam&)>& dump, const std::function<void(const uint32_t)>& retire)
34-{
35- popSetFlag_ = popSetFlag;
36- rlsSetFlag_ = rlsSetFlag;
37- getFlag_ = getFlag;
38- dump_ = dump;
39- retire_ = retire;
40-}
41- 
42-void CostModelPipe::AttachClk(const std::function<uint64_t()>& time) { time_ = time; }
43- 
44-uint64_t CostModelPipe::GetTime() const { return time_ ? time_() : tick_; }
45- 
46-bool CostModelPipe::IsqFull() const { return isqOtsd_ >= isqMaxOtsd_; }
47- 
48-bool CostModelPipe::IsqEmpty() const { return isq_.empty() && module_.empty(); }
49- 
50-void CostModelPipe::Push(const PInstrParam& instr)
51-{
52- if (instr->name == InstrName::SET_FLAG) {
53- popSetFlag_(
54- instr->param.at(static_cast<uint32_t>(SetFlagParam::PIPE)),
55- instr->param.at(static_cast<uint32_t>(SetFlagParam::TRIGGER_PIPE)),
56- instr->param.at(static_cast<uint32_t>(SetFlagParam::EVENT_ID)));
57- } else {
58- isqOtsd_++;
59- }
60- isq_.push_back(instr);
61-}
62- 
63-uint64_t CostModelPipe::GetOpCycle(std::deque<PInstrParam>& program)
64-{
65- if (program.empty()) {
66- return 1;
67- }
68- tick_ = 0;
69- while (!program.empty()) {
70- if (!module_.empty()) {
71- auto instr = module_.front();
72- if (instr->endTime <= tick_) {
73- module_.pop_front();
74- }
75- }
76- auto instr = program.front();
77- if (instr->name == InstrName::WAIT_FLAG || instr->name == InstrName::SET_FLAG ||
78- instr->name == InstrName::BAR) {
79- if (module_.empty()) {
80- program.pop_front();
81- }
82- } else {
83- CalcInstrLatency(instr);
84- module_.push_back(instr);
85- program.pop_front();
86- }
87- ++tick_;
88- }
89- uint64_t endCycle = tick_;
90- if (!module_.empty()) {
91- endCycle = max(module_.back()->endTime, tick_);
92- }
93- module_.clear();
94- return endCycle;
95-}
96- 
97-void CostModelPipe::DisPatch()
98-{
99- if (isq_.empty()) {
100- return;
@@ -1,121 +0,0 @@
1-/**
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3- * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4- * CANN Open Software License Agreement Version 2.0 (the "License").
5- * Please refer to the License for details. You may not use this file except in compliance with the License.
6- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7- * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8- * See LICENSE in the root of the software repository for the full text of the License.
9- */
10- 
11-/*!
12- * \file pipe.h
13- * \brief
14- */
15- 
16-#ifndef __COST_MODEL_PIPE__
17-#define __COST_MODEL_PIPE__
18- 
19-#include <unordered_map>
20-#include "def.h"
21-#include "cost_model/simulation/common/CommonType.h"
22-namespace CostModel {
23-class CostModelPipe {
24-public:
25- CostModelPipe(const std::string& moduleName, const uint32_t coreId, const uint32_t pipeId);
26- virtual ~CostModelPipe();
27- bool Build() const;
28- void Attach(
29- const std::function<void(const uint32_t, const uint32_t, const uint32_t)>& popSetFlag
30- /* pipeId, triggerPipeId, eventId */,
31- const std::function<void(const uint32_t, const uint32_t, const uint32_t)>& rlsSetFlag
32- /* pipeId, triggerPipeId, eventId */,
33- const std::function<bool(const uint32_t, const uint32_t, const uint32_t)>& getFlag
34- /* pipeId, triggerPipeId, eventId */,
35- const std::function<void(const PInstrParam&)>& dump, const std::function<void(const uint32_t)>& retire);
36- bool IsqFull() const;
37- bool IsqEmpty() const;
38- void Push(const PInstrParam& instr);
39- inline std::string Name() const { return pipeName; }
40- void DisPatch();
41- void Release();
42- 
43- void AttachClk(const std::function<uint64_t()>& time);
44- uint64_t GetOpCycle(std::deque<PInstrParam>& program);
45- inline void SetReadGmFactor(const uint32_t factor) { ddrRdLatency_ = factor; }
46- inline uint32_t GetReadGmFactor() const { return ddrRdLatency_; }
47- inline void SetWriteGmFactor(const uint32_t factor) { ddrWrLatency_ = factor; }
48- inline uint32_t GetWriteGmFactor() const { return ddrWrLatency_; }
49- 
50-private:
51- void CalcInstrLatency(PInstrParam& instr);
52- void CalcNdNzOutL1(PInstrParam& instr);
53- void CalcMovOutUb(PInstrParam& instr);
54- void CalcMovUbOut(PInstrParam& instr);
55- void CalcMovOutUbAlign(PInstrParam& instr);
56- void CalcMovUbOutAlign(PInstrParam& instr);
57- void CalcLoad2d(PInstrParam& instr);
58- void CalcLoad3d(PInstrParam& instr);
59- void CalcFixL0cOut(PInstrParam& instr);
60- void CalcVcadd(PInstrParam& instr);
61- void CalcMoveMask(PInstrParam& instr);
62- void CalcVecOp(PInstrParam& instr);
63- void CalcVconv(PInstrParam& instr);
64- void CalcMovUbUb(PInstrParam& instr);
65- void CalcMmad(PInstrParam& instr);
66- void CalcVnchwconv(PInstrParam& instr);
67- void CalcVreducev2(PInstrParam& instr);
68- void CalcMoveVa(PInstrParam& instr);
69- void CalcLd(PInstrParam& instr);
70- void CalcSt(PInstrParam& instr);
71- void CalcAlu(PInstrParam& instr);
72- uint64_t GetTime() const;
73- 
74-private:
75- const std::string pipeName;
76- const uint32_t coreId_ = 0;
77- const uint32_t pipeId_;
78- std::deque<PInstrParam> isq_;
79- std::deque<PInstrParam> module_;
80- uint32_t isqOtsd_ = 0;
81- const uint32_t isqMaxOtsd_ = 32;
82- uint32_t ddrRdLatency_ = 347;
83- const uint32_t ddrRdLatencyDiver_ = 4;
84- uint32_t ddrWrLatency_ = 203;
85- const uint32_t ddrWrLatencyDiver_ = 4;
86- const uint32_t ddrRdBandWidth_ = 87;
87- const uint32_t ddrWrBandWidth_ = 87;
88- const uint32_t l0aWrBandWidth_ = 256;
89- const uint32_t l0bWrBandWidth_ = 128;
90- const uint32_t l1WrBandWidth_ = 256;
91- const uint32_t l0cRdBandWidth_ = 128;
92- const uint32_t ubRdBandWidth_ = 128;
93- const uint32_t ubWrBandWidth_ = 128;
94- const uint32_t dmaUeLatency_ = 9;
95- const uint32_t load2dUeLatency_ = 9;
96- const uint32_t load3dUeLatency_ = 27;
97- const uint32_t cubeStateLatency_ = 20;
98- const uint32_t vecDelay_ = 15;
99- const uint32_t vecRmwDelay_ = 7;
100- const uint32_t fracSize = 512;
101- const uint32_t vecRptSize = 256;
102- const uint32_t bL4 = 512;
103- const uint32_t bL2 = 256;
104- const uint32_t bL1 = 128;
105- std::function<void(const uint32_t, const uint32_t, const uint32_t)> popSetFlag_ = nullptr;
106- std::function<void(const uint32_t, const uint32_t, const uint32_t)> rlsSetFlag_ = nullptr;
107- std::function<bool(const uint32_t, const uint32_t, const uint32_t)> getFlag_ = nullptr;
108- std::function<void(const PInstrParam&)> dump_ = nullptr;
109- std::function<uint64_t()> time_ = nullptr;
110- std::function<void(const uint32_t)> retire_ = nullptr;
111- static std::unordered_map<InstrName, std::function<void(CostModelPipe*, PInstrParam&)>> getLatency_;
112- uint64_t tick_ = 0;
113- uint64_t sprNdParam_ = 0;
114-};
115- 
116-extern "C" {
117-int GetTileOpCycle(const char* input);
118-}
119-} // namespace CostModel
120- 
121-#endif
@@ -1,33 +0,0 @@
1-# -----------------------------------------------------------------------------------------------------------
2-# Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
3-# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4-# CANN Open Software License Agreement Version 2.0 (the "License").
5-# Please refer to the License for details. You may not use this file except in compliance with the License.
6-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7-# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8-# See LICENSE in the root of the software repository for the full text of the License.
9-# -----------------------------------------------------------------------------------------------------------
10- 
11- 
12-file(GLOB_RECURSE _Ca_Model_Srcs *.cpp)
13-#PTO_Fwk_Debug_Source_List(NAME "_Ca_Model_Srcs" LIST ${_Ca_Model_Srcs} DETAIL ON)
14- 
15-add_library(tile_fwk_simulation_ca SHARED)
16-target_sources(tile_fwk_simulation_ca PRIVATE ${_Ca_Model_Srcs})
17-target_include_directories(tile_fwk_simulation_ca
18- PRIVATE
19- ${PTO_FWK_SRC_ROOT}/framework/src/cost_model
20-)
21-target_link_libraries(tile_fwk_simulation_ca
22- PUBLIC
23- $<$<BOOL:${ENABLE_COMPILE_DEPENDENCY_CHECK}>:tile_fwk_utils>
24- $<$<BOOL:${ENABLE_COMPILE_DEPENDENCY_CHECK}>:tile_fwk_codegen>
25- $<$<BOOL:${ENABLE_COMPILE_DEPENDENCY_CHECK}>:tile_fwk_simulation>
26- PRIVATE
27- intf_pub_cxx17
28- tile_fwk_intf_pub
29- c_sec
30- json
31-)
32-PTO_Fwk_AnalysisTargetHeaderFiles(TARGET tile_fwk_simulation_ca)
33-PTO_Fwk_AnalysisTargetSymbols(TARGET tile_fwk_simulation_ca)
@@ -1,256 +0,0 @@
1-/**
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3- * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4- * CANN Open Software License Agreement Version 2.0 (the "License").
5- * Please refer to the License for details. You may not use this file except in compliance with the License.
6- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7- * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8- * See LICENSE in the root of the software repository for the full text of the License.
9- */
10- 
11-/*!
12- * \file PipeSimulator.cpp
13- * \brief
14- */
15- 
16-#include "cost_model/simulation_ca/PipeSimulator.h"
17- 
18-#include <algorithm>
19-#include <fstream>
20-#include <unordered_set>
21- 
22-#include "cost_model/simulation/config/EnvConfig.h"
23-#include "SimulatorAdaptor.h"
24-#include "cost_model/simulation_ca/A2A3/SimulatorA2A3.h"
25-#include "interface/function/function.h"
26-#include "codegen/codegen.h"
27-#include "codegen/codegen_op.h"
28-#include "codegen/codegen_cce.h"
29-#include "codegen/npu/cloudnpu/codegen_cloudnpu.h"
30-#include "codegen/npu/cloudnpu/codegen_op_cloudnpu.h"
31-#include "cost_model/simulation/arch/SimplifiedMemoryAllocator.h"
32-#include "cost_model/simulation/arch/PipeSimulatorFast.h"
33-#include "cost_model/simulation/arch/A2A3/PostSimulatorA2A3.h"
34-#include "tilefwk/error_code.h"
35-#include "interface/utils/file_utils.h"
36-#include "tilefwk/pypto_fwk_log.h"
37-#include "tilefwk/error.h"
38-#include "tilefwk/file.h"
39- 
40-namespace CostModel {
41-template class PipeSimulator<SimulatorA2A3>;
42- 
43-static std::string GenerateBuf(const TileOpPtr& tileOp)
44-{
45- std::shared_ptr<SimplifiedMemoryAllocator> memoryAllocator = std::make_shared<SimplifiedMemoryAllocator>();
46- auto locToOffsetMap = GenRealizeIdMap(tileOp->funcPtr->parentFunction->GetParameter());
47- CodeGenCtx ctx;
48- CodeGenCloudNPU cga(ctx);
49- auto genExtraAllocForTensor = [&cga,
50- &memoryAllocator](const std::shared_ptr<LogicalTensor>& operand) -> std::string {
51- std::optional<std::string> allocCodeMaybe = cga.GenExtraAlloc(memoryAllocator, operand);
52- if (allocCodeMaybe.has_value()) {
53- return allocCodeMaybe.value();
54- }
55- return "";
56- };
57- for (const std::shared_ptr<LogicalTensor>& operand : (tileOp->operation)->GetIOperands()) {
58- memoryAllocator->AddToTensorMap(operand->GetMagic(), operand);
59- genExtraAllocForTensor(operand);
60- }
61- for (const std::shared_ptr<LogicalTensor>& operand : (tileOp->operation)->GetOOperands()) {
62- memoryAllocator->AddToTensorMap(operand->GetMagic(), operand);
63- genExtraAllocForTensor(operand);
64- }
65- tileOp->funcPtr->parentFunction->SetFunctionType(npu::tile_fwk::FunctionType::DYNAMIC_LOOP_PATH);
66- CodeGenOpCloudNPU cop(
67- {memoryAllocator, *tileOp->funcPtr->parentFunction, *tileOp->funcPtr->parentFunction, *(tileOp->operation),
68- locToOffsetMap});
69- return cop.GenOpCode();
70-}
71- 
72-static bool GenerateCode(const std::string& buffer, std::string fileName)
73-{
74- size_t lastSlash = fileName.find_last_of("/\\");
75- std::string dirPart = (lastSlash == std::string::npos) ? "" : fileName.substr(0, lastSlash);
76- CHECK(npu::tile_fwk::IsPathExist(dirPart))
77- << "ErrCode: F" << static_cast<unsigned>(CostModel::ExternalErrorScene::INVALID_PATH)
78- << ", Error: invalid dir path: " << dirPart;
79- std::ofstream os(fileName);
80- if (!os.is_open()) {
81- SIMULATION_LOGE(
82- "ErrCode: F%u, Error: fail to open file: %s",
83- static_cast<unsigned>(CostModel::ExternalErrorScene::FILE_OPEN_FAILED), fileName.c_str());
84- return false;
85- }
86- 
87- os << "#include <iostream>" << std::endl;
88- os << "#include \"mock_inst.h\"" << std::endl;
89- os << "#include \"aicore_runtime.h\"" << std::endl;
90- os << "#include \"vector_dyn.h\"" << std::endl;
91- os << "#include \"cube_dyn.h\"" << std::endl;
92- os << "#include \"mte_dyn.h\"" << std::endl;
93- os << "int main(int argc, char **argv) {" << std::endl;
94- os << "char charArray1[65536] = {0};" << std::endl;
95- os << "char* charArrayPtr1 = charArray1;" << std::endl;
96- os << "char charArray2[65536] = {0};" << std::endl;
97- os << "char* charArrayPtr2 = charArray2;" << std::endl;
98- os << "char charArray3[256] = {0};" << std::endl;
99- os << "char* charArrayPtr3 = charArray3;" << std::endl;
100- os << "char charArray4[256] = {0};" << std::endl;
101- os << "char* charArrayPtr4 = charArray4;" << std::endl;
102- os << "" << buffer;
103- os << "return 0;" << std::endl;
104- os << "}" << std::endl;
105- os.close();
106- return true;
107-}
108- 
109-std::vector<std::string> RunExeAndCaptureOutput(const std::string& exePath)
110-{
111- std::vector<std::string> outputLines;
112- CHECK(npu::tile_fwk::FileExist(exePath))
113- << "ErrCode: F" << static_cast<unsigned>(CostModel::ExternalErrorScene::INVALID_PATH)
114- << ", EXE File does not exist. exePath: " << exePath;
115- FILE* pipe = popen(exePath.c_str(), "r");
116- if (!pipe) {
117- SIMULATION_LOGE("run error");
118- return outputLines;
119- }
120- 
121- const int bufferSize = 4096;
122- char buffer[bufferSize];
123- while (fgets(buffer, bufferSize, pipe) != nullptr) {
124- std::string line(buffer);
125- if (!line.empty() && line[line.length() - 1] == '\n') {
126- line.erase(line.length() - 1);
127- }
128- outputLines.push_back(line);
129- }
130- 
131- pclose(pipe);
132- return outputLines;
133-}
134- 
135-static std::vector<std::string> CompileAndRunCode(const std::string& source, const EnvConfig& config)
136-{
137- std::string includePath = GetCurrentSharedLibPath() + "/include";
138- std::string cPlusPlus = "g++";
139- 
140- std::string executable = source.substr(0, source.size() - 4);
141- 
142- std::string path_1 = includePath + "/tileop/arch32";
143- std::string path_2 = includePath + "/tileop/arch32/dynamic";
144- std::string path_3 = includePath + "/mock";
145- std::string path_4 = includePath + "/tileop";
146- std::string path_5 = includePath + "/tilefwk";
147- if (!npu::tile_fwk::IsPathExist(path_1) || !npu::tile_fwk::IsPathExist(path_2) ||
148- !npu::tile_fwk::IsPathExist(path_3) || !npu::tile_fwk::IsPathExist(path_4) ||
149- !npu::tile_fwk::IsPathExist(path_5)) {
150- SIMULATION_LOGE(
151- "ErrCode: F%u, Error: invalid include path.",
152- static_cast<unsigned>(CostModel::ExternalErrorScene::INVALID_PATH));
153- }
154- 
155- std::string cmd = config.cPlusPlus + " -w -std=c++17 " + source + " -o " + executable + " " + "-I" + includePath +
156- " " + "-I" + path_1 + " -I" + path_2 + " -I" + path_3 + " -I" + path_4 + " -I" + path_5 +
157- " >/dev/null 2>&1";
158- int result = std::system(cmd.c_str());
159- if (result != 0) {
160- return {};
161- }
162-#ifdef _WIN32
163- std::replace(executable.begin(), executable.end(), '/', '\\');
164- const std::string exePath = executable + ".exe";
165- std::vector<std::string> outputLines = RunExeAndCaptureOutput(exePath);
166-#else
167- std::vector<std::string> outputLines = RunExeAndCaptureOutput(executable);
168-#endif
169- return outputLines;
170-}
171- 
172-template <typename Simulator>
173-uint64_t PipeSimulator<Simulator>::Simulate(const TileOpPtr& tileOp)
174-{
175- if (tileOp->opcode == "RESHAPE" || tileOp->opcode == "VIEW" || tileOp->opcode == "ASSEMBLE" ||
176- tileOp->opcode == "NOP") {
177- SIMULATION_LOGI("ignore reshape op");
178- return 0;
179- }
180- std::string buf = GenerateBuf(tileOp);
181- if (buf == "" || buf == "CODEGEN_ERROR") {
182- SIMULATION_LOGE("can't generate buf");
183- return 0;
184- }
185- int notSize = 3;
186- if (buf.substr(0, notSize) == "NOT") { // NOT HANDLED OP
187- return 0;
188- }
189- 
190- buf = PipeSimulatorUtils::ReplaceGMStr(buf);
191- 
192- auto it = tileopLatencyCacheMp.find(buf);
193- if (it != tileopLatencyCacheMp.end()) {
194- SIMULATION_LOGI("sim: %s latency: %lu\n", it->first.c_str(), it->second);
195- return it->second;
196- }
197- 
198- std::string simulatorDir = "simulator";
199- if (!CreateDir(simulatorDir)) {
200- SIMULATION_LOGE("can't create simulator dir");
201- return 0;
202- }
203- auto func = tileOp->funcPtr;
204- std::string fileHeader(
205- simulatorDir + "/" + tileOp->opcode + std::to_string(tileOp->taskId) + "-" + std::to_string(func->magic) + "-" +
206- std::to_string(tileOp->magic));
207- std::string fileName(fileHeader + ".cpp");
208- bool success = GenerateCode(buf, fileName);
209- if (!success) {
210- SIMULATION_LOGE("can't generate code, buf: %s", buf.c_str());
211- return tileopLatencyCacheMp[buf] = 0;
212- }
213- 
214- EnvConfig config;
215- std::vector<std::string> program = CompileAndRunCode(fileName, config);
216- if (program.empty()) {
217- SIMULATION_LOGE("can't run code, buf: %s", buf.c_str());
218- return tileopLatencyCacheMp[buf] = 1;
219- }
220- 
221- SimulatorAdaptor sa;
222- auto np = sa.Rewrite(program);
223- 
224- int gmLatency = 0;
225- Simulator sm;
226- for (auto str : np) {
227- if (str.find("copy_gm_to") != str.npos) {
228- gmLatency = sm.rGmLatency;
229- }
230- if (str.find("to_gm") != str.npos) {
231- gmLatency = sm.wGmLatency;
232- }
233- }
234- 
235- tileopLatencyCacheMp[buf] = sm.Run(np) + gmLatency;
236- it = tileopLatencyCacheMp.find(buf);
237- SIMULATION_LOGI("sim: %s latency: %lu", it->first.c_str(), it->second);
238- return it->second;
239-}
240- 
241-template <typename Simulator>
242-uint64_t PipeSimulator<Simulator>::PostSimulate(const CostModel::TileOpPtr& tileOp)
243-{
244- auto result = Simulate(tileOp);
245- if (result == 0) {
246- auto ptr = std::make_unique<PipeSimulatorFast<PostSimulatorA2A3>>();
247- return ptr->PostSimulate(tileOp);
248- }
249- return result;
250-}
251- 
252-extern "C" UnifiedPipeMachinePtr CreatePipeSimulatorSimulatorA2A3()
253-{
254- return UnifiedPipeMachinePtr(new PipeSimulator<SimulatorA2A3>());
255-}
256-} // namespace CostModel
@@ -1,78 +0,0 @@
1-/**
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3- * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4- * CANN Open Software License Agreement Version 2.0 (the "License").
5- * Please refer to the License for details. You may not use this file except in compliance with the License.
6- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7- * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8- * See LICENSE in the root of the software repository for the full text of the License.
9- */
10- 
11-/*!
12- * \file PipeSimulator.h
13- * \brief
14- */
15- 
16-#pragma once
17- 
18-#include <unordered_map>
19-#include "cost_model/simulation/arch/PipeMachineImpl.h"
20-#include "cost_model/simulation_ca/A2A3/SimulatorA2A3.h"
21- 
22-namespace CostModel {
23-template <typename Simulator>
24-class PipeSimulator : public PipeMachineImpl {
25-public:
26- uint64_t Simulate(const TileOpPtr& tileOp) override;
27- uint64_t PostSimulate(const TileOpPtr& tileOp) override;
28- 
29-private:
30- std::unordered_map<std::string, uint64_t> tileopLatencyCacheMp;
31-};
32- 
33-namespace PipeSimulatorUtils {
34-std::string ReplaceGMStr(const std::string& str)
35-{
36- std::regex pattern(R"(\(\(__gm__ GMTensorInfo\*\)\(param\) \+ \d+\)->Addr)");
37- std::string result = std::regex_replace(str, pattern, "charArray1");
38- result = std::regex_replace(result, std::regex("GMStackBase"), "charArray1");
39- std::regex getParamPattern(R"(GET_PARAM_ADDR\(param, \d+, \d+\))");
40- result = std::regex_replace(result, getParamPattern, "charArray2");
41- std::regex oriAddrPattern(R"(\(\(__gm__ GMTensorInfo\*\)\(oriAddrParam\) \+ \d+\)->Addr)");
42- result = std::regex_replace(result, oriAddrPattern, "charArray3");
43- std::regex runtimeCoaPattern(R"(RUNTIME_COA_GET_PARAM_OFFSET\(\d+,\d+,\d+\))");
44- result = std::regex_replace(result, runtimeCoaPattern, "0");
45- std::regex runtimeCoaSpacePattern(R"(RUNTIME_COA_GET_PARAM_OFFSET\(\d+, \d+, \d+\))");
46- result = std::regex_replace(result, runtimeCoaSpacePattern, "0");
47- std::regex runtimeCoaParamPattern(R"(RUNTIME_COA_GET_PARAM\(\d+\))");
48- result = std::regex_replace(result, runtimeCoaParamPattern, "0");
49- std::regex runtimeRawShapePattern1(R"(GET_PARAM_RAWSHAPE_1\(param, \d+, \d+\))");
50- result = std::regex_replace(result, runtimeRawShapePattern1, "1");
51- std::regex runtimeRawShapePattern2(R"(GET_PARAM_RAWSHAPE_2\(param, \d+, \d+\))");
52- result = std::regex_replace(result, runtimeRawShapePattern2, "1, 1");
53- std::regex runtimeRawShapePattern3(R"(GET_PARAM_RAWSHAPE_3\(param, \d+, \d+\))");
54- result = std::regex_replace(result, runtimeRawShapePattern3, "1, 1, 1");
55- std::regex runtimeRawShapePattern4(R"(GET_PARAM_RAWSHAPE_4\(param, \d+, \d+\))");
56- result = std::regex_replace(result, runtimeRawShapePattern4, "1, 1, 1, 1");
57- std::regex getParamOffsetPattern1(R"(GET_PARAM_OFFSET_1\(param, \d+, \d+\))");
58- result = std::regex_replace(result, getParamOffsetPattern1, "0");
59- std::regex getParamOffsetPattern2(R"(GET_PARAM_OFFSET_2\(param, \d+, \d+\))");
60- result = std::regex_replace(result, getParamOffsetPattern2, "0, 0");
61- std::regex getParamOffsetPattern3(R"(GET_PARAM_OFFSET_3\(param, \d+, \d+\))");
62- result = std::regex_replace(result, getParamOffsetPattern3, "0, 0");
63- std::regex getParamOffsetPattern4(R"(GET_PARAM_OFFSET_4\(param, \d+, \d+\))");
64- result = std::regex_replace(result, getParamOffsetPattern4, "0, 0, 0, 0");
65- std::regex getParamShapePattern(R"(GET_PARAM_RAWSHAPE_BY_IDX\(param, \d+, \d+, \d+, \d+\))");
66- result = std::regex_replace(result, getParamShapePattern, "0");
67- std::regex sysdimPattern(R"(sym_\d+_dim_\d+)");
68- result = std::regex_replace(result, sysdimPattern, "1");
69- std::regex maybeConst(R"(RUNTIME_COA_GET_PARAM_OFFSET_MAYBE_CONST\(-?\d+, -?\d+, -?\d+, -?\d+, -?\d+\))");
70- result = std::regex_replace(result, maybeConst, "0");
71- std::regex maybeConst_0(R"(RUNTIME_COA_GET_PARAM_OFFSET_MAYBE_CONST_0\(-?\d+, -?\d+, -?\d+, -?\d+\))");
72- result = std::regex_replace(result, maybeConst_0, "0");
73- return result;
74-}
75-} // namespace PipeSimulatorUtils
76- 
77-extern "C" UnifiedPipeMachinePtr CreatePipeSimulatorSimulatorA2A3();
78-} // namespace CostModel
@@ -1,76 +0,0 @@
1-/**
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3- * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4- * CANN Open Software License Agreement Version 2.0 (the "License").
5- * Please refer to the License for details. You may not use this file except in compliance with the License.
6- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7- * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8- * See LICENSE in the root of the software repository for the full text of the License.
9- */
10- 
11-/*!
12- * \file SimulatorAdaptor.cpp
13- * \brief
14- */
15- 
16-#include <sstream>
17-#include <algorithm>
18-#include "SimulatorAdaptor.h"
19- 
20-namespace CostModel {
21-static std::vector<std::string> ParseTokens(std::string input)
22-{
23- std::vector<std::string> result;
24- std::istringstream stream(input);
25- std::string token;
26- 
27- while (std::getline(stream, token, ' ')) {
28- if (!token.empty()) {
29- result.push_back(token);
30- }
31- }
32- 
33- return result;
34-}
35- 
36-std::vector<std::string> SimulatorAdaptor::Rewrite(const std::vector<std::string>& program) const
37-{
38- std::vector<std::string> np;
39- for (const auto& s : program) {
40- std::string ln;
41- size_t firstArg = 0;
42- auto tokens = ParseTokens(s);
43- size_t threshold1 = 6;
44- size_t threshold2 = 4;
45- size_t threshold3 = 2;
46- if (tokens.size() >= threshold1 && !std::isdigit(tokens[1][0]) && tokens[1][0] != '-' &&
47- !std::isdigit(tokens[3][0]) && tokens[3][0] != '-' && !std::isdigit(tokens[5][0]) && tokens[5][0] != '-') {
48- ln += tokens[0] + "<" + tokens[1] + "," + tokens[3] + "," + tokens[5] + ">(" + tokens[2] + ", " +
49- tokens[4] + ", ";
50- firstArg = threshold1;
51- } else if (
52- tokens.size() >= threshold2 && !std::isdigit(tokens[1][0]) && tokens[1][0] != '-' &&
53- !std::isdigit(tokens[3][0]) && tokens[3][0] != '-') {
54- ln += tokens[0] + "<" + tokens[1] + "," + tokens[3] + ">(" + tokens[2] + ", ";
55- firstArg = threshold2;
56- } else if (tokens.size() >= threshold3 && !std::isdigit(tokens[1][0]) && tokens[1][0] != '-') {
57- ln += tokens[0] + "<" + tokens[1] + ">(";
58- firstArg = threshold3;
59- } else {
60- ln += tokens[0] + "(";
61- firstArg = 1;
62- }
63- 
64- for (size_t i = firstArg; i < tokens.size(); i++) {
65- ln += tokens[i];
66- if (i < tokens.size() - 1) {
67- ln += ", ";
68- }
69- }
70- ln += ")";
71- 
72- np.push_back(ln);
73- }
74- return np;
75-}
76-} // namespace CostModel
@@ -1,26 +0,0 @@
1-/**
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3- * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4- * CANN Open Software License Agreement Version 2.0 (the "License").
5- * Please refer to the License for details. You may not use this file except in compliance with the License.
6- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7- * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8- * See LICENSE in the root of the software repository for the full text of the License.
9- */
10- 
11-/*!
12- * \file SimulatorAdaptor.h
13- * \brief
14- */
15- 
16-#pragma once
17- 
18-#include <vector>
19-#include <string>
20- 
21-namespace CostModel {
22-class SimulatorAdaptor {
23-public:
24- std::vector<std::string> Rewrite(const std::vector<std::string>& program) const;
25-};
26-} // namespace CostModel
@@ -1,146 +0,0 @@
1-/**
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3- * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4- * CANN Open Software License Agreement Version 2.0 (the "License").
5- * Please refer to the License for details. You may not use this file except in compliance with the License.
6- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7- * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8- * See LICENSE in the root of the software repository for the full text of the License.
9- */
10- 
11-/*!
12- * \file mock_helper.h
13- * \brief
14- */
15- 
16-#ifndef __MOCK_HELPER_H__
17-#define __MOCK_HELPER_H__
18- 
19-#include <iostream>
20-#include <type_traits>
21- 
22-#include "mock_types.h"
23- 
24-using namespace std;
25- 
26-namespace MockHelper {
27-void print_args() { std::cout << std::endl; }
28- 
29-template <typename T, typename... Args>
30-void print_args(T first, Args&&... args)
31-{
32- if constexpr (std::is_pointer_v<T>) {
33- std::cout << reinterpret_cast<std::uintptr_t>(first) << " ";
34- } else if constexpr (std::is_same_v<T, uint8_t>) {
35- std::cout << (int)first << " ";
36- } else {
37- std::cout << first << " ";
38- }
39- print_args(std::forward<Args>(args)...);
40-}
41- 
42-void print_typed_args(int num) {}
43- 
44-template <typename T, typename... Args>
45-void print_typed_args(int num, T first, Args&&... args)
46-{
47- if constexpr (
48- std::is_same_v<T, uint32_t*> || std::is_same_v<T, int*> || std::is_same_v<T, uint32_t> ||
49- std::is_same_v<T, int>) {
50- std::cout << "int32_t ";
51- } else if constexpr (std::is_same_v<T, float> || std::is_same_v<T, float*>) {
52- std::cout << "float ";
53- } else if constexpr (std::is_same_v<T, half> || std::is_same_v<T, half*>) {
54- std::cout << "half ";
55- } else if constexpr (std::is_same_v<T, bfloat16_t> || std::is_same_v<T, bfloat16_t*>) {
56- std::cout << "bfloat16_t ";
57- } else if constexpr (std::is_same_v<T, int8_t> || std::is_same_v<T, int8_t*>) {
58- std::cout << "int8_t ";
59- } else if constexpr (std::is_same_v<T, ub_addr8_t> || std::is_same_v<T, ub_addr8_t*>) {
60- std::cout << "ub_addr8_t ";
61- } else if constexpr (std::is_same_v<T, int64_t> || std::is_same_v<T, int64_t*>) {
62- std::cout << "int64_t ";
63- } else {
64- throw std::invalid_argument(std::string("bad type: ") + typeid(T).name());
65- }
66- 
67- if constexpr (std::is_pointer_v<T>) {
68- std::cout << reinterpret_cast<std::uintptr_t>(first) << " ";
69- } else if constexpr (std::is_same_v<T, uint8_t>) {
70- std::cout << (int)first << " ";
71- } else {
72- std::cout << first << " ";
73- }
74- 
75- num--;
76- if (num) {
77- print_typed_args(num, std::forward<Args>(args)...);
78- } else {
79- print_args(std::forward<Args>(args)...);
80- }
81-}
82- 
83-template <typename T, typename... Args>
84-void print_inst_typed_arg_1(T op, Args&&... args)
85-{
86- std::cout << op << " ";
87- print_typed_args(1, std::forward<Args>(args)...);
88-}
89- 
90-template <typename T, typename... Args>
91-void print_inst_typed_arg_2(T op, Args&&... args)
92-{
93- int arg_num = 2;
94- std::cout << op << " ";
95- print_typed_args(arg_num, std::forward<Args>(args)...);
96-}
97- 
98-template <typename T, typename... Args>
99-void print_inst_typed_arg_3(T op, Args&&... args)
100-{
101- int arg_num = 3;
102- std::cout << op << " ";
103- print_typed_args(arg_num, std::forward<Args>(args)...);
104-}
105- 
106-template <typename T, typename... Args>
107-void print_inst(T op, Args&&... args)
108-{
109- std::cout << op << " ";
110- print_args(std::forward<Args>(args)...);
111-}
112-} // namespace MockHelper
113- 
114-/* macro used to define 3 type-specific argumants instructions. e.g. vconv_f322f16r<half, float>(...) */
115-#define COSTMODEL_MOCK_INST_TYPED_ARG_3(inst) \
116- template <typename... Args> \
117- void inst(Args&&... args) \
118- { \
119- MockHelper::print_inst_typed_arg_3(#inst, std::forward<Args>(args)...); \
120- }
121- 
122-/* macro used to define 2 type-specific argumants instructions. e.g. vconv_f322f16r<half, float>(...) */
123-#define COSTMODEL_MOCK_INST_TYPED_ARG_2(inst) \
124- template <typename... Args> \
125- void inst(Args&&... args) \
126- { \
127- MockHelper::print_inst_typed_arg_2(#inst, std::forward<Args>(args)...); \
128- }
129- 
130-/* macro used to define 1 type-specific argumant instructions. e.g. vadd<float>(...) */
131-#define COSTMODEL_MOCK_INST_TYPED_ARG_1(inst) \
132- template <typename... Args> \
133- void inst(Args&&... args) \
134- { \
135- MockHelper::print_inst_typed_arg_1(#inst, std::forward<Args>(args)...); \
136- }
137- 
138-/* macro used to define typeless instructions. e.g. pipe_barrier(...) */
139-#define COSTMODEL_MOCK_INST(inst) \
140- template <typename... Args> \
141- void inst(Args&&... args) \
142- { \
143- MockHelper::print_inst(#inst, std::forward<Args>(args)...); \
144- }
145- 
146-#endif
@@ -1,148 +0,0 @@
1-/**
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3- * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4- * CANN Open Software License Agreement Version 2.0 (the "License").
5- * Please refer to the License for details. You may not use this file except in compliance with the License.
6- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7- * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8- * See LICENSE in the root of the software repository for the full text of the License.
9- */
10- 
11-/*!
12- * \file mock_inst.h
13- * \brief
14- */
15- 
16-#ifndef __MOCK_INST_H__
17-#define __MOCK_INST_H__
18- 
19-#include "mock_helper.h"
20- 
21-COSTMODEL_MOCK_INST_TYPED_ARG_1(vadd)
22-COSTMODEL_MOCK_INST_TYPED_ARG_1(vsel)
23-COSTMODEL_MOCK_INST_TYPED_ARG_1(vadds)
24-COSTMODEL_MOCK_INST_TYPED_ARG_1(vcopy)
25-COSTMODEL_MOCK_INST_TYPED_ARG_1(vbrcb)
26-COSTMODEL_MOCK_INST_TYPED_ARG_1(vcmax)
27-COSTMODEL_MOCK_INST_TYPED_ARG_1(vreducev2)
28-COSTMODEL_MOCK_INST_TYPED_ARG_1(Ttranspose)
29-COSTMODEL_MOCK_INST_TYPED_ARG_1(TSdivs)
30-COSTMODEL_MOCK_INST_TYPED_ARG_1(Tvcopy)
31-COSTMODEL_MOCK_INST_TYPED_ARG_1(vexp)
32-COSTMODEL_MOCK_INST_TYPED_ARG_1(vector_dup)
33-COSTMODEL_MOCK_INST_TYPED_ARG_1(vcadd)
34-COSTMODEL_MOCK_INST_TYPED_ARG_1(vmul)
35-COSTMODEL_MOCK_INST_TYPED_ARG_1(vmax)
36-COSTMODEL_MOCK_INST_TYPED_ARG_1(vcgmax)
37-COSTMODEL_MOCK_INST_TYPED_ARG_1(vsub)
38-COSTMODEL_MOCK_INST_TYPED_ARG_1(vrec)
39-COSTMODEL_MOCK_INST_TYPED_ARG_1(vcgadd)
40-COSTMODEL_MOCK_INST_TYPED_ARG_1(vsqrt)
41-COSTMODEL_MOCK_INST_TYPED_ARG_1(vmuls)
42-COSTMODEL_MOCK_INST_TYPED_ARG_1(vabs)
43-COSTMODEL_MOCK_INST_TYPED_ARG_1(vln)
44-COSTMODEL_MOCK_INST_TYPED_ARG_1(vdiv)
45-COSTMODEL_MOCK_INST_TYPED_ARG_1(vmin)
46-COSTMODEL_MOCK_INST_TYPED_ARG_1(vcmin)
47-COSTMODEL_MOCK_INST_TYPED_ARG_1(vcmpv_eq)
48-COSTMODEL_MOCK_INST_TYPED_ARG_1(vcmpv_ne)
49-COSTMODEL_MOCK_INST_TYPED_ARG_1(vcmpv_lt)
50-COSTMODEL_MOCK_INST_TYPED_ARG_1(vcmpv_gt)
51-COSTMODEL_MOCK_INST_TYPED_ARG_1(vcmpv_ge)
52-COSTMODEL_MOCK_INST_TYPED_ARG_1(vcmpvs_eq)
53-COSTMODEL_MOCK_INST_TYPED_ARG_1(vcmpvs_ne)
54-COSTMODEL_MOCK_INST_TYPED_ARG_1(vcmpvs_lt)
55-COSTMODEL_MOCK_INST_TYPED_ARG_1(vcmpvs_le)
56-COSTMODEL_MOCK_INST_TYPED_ARG_1(vcmpvs_gt)
57-COSTMODEL_MOCK_INST_TYPED_ARG_1(vcmpvs_ge)
58-COSTMODEL_MOCK_INST_TYPED_ARG_1(copy_ubuf_to_ubuf)
59-COSTMODEL_MOCK_INST_TYPED_ARG_1(copy_gm_to_ubuf_align_b32)
60-COSTMODEL_MOCK_INST_TYPED_ARG_1(copy_gm_to_ubuf_align_b16)
61-COSTMODEL_MOCK_INST_TYPED_ARG_1(copy_gm_to_ubuf_align_b8)
62-COSTMODEL_MOCK_INST_TYPED_ARG_1(copy_gm_to_ubuf)
63-COSTMODEL_MOCK_INST_TYPED_ARG_1(copy_ubuf_to_gm_align_b32)
64-COSTMODEL_MOCK_INST_TYPED_ARG_1(copy_ubuf_to_gm_align_b16)
65-COSTMODEL_MOCK_INST_TYPED_ARG_1(copy_ubuf_to_gm_align_b8)
66-COSTMODEL_MOCK_INST_TYPED_ARG_1(copy_ubuf_to_gm)
67-COSTMODEL_MOCK_INST_TYPED_ARG_1(load_cbuf_to_ca)
68-COSTMODEL_MOCK_INST_TYPED_ARG_1(load_cbuf_to_cb)
69-COSTMODEL_MOCK_INST_TYPED_ARG_1(load_cbuf_to_cb_transpose)
70-COSTMODEL_MOCK_INST_TYPED_ARG_1(img2colv2_cbuf_to_ca)
71-COSTMODEL_MOCK_INST_TYPED_ARG_1(copy_gm_to_cbuf_multi_nd2nz_b8)
72-COSTMODEL_MOCK_INST_TYPED_ARG_1(copy_gm_to_cbuf_multi_nd2nz_b16)
73-COSTMODEL_MOCK_INST_TYPED_ARG_1(copy_gm_to_cbuf_multi_nd2nz_b32s)
74-COSTMODEL_MOCK_INST_TYPED_ARG_1(copy_matrix_cc_to_gm)
75-COSTMODEL_MOCK_INST_TYPED_ARG_1(set_va_reg_sb)
76-COSTMODEL_MOCK_INST_TYPED_ARG_1(scatter_vnchwconv_b32)
77-COSTMODEL_MOCK_INST_TYPED_ARG_1(vbitsort)
78-COSTMODEL_MOCK_INST_TYPED_ARG_1(vmrgsort4)
79-COSTMODEL_MOCK_INST_TYPED_ARG_1(copy_gm_to_cbuf)
80-COSTMODEL_MOCK_INST_TYPED_ARG_1(load_cbuf_to_ca_transpose)
81-COSTMODEL_MOCK_INST_TYPED_ARG_1(img2colv2_cbuf_to_cb)
82-COSTMODEL_MOCK_INST_TYPED_ARG_1(copy_cbuf_to_bt)
83-COSTMODEL_MOCK_INST_TYPED_ARG_1(copy_cbuf_to_fbuf)
84-COSTMODEL_MOCK_INST_TYPED_ARG_1(copy_matrix_cc_to_cbuf)
85-COSTMODEL_MOCK_INST_TYPED_ARG_1(copy_cbuf_to_gm)
86-COSTMODEL_MOCK_INST_TYPED_ARG_1(scatter_vnchwconv_b16)
87-COSTMODEL_MOCK_INST_TYPED_ARG_1(DynTln_)
88- 
89-COSTMODEL_MOCK_INST(set_vector_mask)
90-COSTMODEL_MOCK_INST(pipe_barrier)
91-COSTMODEL_MOCK_INST(set_mask_count)
92-COSTMODEL_MOCK_INST(set_mask_norm)
93-COSTMODEL_MOCK_INST(set_flag)
94-COSTMODEL_MOCK_INST(wait_flag)
95-COSTMODEL_MOCK_INST(set_fmatrix)
96-COSTMODEL_MOCK_INST(set_nd_para)
97-COSTMODEL_MOCK_INST(set_deqscale)
98-COSTMODEL_MOCK_INST(set_atomic_bf16)
99-COSTMODEL_MOCK_INST(set_atomic_f32)
100-COSTMODEL_MOCK_INST(set_atomic_f16)
101-COSTMODEL_MOCK_INST(set_atomic_f8)
102-COSTMODEL_MOCK_INST(set_atomic_s32)
103-COSTMODEL_MOCK_INST(set_atomic_s16)
104-COSTMODEL_MOCK_INST(set_atomic_s8)
105-COSTMODEL_MOCK_INST(set_atomic_none)
106-COSTMODEL_MOCK_INST(set_atomic_add)
107-COSTMODEL_MOCK_INST(set_cmpmask)
108-COSTMODEL_MOCK_INST(set_fpc)
109-COSTMODEL_MOCK_INST(set_quant_pre)
110-COSTMODEL_MOCK_INST(set_fmatrix_b)
111-COSTMODEL_MOCK_INST(dsb)
112-COSTMODEL_MOCK_INST(dcci)
113- 
114-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f322f16)
115-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f322f16r)
116-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f322f16f)
117-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f322f16c)
118-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f322f16z)
119-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f322f16o)
120-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f322f16a)
121-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f322bf16r)
122-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f322bf16a)
123-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f322bf16f)
124-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f322bf16c)
125-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f322bf16z)
126-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f322s32z)
127-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f322s32a)
128-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f322s32f)
129-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f322s32c)
130-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f322s32r)
131-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_s322f32)
132-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f162f32)
133-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f162s8)
134-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f162s8f)
135-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f162s8a)
136-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f162s8c)
137-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_f162s8z)
138-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_bf162f32)
139-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_deq)
140-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_u82f16)
141-COSTMODEL_MOCK_INST_TYPED_ARG_2(vconv_s82f16)
142-COSTMODEL_MOCK_INST_TYPED_ARG_1(vconv_f162u8)
143-COSTMODEL_MOCK_INST_TYPED_ARG_2(DynTexp_)
144- 
145-COSTMODEL_MOCK_INST_TYPED_ARG_3(mad)
146-COSTMODEL_MOCK_INST_TYPED_ARG_3(DynTmul_)
147- 
148-#endif
@@ -1,238 +0,0 @@
1-/**
2- * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3- * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4- * CANN Open Software License Agreement Version 2.0 (the "License").
5- * Please refer to the License for details. You may not use this file except in compliance with the License.
6- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7- * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8- * See LICENSE in the root of the software repository for the full text of the License.
9- */
10- 
11-/*!
12- * \file mock_types.h
13- * \brief
14- */
15- 
16-#ifndef __MOCK_TYPES_H__
17-#define __MOCK_TYPES_H__
18- 
19-#include <iostream>
20-#include <cstdint>
21- 
22-#define __ubuf__
23-#ifndef __aicore__
24-#define __aicore__
25-#endif
26-#define __cbuf__
27-#define __fbuf__
28-#define __ca__
29-#define __cb__
30-#define __cc__
31-#define __aicore_host__
32-#define TILEOP static __attribute__((always_inline))
33-#define INLINE static __attribute__((always_inline))
34-#define ENTIRE_DATA_CACHE 0
35-#define CACHELINE_OUT 0
36-#define SINGLE_CACHE_LINE 0
37- 
38-typedef uint64_t mem_dsb_t;
39- 
40-typedef enum {
41-#if (defined __DAV_N350__)
42- VAReg0 = 0,
43- VAReg1,
44- VAReg2,
45- VAReg3,
46-#else
47- VA0 = 0,
48- VA1,
49- VA2,
50- VA3,
51- VA4,
52- VA5,
53- VA6,
54- VA7,
55-#endif
56-} ub_addr8_t;
57- 
58-typedef enum {
59- NoQuant = 0,
60-#if (defined __DAV_N350__)
61- VREQ8 = 2,
62- REQ8 = 3,
63- VDEQF16 = 4,
64- DEQF16 = 5,
65- VREQ16 = 6,
66- REQ16 = 7,
67-#else
68- F322F16 = 1,
69- VQF322HIF8_PRE = 2,
70- QF322HIF8_PRE = 3,
71- VQF322HIF8_PRE_HYBRID = 4,
72- QF322HIF8_PRE_HYBRID = 5,
73-#if __CCE_AICORE__ < 300 // Available for V100 V200 V210 V220
74- AttachF16Mul = 6,
75-#else
76- VDEQS32_INT = 6,
77- DEQS32_INT = 7,
78-#endif // __CCE_AICORE__ < 300
79- VREQ8 = 8,
80- REQ8 = 9,
81- VDEQF16 = 10,
82- DEQF16 = 11,
83-#if (defined __DAV_C310__)
84- VQF322FP8_PRE = 12,
85- QF322FP8_PRE = 13,
86- VQF322F32_PRE = 14,
87- QF322F32_PRE = 15,
88-#else
89- VSHIFTS322S16 = 12,
90- SHIFTS322S16 = 13,
91-#endif // if (defined __DAV_C310__)
92- F322BF16 = 16,
93- VQF162B8_PRE = 17,
94- QF162B8_PRE = 18,
95- VQF162S4_PRE = 19,
96- QF162S4_PRE = 20,
97- VREQ4 = 21,
98- REQ4 = 22,
99- VQF322B8_PRE = 23,
100- QF322B8_PRE = 24,
101- VQF322S4_PRE = 25,
102- QF322S4_PRE = 26,
103- VDEQS16 = 27,
104- DEQS16 = 28,
105- VQF162S16_PRE = 29,
106- QF162S16_PRE = 30,
107- VQF322F16_PRE = 31,
108- QF322F16_PRE = 32,
109- VQF322BF16_PRE = 33,
110- QF322BF16_PRE = 34,
111- VQS322BF16_PRE = 35,
112- QS322BF16_PRE = 36,
113-#endif // if (defined __DAV_N350__)
114-} QuantMode_t;
115- 
116-typedef enum {
117- // PAD MODE is only valid for OUT->L1 data path
118- PAD_NONE = 0,
119- PAD_MODE1 = 1,
120- PAD_MODE2 = 2,
121- PAD_MODE3 = 3,
122- PAD_MODE4 = 4,
123- PAD_MODE5 = 5,
124- PAD_MODE6 = 6,
125- PAD_MODE7 = 7,
126- PAD_MODE8 = 8,
127-} pad_t;
128- 
129-// hardware pipeline
130-enum PipeType {
131- PIPE_S = 0, // Scalar Pipe
132- PIPE_V, // Vector Pipe, including{VectorOP write UB, L0C->UB write}
133- PIPE_M, // Matrix Pipe, including{}
134- PIPE_MTE1, // L1->L0{A,B}
135- PIPE_MTE2, // OUT ->{L1, L0{A,B}, UB}
136- PIPE_MTE3, // UB ->{OUT,L1}
137- PIPE_ALL,
138- PIPE_MTE4 = 7, // MOV_UB_TO_OUT
139- PIPE_MTE5 = 8, // MOV_OUT_TO_UB
140- PIPE_V2 = 9, // Lower priority vector pipe,
141- PIPE_FIX = 10, // {L0C} ->{L1,UB,L1UB}
142-};
143- 
144-typedef enum {
145- inc = 0,
146- dec = 1,
147-} addr_cal_mode_t;
148- 
149-enum {
150- EVENT_ID0 = 0,
151- EVENT_ID1 = 1,
152- EVENT_ID2 = 2,
153- EVENT_ID3 = 3,
154- EVENT_ID4 = 4,
155- EVENT_ID5 = 5,
156- EVENT_ID6 = 6,
157- EVENT_ID7 = 7,
158- EVENT_ID8 = 8,
159- EVENT_ID9 = 9,
160-};
161- 
162-typedef enum {
163- // Special for dual output fix pipe instruction.
164- // only valid for L0C->{L1,UB,L1UB} data path
165- DUAL_MODE0 = 0, // dual output mode is disabled.
166- DUAL_MODE1 = 1,
167- DUAL_MODE2 = 2, // only valid for DST={L1}
168- DUAL_MODE3 = 3, // only valid for DST={L1}
169- DUAL_MODE4 = 4, // only valid for DST={L1}
170-} DualMode_t;
171- 
172-typedef enum {
173- // For VCMAX and VCMIN
174- VALUE_INDEX = 0,
175- INDEX_VALUE = 1,
176- ONLY_VALUE = 2,
177- ONLY_INDEX = 3,
178-} Order_t;
179- 
180-typedef enum {
181- // the byte mode enable bit for UB->OUT
182- BM_DISABLE = 0,
183- BM_ENABLE = 1,
184-} bm_t;
185- 
186-class half {
187-private:
188- short value_{0};
189- 
190-public:
191- half(const double& value) : value_(value) {}
192- 
193- half& operator=(const half& other)
194- {
195- value_ = other.value_;
196- return *this;
197- }
198- 
199- half& operator=(const double& other)
200- {
201- value_ = other;
202- return *this;
203- }
204- 
205- friend std::ostream& operator<<(std::ostream& out, const half& c)
206- {
207- out << c.value_;
208- return out;
209- }
210-};
211- 
212-class bfloat16_t {
213-private:
214- short value_{0};
215- 
216-public:
217- bfloat16_t(const double& value) : value_(value) {}
218- 
219- bfloat16_t& operator=(const bfloat16_t& other)
220- {
221- value_ = other.value_;
222- return *this;
223- }
224- 
225- bfloat16_t& operator=(const double& other)
226- {
227- value_ = other;
228- return *this;
229- }
230- 
231- friend std::ostream& operator<<(std::ostream& out, const bfloat16_t& c)
232- {
233- out << c.value_;
234- return out;
235- }
236-};
237- 
238-#endif
@@ -54,6 +54,5 @@
54|:--------------|:---------------------------------------|54|:--------------|:---------------------------------------|
55| interface | tensor, function, machine, ops, passes |55| interface | tensor, function, machine, ops, passes |
56| simulation | simulation |56| simulation | simulation |
57-| simulation_ca | simulation_ca |
58| codegen | codegen |57| codegen | codegen |
59| runtime | runtime |58| runtime | runtime |
@@ -276,7 +276,6 @@ function(PTO_Fwk_GTest_AddExe)
276 COMMAND ${CMAKE_COMMAND} -E make_directory ${InstallLibIncludeDir}/276 COMMAND ${CMAKE_COMMAND} -E make_directory ${InstallLibIncludeDir}/
277 COMMAND ln -sf ${PTO_FWK_SRC_ROOT}/framework/src/interface/tileop ${InstallLibIncludeDir}277 COMMAND ln -sf ${PTO_FWK_SRC_ROOT}/framework/src/interface/tileop ${InstallLibIncludeDir}
278 COMMAND ln -sf ${PTO_FWK_SRC_ROOT}/framework/src/interface/machine/device/tilefwk ${InstallLibIncludeDir}278 COMMAND ln -sf ${PTO_FWK_SRC_ROOT}/framework/src/interface/machine/device/tilefwk ${InstallLibIncludeDir}
279- COMMAND ln -sf ${PTO_FWK_SRC_ROOT}/framework/src/cost_model/simulation_ca/mock ${InstallLibIncludeDir}
280 COMMENT "Soft link of library include directory has been created at ${InstallLibIncludeDir}"279 COMMENT "Soft link of library include directory has been created at ${InstallLibIncludeDir}"
281 )280 )
282endfunction()281endfunction()
@@ -215,7 +215,6 @@ function(PTO_Fwk_STest_AddExe_RunExe)
215 tile_fwk_compiler215 tile_fwk_compiler
216 tile_fwk_runtime216 tile_fwk_runtime
217 tile_fwk_simulation217 tile_fwk_simulation
218- tile_fwk_simulation_ca
219 tile_fwk_operator218 tile_fwk_operator
220 )219 )
221 PTO_Fwk_GTest_AddExe(220 PTO_Fwk_GTest_AddExe(
@@ -15,7 +15,7 @@ file(GLOB_RECURSE _Sources src/*.cpp)
15PTO_Fwk_STest_AddLib(15PTO_Fwk_STest_AddLib(
16 TARGET ${_Target}16 TARGET ${_Target}
17 SOURCES ${_Sources}17 SOURCES ${_Sources}
18- LD_LIBRARIES_EXT tile_fwk_compiler tile_fwk_simulation tile_fwk_simulation_ca tile_fwk_simulation_pv18+ LD_LIBRARIES_EXT tile_fwk_compiler tile_fwk_simulation tile_fwk_simulation_pv
19 GOLDEN_SCRIPT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/python19 GOLDEN_SCRIPT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/python
20)20)
21add_custom_command(21add_custom_command(
@@ -15,7 +15,7 @@ file(GLOB_RECURSE _Sources src/*.cpp)
15PTO_Fwk_STest_AddLib(15PTO_Fwk_STest_AddLib(
16 TARGET ${_Target}16 TARGET ${_Target}
17 SOURCES ${_Sources}17 SOURCES ${_Sources}
18- LD_LIBRARIES_EXT tile_fwk_compiler tile_fwk_simulation tile_fwk_simulation_ca tile_fwk_simulation_pv18+ LD_LIBRARIES_EXT tile_fwk_compiler tile_fwk_simulation tile_fwk_simulation_pv
19 GOLDEN_SCRIPT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src19 GOLDEN_SCRIPT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src
20)20)
21add_custom_command(21add_custom_command(
@@ -16,7 +16,7 @@ file(GLOB_RECURSE _Sources src/*.cpp)
16PTO_Fwk_STest_AddLib(16PTO_Fwk_STest_AddLib(
17 TARGET ${_Target}17 TARGET ${_Target}
18 SOURCES ${_Sources}18 SOURCES ${_Sources}
19- LD_LIBRARIES_EXT tile_fwk_compiler tile_fwk_simulation tile_fwk_simulation_ca19+ LD_LIBRARIES_EXT tile_fwk_compiler tile_fwk_simulation
20)20)
21# 可执行程序运行依赖的配置, 脚本配置21# 可执行程序运行依赖的配置, 脚本配置
22add_custom_command(22add_custom_command(
@@ -18,7 +18,7 @@ PTO_Fwk_UTest_AddCaseLib(
18 PRIVATE_INCLUDE_DIRECTORIES ${PTO_FWK_SRC_ROOT}/framework/src/cost_model18 PRIVATE_INCLUDE_DIRECTORIES ${PTO_FWK_SRC_ROOT}/framework/src/cost_model
19 LINK_LIBRARIES tile_fwk_operator tile_fwk_simulation dl19 LINK_LIBRARIES tile_fwk_operator tile_fwk_simulation dl
20)20)
21-add_dependencies(${_Target} tile_fwk_simulation_ca tile_fwk_simulation_pv)21+add_dependencies(${_Target} tile_fwk_simulation_pv)
22 22 
23# 可执行程序运行依赖的配置, 脚本配置23# 可执行程序运行依赖的配置, 脚本配置
24add_custom_command(24add_custom_command(
@@ -23,7 +23,6 @@
23#include "interface/inner/tilefwk.h"23#include "interface/inner/tilefwk.h"
24#include "cost_model/simulation/pv/PvModelFactory.h"24#include "cost_model/simulation/pv/PvModelFactory.h"
25#include "interface/configs/config_manager.h"25#include "interface/configs/config_manager.h"
26-#include "cost_model/simulation_ca/PipeSimulator.h"
27#include "cost_model/simulation/arch/PipeFactory.h"26#include "cost_model/simulation/arch/PipeFactory.h"
28#include "cost_model/simulation/arch/CacheMachineImpl.h"27#include "cost_model/simulation/arch/CacheMachineImpl.h"
29#include "cost_model/simulation/machine/CoreMachine.h"28#include "cost_model/simulation/machine/CoreMachine.h"
@@ -225,20 +224,6 @@ TEST_F(CostModelTest, TestFixedLatencyTasks)
225 costModelAgent.TerminateCostModel();224 costModelAgent.TerminateCostModel();
226}225}
227 226 
228-TEST_F(CostModelTest, TestAttentionPostAccuracy2)
229-{
230- int accuracylevel = 2;
231- config::SetSimConfig(KEY_ACCURACY_LEVEL, accuracylevel);
232- RunAttentionPostCostModel();
233-}
234- 
235-TEST_F(CostModelTest, TestAttentionPostAccuracy3)
236-{
237- int accuracylevel = 2;
238- config::SetSimConfig(KEY_ACCURACY_LEVEL, accuracylevel);
239- RunMatrixCostModel();
240-}
241- 
242TEST_F(CostModelTest, TestAttentionPostL2Cache)227TEST_F(CostModelTest, TestAttentionPostL2Cache)
243{228{
244 int accuracylevel = 1;229 int accuracylevel = 1;
@@ -287,12 +272,6 @@ TEST_F(CostModelTest, TestCoreMachineDeadlock)
287 RunAttentionPostCostModel();272 RunAttentionPostCostModel();
288}273}
289 274 
290-TEST_F(CostModelTest, TestReplaceGMStr)
291-{
292- std::string str = "abc";
293- CostModel::PipeSimulatorUtils::ReplaceGMStr(str);
294-}
295- 
296void RunCat()275void RunCat()
297{276{
298 TileShape::Current().SetVecTile(16, 6, 6, 16);277 TileShape::Current().SetVecTile(16, 6, 6, 16);
@@ -55,7 +55,6 @@ def _load_shared_libs():
55 ["libtile_fwk_compiler.so", True, ],55 ["libtile_fwk_compiler.so", True, ],
56 ["libtile_fwk_runtime.so", True, ],56 ["libtile_fwk_runtime.so", True, ],
57 ["libtile_fwk_simulation.so", True, ],57 ["libtile_fwk_simulation.so", True, ],
58- ["libtile_fwk_simulation_ca.so", True, ],
59 ["libtile_fwk_simulation_pv.so", use_cann, ],58 ["libtile_fwk_simulation_pv.so", use_cann, ],
60 ]59 ]
61 for desc in desc_lst:60 for desc in desc_lst: