已合并
PCIe through需求代码实现 #742
ren-botao创建于 8月15日
PCIe through需求代码实现 #742
已合并
ren-botao创建于 8月15日
共 6 个文件变更+167-50
@@ -81,6 +81,11 @@ target_link_libraries(nnopbase
81)81)
82 82 
83target_compile_definitions(nnopbase PRIVATE google=ascend_private ACLNN_LOG_FMT_CHECK LOG_CPP)83target_compile_definitions(nnopbase PRIVATE google=ascend_private ACLNN_LOG_FMT_CHECK LOG_CPP)
84+ 
85+if(DEFINED PRODUCT_SIDE AND "${PRODUCT_SIDE}" STREQUAL "device")
86+ target_compile_definitions(nnopbase PRIVATE PRODUCT_SIDE_IS_DEVICE=1)
87+endif()
88+ 
84target_compile_options(nnopbase PRIVATE89target_compile_options(nnopbase PRIVATE
85 -O2 -fno-common -Wextra -Wfloat-equal -D_FORTIFY_SOURCE=2)90 -O2 -fno-common -Wextra -Wfloat-equal -D_FORTIFY_SOURCE=2)
86 91 
@@ -205,7 +205,8 @@ void AddTensorAddrToCachedList(void* addr)
205 tlsCachedTensorList.at(tlsCachedTensorListSize) = addr;205 tlsCachedTensorList.at(tlsCachedTensorListSize) = addr;
206 }206 }
207 tlsCachedTensorListSize++;207 tlsCachedTensorListSize++;
208- if (op::internal::IsPcieThroughEnabled() && op::internal::IsTensorAddrInPcieRange(addr)) {208+ if (op::internal::IsPcieThroughEnabled() && !tlsData->threadLocalContext.opConfigInfo_.usePcieAddr &&
209+ op::internal::IsTensorAddrInPcieRange(addr)) {
209 tlsData->threadLocalContext.opConfigInfo_.usePcieAddr = true;210 tlsData->threadLocalContext.opConfigInfo_.usePcieAddr = true;
210 }211 }
211}212}
@@ -274,7 +275,8 @@ static void AddAclTensorToCachedList(const aclTensor* tensor, OpCacheThreadLocal
274 } else {275 } else {
275 tlsData->tensorLabelList.push_back(it->second);276 tlsData->tensorLabelList.push_back(it->second);
276 }277 }
277- if (op::internal::IsPcieThroughEnabled() && op::internal::IsTensorAddrInPcieRange(tensor->GetStorageAddr())) {278+ if (op::internal::IsPcieThroughEnabled() && !tlsData->threadLocalContext.opConfigInfo_.usePcieAddr &&
279+ op::internal::IsTensorAddrInPcieRange(tensor->GetStorageAddr())) {
278 tlsData->threadLocalContext.opConfigInfo_.usePcieAddr = true;280 tlsData->threadLocalContext.opConfigInfo_.usePcieAddr = true;
279 }281 }
280}282}
@@ -10,22 +10,28 @@
10 10 
11#include "op_feature_internal.h"11#include "op_feature_internal.h"
12 12 
13+#include <cinttypes>
13#include <cstdint>14#include <cstdint>
14#include <mutex>15#include <mutex>
15#include <vector>16#include <vector>
16 17 
17#include "acl/acl_rt.h"18#include "acl/acl_rt.h"
19+#include "platform/soc_spec.h"
20+#ifndef PRODUCT_SIDE_IS_DEVICE
21+#include "version/runtime_version.h"
22+#endif
18 23 
19#include "aclnn/acl_meta.h"24#include "aclnn/acl_meta.h"
20#include "opdev/platform.h"25#include "opdev/platform.h"
21#include "opdev/op_log.h"26#include "opdev/op_log.h"
22#include "opdev/op_errno.h"27#include "opdev/op_errno.h"
23 28 
29+#define PKG_VERSION_NUM_9_2_0 90200000
30+ 
24namespace op {31namespace op {
25namespace internal {32namespace internal {
26 33 
27namespace {34namespace {
28-// 与 rts 的 aclrtAddrRange 二进制布局一致,弱符号调用可直接用 PcieAddrRange* 接收
29struct PcieAddrRange {35struct PcieAddrRange {
30 void* startAddr{nullptr};36 void* startAddr{nullptr};
31 void* endAddr{nullptr};37 void* endAddr{nullptr};
@@ -34,14 +40,78 @@ struct PcieAddrRange {
34bool g_pcieThroughEnabled{false};40bool g_pcieThroughEnabled{false};
35std::vector<PcieAddrRange> g_pcieAddrRanges;41std::vector<PcieAddrRange> g_pcieAddrRanges;
36std::once_flag g_pcieThroughOnceFlag;42std::once_flag g_pcieThroughOnceFlag;
43+ 
44+extern "C" {
45+__attribute__((weak)) aclError aclrtHostGetDevicePointerAddrRange(PcieAddrRange* addrRange, uint32_t* count);
46+}
47+ 
48+bool IsHostDeviceConnectWithPcie([[maybe_unused]] uint32_t deviceId)
49+{
50+#if !defined(PRODUCT_SIDE_IS_DEVICE) && defined(RUNTIME_VERSION_NUM) && (RUNTIME_VERSION_NUM >= PKG_VERSION_NUM_9_2_0)
51+ int64_t hdConnectType = ACL_HOST_DEVICE_CONNECT_TYPE_UB;
52+ auto ret = aclrtGetDeviceInfo(deviceId, ACL_DEV_ATTR_HD_CONNECT_TYPE, &hdConnectType);
53+ if (ret != ACL_SUCCESS) {
54+ OP_LOGW("Get HD_CONNECT_TYPE by aclrtGetDeviceInfo failed, return %d", static_cast<int32_t>(ret));
55+ return false;
56+ }
57+ if (hdConnectType != ACL_HOST_DEVICE_CONNECT_TYPE_PCIE) {
58+ OP_LOGI("HD connect type is %" PRId64 ", not PCIe", static_cast<int64_t>(hdConnectType));
59+ return false;
60+ }
61+ return true;
62+#else
63+ OP_LOGW("Can't get host device connect type, because the runtime package version is lower than 9.2.0 when "
64+ "compiling nnopbase");
65+ return false;
66+#endif
67+}
68+ 
69+aclnnStatus GetPcieAddrRange([[maybe_unused]] std::vector<PcieAddrRange>& addrRanges)
70+{
71+#if !defined(PRODUCT_SIDE_IS_DEVICE) && defined(RUNTIME_VERSION_NUM) && (RUNTIME_VERSION_NUM >= PKG_VERSION_NUM_9_2_0)
72+ addrRanges.clear();
73+ if (aclrtHostGetDevicePointerAddrRange == nullptr) {
74+ OP_LOGW("aclrtHostGetDevicePointerAddrRange symbol is not found");
75+ return ACLNN_ERR_RUNTIME_ERROR;
76+ }
77+ 
78+ uint32_t rangeCount = 0;
79+ auto ret = aclrtHostGetDevicePointerAddrRange(nullptr, &rangeCount);
80+ if (ret != ACL_SUCCESS) {
81+ OP_LOGW("aclrtHostGetDevicePointerAddrRange failed to get range count, return %d", static_cast<int32_t>(ret));
82+ return ACLNN_ERR_RUNTIME_ERROR;
83+ }
84+ if (rangeCount == 0U) {
85+ OP_LOGI("PCIe addr range count is 0");
86+ return ACLNN_SUCCESS;
87+ }
88+ 
89+ addrRanges.resize(rangeCount);
90+ ret = aclrtHostGetDevicePointerAddrRange(addrRanges.data(), &rangeCount);
91+ if (ret != ACL_SUCCESS) {
92+ OP_LOGW("aclrtHostGetDevicePointerAddrRange failed to get addr ranges, return %d", static_cast<int32_t>(ret));
93+ return ACLNN_ERR_RUNTIME_ERROR;
94+ }
95+ return ACLNN_SUCCESS;
96+#else
97+ OP_LOGW(
98+ "Can't get PCIe addr ranges, because the runtime package version is lower than 9.2.0 when compiling nnopbase");
99+ return ACLNN_ERR_RUNTIME_ERROR;
100+#endif
101+}
102+ 
37} // namespace103} // namespace
38 104 
39aclnnStatus InitPcieThroughInfo()105aclnnStatus InitPcieThroughInfo()
40{106{
41 static aclnnStatus initRet = ACLNN_SUCCESS;107 static aclnnStatus initRet = ACLNN_SUCCESS;
42- std::call_once(g_pcieThroughOnceFlag, [&initRet]() {108+ std::call_once(g_pcieThroughOnceFlag, []() {
109+ g_pcieThroughEnabled = false;
43 NpuArch npuArch = GetCurrentPlatformInfo().GetCurNpuArch();110 NpuArch npuArch = GetCurrentPlatformInfo().GetCurNpuArch();
44- OP_LOGI("NPU arch is %d", static_cast<int32_t>(npuArch));111+ if (npuArch != NpuArch::DAV_3510 && npuArch != NpuArch::DAV_9201 && npuArch != NpuArch::DAV_9202) {
112+ OP_LOGI("Current NPU arch [%u] not support PCIe through.", static_cast<uint32_t>(npuArch));
113+ return;
114+ }
45 115 
46 int32_t deviceId = 0;116 int32_t deviceId = 0;
47 auto aclRet = aclrtGetDevice(&deviceId);117 auto aclRet = aclrtGetDevice(&deviceId);
@@ -51,14 +121,23 @@ aclnnStatus InitPcieThroughInfo()
51 return;121 return;
52 }122 }
53 123 
54- // 遗留项:HD connect 判断(aclrtGetDeviceInfo 兼容性问题)与地址段获取(接口未提供)暂注释124+ if (!IsHostDeviceConnectWithPcie(static_cast<uint32_t>(deviceId))) {
125+ OP_LOGI("The connect type between host and device cannot be obtained, or the type is not PCIe, so disable "
126+ "PCIe through feature.");
127+ return;
128+ }
129+ 
130+ if (GetPcieAddrRange(g_pcieAddrRanges) != ACLNN_SUCCESS || g_pcieAddrRanges.empty()) {
131+ OP_LOGI("Can't get PCIe addr ranges, or the range count is 0, so disable PCIe through feature.");
132+ return;
133+ }
55 134 
56- // 框架阶段:赋初始值用于性能验证,真实地址段待弱符号接口接入后填充
57- // 选用 0x1~0x2 这种不存在的极小地址段,保证真实 tensor 地址不会命中
58- g_pcieAddrRanges.resize(1);
59- g_pcieAddrRanges[0].startAddr = reinterpret_cast<void*>(0x1);
60- g_pcieAddrRanges[0].endAddr = reinterpret_cast<void*>(0x2);
61 g_pcieThroughEnabled = true;135 g_pcieThroughEnabled = true;
136+ OP_LOGI("PCIe through feature is enabled, addr range count is %zu", g_pcieAddrRanges.size());
137+ for (size_t i = 0; i < g_pcieAddrRanges.size(); i++) {
138+ OP_LOGI("PCIe addr range[%zu], startAddr %p, endAddr %p", i, g_pcieAddrRanges[i].startAddr,
139+ g_pcieAddrRanges[i].endAddr);
140+ }
62 });141 });
63 return initRet;142 return initRet;
64}143}
@@ -40,12 +40,34 @@ namespace internal {
40using BlockPool = internal::BlockPool;40using BlockPool = internal::BlockPool;
41using OpImplFunctions = gert::OpImplKernelRegistry::OpImplFunctions;41using OpImplFunctions = gert::OpImplKernelRegistry::OpImplFunctions;
42 42 
43-constexpr size_t TILING_INPUT_OTHER_NUM = 5;
44-constexpr size_t TILING_PLATFORM_IDX = 4;
45-constexpr size_t TILING_FUNC_IDX = 3;
46-constexpr size_t DETERMINISTIC_IDX = 2;
47constexpr size_t GROWTH_FACTOR = 2;43constexpr size_t GROWTH_FACTOR = 2;
48 44 
45+enum class TilingOtherInputIdx : size_t {
46+ COMPILE_INFO = 0,
47+ PLATFORM_INFO,
48+ TILING_FUNC,
49+ DETERMINISTIC,
50+ DETERMINISTIC_LEVEL,
51+ PCIE_THROUGH_FLAG,
52+ // add new input definitions here
53+ INPUT_NUM
54+};
55+constexpr size_t TILING_INPUT_OTHER_NUM = static_cast<size_t>(TilingOtherInputIdx::INPUT_NUM);
56+ 
57+namespace {
58+inline void SetTilingOtherInput(KernelRunContext* ctx, TilingOtherInputIdx field, AsyncAnyValue* value)
59+{
60+ ctx->values[ctx->input_size - TILING_INPUT_OTHER_NUM + static_cast<size_t>(field)] = value;
61+}
62+ 
63+template <typename T>
64+inline T GetTilingOtherInputValue(KernelRunContext* ctx, TilingOtherInputIdx field)
65+{
66+ return *PtrCastTo<T>(
67+ ctx->values[ctx->input_size - TILING_INPUT_OTHER_NUM + static_cast<size_t>(field)]->data.inplace);
68+}
69+} // anonymous namespace
70+ 
49void TilingCtxHolder::BuildTilingCtx()71void TilingCtxHolder::BuildTilingCtx()
50{72{
51 // +1 for compiled info struct73 // +1 for compiled info struct
@@ -145,10 +167,11 @@ aclnnStatus TilingCtxHolder::EnsureTilingCtxCapacity(size_t requiredCapacity)
145 return ACLNN_SUCCESS;167 return ACLNN_SUCCESS;
146}168}
147 169 
148-size_t TilingCtxHolder::ResetTilingCtx(const KernelContextHolder* kernelCtx)170+aclnnStatus TilingCtxHolder::ResetTilingCtx(const KernelContextHolder* kernelCtx)
149{171{
150 size_t requiredCapacity = kernelCtx->inputNum_ + kernelCtx->outputNum_ + TILING_INPUT_OTHER_NUM + tilingOutputNum_;172 size_t requiredCapacity = kernelCtx->inputNum_ + kernelCtx->outputNum_ + TILING_INPUT_OTHER_NUM + tilingOutputNum_;
151- CHECK_RET_CODE(EnsureTilingCtxCapacity(requiredCapacity), "EnsureTilingCtxCapacity failed.");173+ CHECK_COND(EnsureTilingCtxCapacity(requiredCapacity) == ACLNN_SUCCESS, ACLNN_ERR_INNER,
174+ "EnsureTilingCtxCapacity failed.");
152 175 
153 tilingData_->data_size_ = 0;176 tilingData_->data_size_ = 0;
154 tilingCtxValue_[kOutputTilingData].data.pointer = tilingData_;177 tilingCtxValue_[kOutputTilingData].data.pointer = tilingData_;
@@ -164,16 +187,14 @@ size_t TilingCtxHolder::ResetTilingCtx(const KernelContextHolder* kernelCtx)
164 187 
165 size_t opInputNum = kernelCtx->inputNum_;188 size_t opInputNum = kernelCtx->inputNum_;
166 size_t opOutputNum = kernelCtx->outputNum_;189 size_t opOutputNum = kernelCtx->outputNum_;
167- size_t tilingInputNum = opInputNum + opOutputNum + TILING_INPUT_OTHER_NUM;
168 tilingOutput_.inputNum_ = opInputNum;190 tilingOutput_.inputNum_ = opInputNum;
169 tilingOutput_.outputNum_ = opOutputNum;191 tilingOutput_.outputNum_ = opOutputNum;
170 192 
171- tilingCtx_->input_size = tilingInputNum;193+ tilingCtx_->input_size = opInputNum + opOutputNum + TILING_INPUT_OTHER_NUM;
172- for (size_t i = 0; i < tilingInputNum - TILING_INPUT_OTHER_NUM; i++) {194+ for (size_t i = 0; i < opInputNum + opOutputNum; i++) {
173 tilingCtx_->values[i] = &kernelCtx->opInArg_[i];195 tilingCtx_->values[i] = &kernelCtx->opInArg_[i];
174 }196 }
175- 197+ return ACLNN_SUCCESS;
176- return tilingInputNum;
177}198}
178 199 
179void TilingCtxHolder::FinalizeTilingCtx(size_t tilingInputNum)200void TilingCtxHolder::FinalizeTilingCtx(size_t tilingInputNum)
@@ -190,7 +211,9 @@ aclnnStatus TilingCtxHolder::UpdateTilingCtx(const KernelContextHolder* kernelCt
190 CHECK_COND(kernelCtx != nullptr, ACLNN_ERR_RUNTIME_ERROR, "kernelCtx is NULL");211 CHECK_COND(kernelCtx != nullptr, ACLNN_ERR_RUNTIME_ERROR, "kernelCtx is NULL");
191 CHECK_COND(tilingParseCtx != nullptr, ACLNN_ERR_RUNTIME_ERROR, "tilingParseCtx is NULL");212 CHECK_COND(tilingParseCtx != nullptr, ACLNN_ERR_RUNTIME_ERROR, "tilingParseCtx is NULL");
192 213 
193- size_t tilingInputNum = ResetTilingCtx(kernelCtx);214+ if (ResetTilingCtx(kernelCtx) != ACLNN_SUCCESS) {
215+ return ACLNN_ERR_INNER;
216+ }
194 217 
195 uint32_t coreNum = tilingParseCtx->GetCoreNum();218 uint32_t coreNum = tilingParseCtx->GetCoreNum();
196 uint32_t cubeCoreNum = GetThreadLocalContext().opConfigInfo_.aicNum_;219 uint32_t cubeCoreNum = GetThreadLocalContext().opConfigInfo_.aicNum_;
@@ -204,19 +227,23 @@ aclnnStatus TilingCtxHolder::UpdateTilingCtx(const KernelContextHolder* kernelCt
204 0;227 0;
205 *PtrCastTo<int32_t>(228 *PtrCastTo<int32_t>(
206 deterministicLevelValue_.data.inplace) = GetThreadLocalContext().opConfigInfo_.deterministicLevel_;229 deterministicLevelValue_.data.inplace) = GetThreadLocalContext().opConfigInfo_.deterministicLevel_;
230+ *PtrCastTo<bool>(pcieThroughFlagValue_.data.inplace) = GetThreadLocalContext().opConfigInfo_.usePcieAddr;
207 231 
208- tilingCtx_->values[tilingInputNum - TILING_INPUT_OTHER_NUM] = tilingParseCtx->GetCompiledInfoStruct();232+ SetTilingOtherInput(tilingCtx_, TilingOtherInputIdx::COMPILE_INFO, tilingParseCtx->GetCompiledInfoStruct());
209- tilingCtx_->values[tilingInputNum - TILING_PLATFORM_IDX] = &platformInfoValue_;233+ SetTilingOtherInput(tilingCtx_, TilingOtherInputIdx::PLATFORM_INFO, &platformInfoValue_);
210- tilingCtx_->values[tilingInputNum - TILING_FUNC_IDX] = nullptr;234+ SetTilingOtherInput(tilingCtx_, TilingOtherInputIdx::TILING_FUNC, nullptr);
211- tilingCtx_->values[tilingInputNum - DETERMINISTIC_IDX] = &deterministicValue_;235+ SetTilingOtherInput(tilingCtx_, TilingOtherInputIdx::DETERMINISTIC, &deterministicValue_);
212- tilingCtx_->values[tilingInputNum - 1] = &deterministicLevelValue_;236+ SetTilingOtherInput(tilingCtx_, TilingOtherInputIdx::DETERMINISTIC_LEVEL, &deterministicLevelValue_);
213- FinalizeTilingCtx(tilingInputNum);237+ SetTilingOtherInput(tilingCtx_, TilingOtherInputIdx::PCIE_THROUGH_FLAG, &pcieThroughFlagValue_);
238+ 
239+ FinalizeTilingCtx(tilingCtx_->input_size);
214 240 
215 OP_LOGI("Update op tiling ctx. input[%zu], output[%zu], compiled Info %p, deterministic %d, deterministicLevel %d, "241 OP_LOGI("Update op tiling ctx. input[%zu], output[%zu], compiled Info %p, deterministic %d, deterministicLevel %d, "
216- "tilingDataWrap: %p, coreNum: %u",242+ "pcie through flag: %d, tilingDataWrap: %p, coreNum: %u",
217 kernelCtx->inputNum_, kernelCtx->outputNum_, tilingParseCtx->GetCompiledInfoStruct(),243 kernelCtx->inputNum_, kernelCtx->outputNum_, tilingParseCtx->GetCompiledInfoStruct(),
218- *PtrCastTo<int32_t>(tilingCtx_->values[tilingInputNum - DETERMINISTIC_IDX]->data.inplace),244+ GetTilingOtherInputValue<int32_t>(tilingCtx_, TilingOtherInputIdx::DETERMINISTIC),
219- *PtrCastTo<int32_t>(tilingCtx_->values[tilingInputNum - 1]->data.inplace), tilingData_, coreNum);245+ GetTilingOtherInputValue<int32_t>(tilingCtx_, TilingOtherInputIdx::DETERMINISTIC_LEVEL),
246+ GetTilingOtherInputValue<bool>(tilingCtx_, TilingOtherInputIdx::PCIE_THROUGH_FLAG), tilingData_, coreNum);
220 return ACLNN_SUCCESS;247 return ACLNN_SUCCESS;
221}248}
222 249 
@@ -224,14 +251,17 @@ aclnnStatus TilingCtxHolder::UpdateTilingCtx(const KernelContextHolder* kernelCt
224{251{
225 CHECK_COND(kernelCtx != nullptr, ACLNN_ERR_RUNTIME_ERROR, "kernelCtx is NULL");252 CHECK_COND(kernelCtx != nullptr, ACLNN_ERR_RUNTIME_ERROR, "kernelCtx is NULL");
226 253 
227- size_t tilingInputNum = ResetTilingCtx(kernelCtx);254+ if (ResetTilingCtx(kernelCtx) != ACLNN_SUCCESS) {
255+ return ACLNN_ERR_INNER;
256+ }
228 257 
229- tilingCtx_->values[tilingInputNum - TILING_INPUT_OTHER_NUM] = nullptr;258+ SetTilingOtherInput(tilingCtx_, TilingOtherInputIdx::COMPILE_INFO, nullptr);
230- tilingCtx_->values[tilingInputNum - TILING_PLATFORM_IDX] = nullptr;259+ SetTilingOtherInput(tilingCtx_, TilingOtherInputIdx::PLATFORM_INFO, nullptr);
231- tilingCtx_->values[tilingInputNum - TILING_FUNC_IDX] = nullptr;260+ SetTilingOtherInput(tilingCtx_, TilingOtherInputIdx::TILING_FUNC, nullptr);
232- tilingCtx_->values[tilingInputNum - DETERMINISTIC_IDX] = nullptr;261+ SetTilingOtherInput(tilingCtx_, TilingOtherInputIdx::DETERMINISTIC, nullptr);
233- tilingCtx_->values[tilingInputNum - 1] = nullptr;262+ SetTilingOtherInput(tilingCtx_, TilingOtherInputIdx::DETERMINISTIC_LEVEL, nullptr);
234- FinalizeTilingCtx(tilingInputNum);263+ SetTilingOtherInput(tilingCtx_, TilingOtherInputIdx::PCIE_THROUGH_FLAG, nullptr);
264+ FinalizeTilingCtx(tilingCtx_->input_size);
235 return ACLNN_SUCCESS;265 return ACLNN_SUCCESS;
236}266}
237 267 
@@ -239,19 +269,22 @@ aclnnStatus TilingCtxHolder::UpdateTilingCtx(const KernelContextHolder* kernelCt
239{269{
240 CHECK_COND(kernelCtx != nullptr, ACLNN_ERR_RUNTIME_ERROR, "kernelCtx is NULL");270 CHECK_COND(kernelCtx != nullptr, ACLNN_ERR_RUNTIME_ERROR, "kernelCtx is NULL");
241 271 
242- size_t tilingInputNum = ResetTilingCtx(kernelCtx);272+ if (ResetTilingCtx(kernelCtx) != ACLNN_SUCCESS) {
273+ return ACLNN_ERR_INNER;
274+ }
243 275 
244 uint32_t coreNum = 0;276 uint32_t coreNum = 0;
245 fe::PlatFormInfos* platformInfo = SocContext::GetPlatformInfo();277 fe::PlatFormInfos* platformInfo = SocContext::GetPlatformInfo();
246 SetCoreNum(opJson, platformInfo, coreNum);278 SetCoreNum(opJson, platformInfo, coreNum);
247 platformInfoValue_.data.pointer = platformInfo;279 platformInfoValue_.data.pointer = platformInfo;
248 280 
249- tilingCtx_->values[tilingInputNum - TILING_INPUT_OTHER_NUM] = nullptr;281+ SetTilingOtherInput(tilingCtx_, TilingOtherInputIdx::COMPILE_INFO, nullptr);
250- tilingCtx_->values[tilingInputNum - TILING_PLATFORM_IDX] = &platformInfoValue_;282+ SetTilingOtherInput(tilingCtx_, TilingOtherInputIdx::PLATFORM_INFO, &platformInfoValue_);
251- tilingCtx_->values[tilingInputNum - TILING_FUNC_IDX] = nullptr;283+ SetTilingOtherInput(tilingCtx_, TilingOtherInputIdx::TILING_FUNC, nullptr);
252- tilingCtx_->values[tilingInputNum - DETERMINISTIC_IDX] = nullptr;284+ SetTilingOtherInput(tilingCtx_, TilingOtherInputIdx::DETERMINISTIC, nullptr);
253- tilingCtx_->values[tilingInputNum - 1] = nullptr;285+ SetTilingOtherInput(tilingCtx_, TilingOtherInputIdx::DETERMINISTIC_LEVEL, nullptr);
254- FinalizeTilingCtx(tilingInputNum);286+ SetTilingOtherInput(tilingCtx_, TilingOtherInputIdx::PCIE_THROUGH_FLAG, nullptr);
287+ FinalizeTilingCtx(tilingCtx_->input_size);
255 288 
256 OP_LOGI("Update static kernel tiling ctx. input[%zu], output[%zu], coreNum: %u", kernelCtx->inputNum_,289 OP_LOGI("Update static kernel tiling ctx. input[%zu], output[%zu], coreNum: %u", kernelCtx->inputNum_,
257 kernelCtx->outputNum_, coreNum);290 kernelCtx->outputNum_, coreNum);
@@ -186,7 +186,7 @@ private:
186 186 
187 aclnnStatus EnsureTilingCtxCapacity(size_t requiredCapacity);187 aclnnStatus EnsureTilingCtxCapacity(size_t requiredCapacity);
188 188 
189- size_t ResetTilingCtx(const KernelContextHolder* kernelCtx);189+ aclnnStatus ResetTilingCtx(const KernelContextHolder* kernelCtx);
190 190 
191 void FinalizeTilingCtx(size_t tilingInputNum);191 void FinalizeTilingCtx(size_t tilingInputNum);
192 192 
@@ -197,6 +197,7 @@ private:
197 AsyncAnyValue platformInfoValue_{};197 AsyncAnyValue platformInfoValue_{};
198 AsyncAnyValue deterministicValue_{};198 AsyncAnyValue deterministicValue_{};
199 AsyncAnyValue deterministicLevelValue_{};199 AsyncAnyValue deterministicLevelValue_{};
200+ AsyncAnyValue pcieThroughFlagValue_{};
200 std::unique_ptr<uint8_t[]> workspaceSizeVec_;201 std::unique_ptr<uint8_t[]> workspaceSizeVec_;
201 202 
202 // Dynamic capacity management203 // Dynamic capacity management
@@ -18,8 +18,5 @@ set(NNOPBASE_INDIVIDUAL_OP_INCLUDING_PATH
18 ${ASCEND_INCLUDE_DIR}/external/ac18 ${ASCEND_INCLUDE_DIR}/external/ac
19)19)
20 20 
21-if(DEFINED PRODUCT_SIDE AND "${PRODUCT_SIDE}" STREQUAL "device")
22- target_compile_definitions(nnopbase PRIVATE PRODUCT_SIDE_IS_DEVICE=1)
23-endif()
24target_sources(nnopbase PRIVATE ${NNOPBASE_INDIVIDUAL_OP_SRCS})21target_sources(nnopbase PRIVATE ${NNOPBASE_INDIVIDUAL_OP_SRCS})
25target_include_directories(nnopbase PRIVATE ${NNOPBASE_INDIVIDUAL_OP_INCLUDING_PATH})22target_include_directories(nnopbase PRIVATE ${NNOPBASE_INDIVIDUAL_OP_INCLUDING_PATH})