已合并
fix: remove internal timestamp points #4665
终于成创建于 7月27日
fix: remove internal timestamp points #4665
已合并
共 17 个文件变更+117-184
| @@ -2074,10 +2074,6 @@ def _generate_ffts_source(is_mix: bool) -> str: | |||
| 2074 | source += " if (ffts_addr != nullptr) {\n" | 2074 | source += " if (ffts_addr != nullptr) {\n" |
| 2075 | source += " set_ffts_base_addr((uint64_t)ffts_addr);\n" | 2075 | source += " set_ffts_base_addr((uint64_t)ffts_addr);\n" |
| 2076 | source += " }\n" | 2076 | source += " }\n" |
| 2077 | - source += "#ifdef ASCENDC_TIME_STAMP_ON\n" | ||
| 2078 | - source += " AscendC::PrintTimeStamp(static_cast<uint32_t>\ | ||
| 2079 | -(AscendC::TimeStampId::TIME_STAMP_WRAP_FFTS_ADDR));\n" | ||
| 2080 | - source += "#endif\n" | ||
| 2081 | return source | 2077 | return source |
| 2082 | return "" | 2078 | return "" |
| 2083 | 2079 | ||
| @@ -2109,9 +2105,6 @@ def _generate_matmul_clear_source(is_mix: bool) -> str: | |||
| 2109 | return f"""#if defined(REGIST_MATMUL_OBJ) || defined({MIX_CORE_MACRO}) | 2105 | return f"""#if defined(REGIST_MATMUL_OBJ) || defined({MIX_CORE_MACRO}) |
| 2110 | if constexpr (g_coreType == AscendC::AIC) {{ | 2106 | if constexpr (g_coreType == AscendC::AIC) {{ |
| 2111 | matmul::clearWorkspace(workspace_param); | 2107 | matmul::clearWorkspace(workspace_param); |
| 2112 | -#ifdef ASCENDC_TIME_STAMP_ON | ||
| 2113 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_WRAP_CLEAR_WK_SPAC)); | ||
| 2114 | -#endif | ||
| 2115 | }} | 2108 | }} |
| 2116 | #endif""" | 2109 | #endif""" |
| 2117 | return "" | 2110 | return "" |
| @@ -275,62 +275,54 @@ __aicore__ inline void CountMatmulObj(AscendC::TPipe* tpipe, T& a, Args&&... b) | |||
| 275 | 275 | ||
| 276 | 276 | ||
| 277 | 277 | ||
| 278 | -#define REGIST_CUBE_OBJ(tpipe, workspace, ...) \ | 278 | +#define REGIST_CUBE_OBJ(tpipe, workspace, ...) AscendC::InitCurObj(tpipe, __VA_ARGS__) |
| 279 | - AscendC::InitCurObj(tpipe, __VA_ARGS__); \ | ||
| 280 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_MATMUL_SERVER_OBJ)) | ||
| 281 | 279 | ||
| 282 | 280 | ||
| 283 | 281 | ||
| 284 | 282 | ||
| 285 | -#define REGIST_CUBE_OBJ(tpipe, workspace, ...) \ | 283 | +#define REGIST_CUBE_OBJ(tpipe, workspace, ...) \ |
| 286 | - using ASCubeObjConfig = AscendC::GetCubeObjConfig<decltype(AscendC::GetObjType(__VA_ARGS__))>; \ | 284 | + using ASCubeObjConfig = AscendC::GetCubeObjConfig<decltype(AscendC::GetObjType(__VA_ARGS__))>; \ |
| 287 | - constexpr int8_t enableHardPollKfc = \ | 285 | + constexpr int8_t enableHardPollKfc = \ |
| 288 | - AscendC::ENABLE_HARD_POOL ? AscendC::ENABLE_HARD_POOL : ASCubeObjConfig::enableABShareValue; \ | 286 | + AscendC::ENABLE_HARD_POOL ? AscendC::ENABLE_HARD_POOL : ASCubeObjConfig::enableABShareValue; \ |
| 289 | - constexpr int8_t asEnableMixDualMaster = ASCubeObjConfig::enableMixDualMasterValue; \ | 287 | + constexpr int8_t asEnableMixDualMaster = ASCubeObjConfig::enableMixDualMasterValue; \ |
| 290 | - if constexpr (!asEnableMixDualMaster) { \ | 288 | + if constexpr (!asEnableMixDualMaster) { \ |
| 291 | - AscendC::ClearWorkspace(reinterpret_cast<__gm__ uint8_t*>(workspace)); \ | 289 | + AscendC::ClearWorkspace(reinterpret_cast<__gm__ uint8_t*>(workspace)); \ |
| 292 | - } \ | 290 | + } \ |
| 293 | - AscendC::TQue<AscendC::QuePosition::CO1, 1, &AscendC::gCO1Config> qCO1; \ | 291 | + AscendC::TQue<AscendC::QuePosition::CO1, 1, &AscendC::gCO1Config> qCO1; \ |
| 294 | - AscendC::gCO1Que = &qCO1; \ | 292 | + AscendC::gCO1Que = &qCO1; \ |
| 295 | - AscendC::KfcServer<enableHardPollKfc> server; \ | 293 | + AscendC::KfcServer<enableHardPollKfc> server; \ |
| 296 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_MATMUL_SERVER)); \ | 294 | + server.Init(workspace); \ |
| 297 | - server.Init(workspace); \ | 295 | + server.InitObj(tpipe, __VA_ARGS__); \ |
| 298 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_MATMUL_SERVER_INIT)); \ | 296 | + if constexpr (!asEnableMixDualMaster) { \ |
| 299 | - server.InitObj(tpipe, __VA_ARGS__); \ | 297 | + while (server.isRun()) { \ |
| 300 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_MATMUL_SERVER_OBJ)); \ | 298 | + server.Run(__VA_ARGS__); \ |
| 301 | - if constexpr (!asEnableMixDualMaster) { \ | 299 | + }; \ |
| 302 | - while (server.isRun()) { \ | 300 | + server.Quit(); \ |
| 303 | - server.Run(__VA_ARGS__); \ | 301 | + return; \ |
| 304 | - }; \ | ||
| 305 | - server.Quit(); \ | ||
| 306 | - return; \ | ||
| 307 | } | 302 | } |
| 308 | 303 | ||
| 309 | -#define REGIST_CUBE_OBJ(tpipe, workspace, ...) \ | 304 | +#define REGIST_CUBE_OBJ(tpipe, workspace, ...) \ |
| 310 | - using ASCubeObjConfig = AscendC::GetCubeObjConfig<decltype(AscendC::GetObjType(__VA_ARGS__))>; \ | 305 | + using ASCubeObjConfig = AscendC::GetCubeObjConfig<decltype(AscendC::GetObjType(__VA_ARGS__))>; \ |
| 311 | - static_assert( \ | 306 | + static_assert( \ |
| 312 | - ASCubeObjConfig::enableABShareValue != AscendC::CUBEOBJ_MIX_MODE, \ | 307 | + ASCubeObjConfig::enableABShareValue != AscendC::CUBEOBJ_MIX_MODE, \ |
| 313 | - "If both aType ibshare and bType ibshare are set to true, the values must " \ | 308 | + "If both aType ibshare and bType ibshare are set to true, the values must " \ |
| 314 | - "be the same for all cube objects."); \ | 309 | + "be the same for all cube objects."); \ |
| 315 | - constexpr int8_t asEnableMixDualMaster = ASCubeObjConfig::enableMixDualMasterValue; \ | 310 | + constexpr int8_t asEnableMixDualMaster = ASCubeObjConfig::enableMixDualMasterValue; \ |
| 316 | - static_assert( \ | 311 | + static_assert( \ |
| 317 | - asEnableMixDualMaster != AscendC::CUBEOBJ_MIX_MODE, \ | 312 | + asEnableMixDualMaster != AscendC::CUBEOBJ_MIX_MODE, \ |
| 318 | - "enableMixDualMaster must be consistent for all cube objects."); \ | 313 | + "enableMixDualMaster must be consistent for all cube objects."); \ |
| 319 | - if constexpr (!asEnableMixDualMaster) { \ | 314 | + if constexpr (!asEnableMixDualMaster) { \ |
| 320 | - AscendC::ClearWorkspace(reinterpret_cast<__gm__ uint8_t*>(workspace)); \ | 315 | + AscendC::ClearWorkspace(reinterpret_cast<__gm__ uint8_t*>(workspace)); \ |
| 321 | - } \ | 316 | + } \ |
| 322 | - AscendC::KfcServer server; \ | 317 | + AscendC::KfcServer server; \ |
| 323 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_MATMUL_SERVER)); \ | 318 | + server.Init(workspace); \ |
| 324 | - server.Init(workspace); \ | 319 | + server.InitObj(tpipe, __VA_ARGS__); \ |
| 325 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_MATMUL_SERVER_INIT)); \ | 320 | + if constexpr (!asEnableMixDualMaster) { \ |
| 326 | - server.InitObj(tpipe, __VA_ARGS__); \ | 321 | + while (server.isRun()) { \ |
| 327 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_MATMUL_SERVER_OBJ)); \ | 322 | + server.Run(__VA_ARGS__); \ |
| 328 | - if constexpr (!asEnableMixDualMaster) { \ | 323 | + }; \ |
| 329 | - while (server.isRun()) { \ | 324 | + server.Quit(); \ |
| 330 | - server.Run(__VA_ARGS__); \ | 325 | + return; \ |
| 331 | - }; \ | ||
| 332 | - server.Quit(); \ | ||
| 333 | - return; \ | ||
| 334 | } | 326 | } |
| 335 | 327 | ||
| 336 | 328 | ||
| @@ -356,42 +348,35 @@ __aicore__ inline void CountMatmulObj(AscendC::TPipe* tpipe, T& a, Args&&... b) | |||
| 356 | AscendC::CrossCoreWaitFlag<matmul::INTRA_MODE, PIPE_S>(AscendC::KFC_SYNC_ID); \ | 348 | AscendC::CrossCoreWaitFlag<matmul::INTRA_MODE, PIPE_S>(AscendC::KFC_SYNC_ID); \ |
| 357 | } | 349 | } |
| 358 | 350 | ||
| 359 | -#define REGIST_CUBE_OBJ(tpipe, workspace, ...) \ | 351 | +#define REGIST_CUBE_OBJ(tpipe, workspace, ...) \ |
| 360 | - using ASCubeObjConfig = AscendC::GetCubeObjConfig<decltype(AscendC::GetObjType(__VA_ARGS__))>; \ | 352 | + using ASCubeObjConfig = AscendC::GetCubeObjConfig<decltype(AscendC::GetObjType(__VA_ARGS__))>; \ |
| 361 | - static_assert( \ | 353 | + static_assert( \ |
| 362 | - ASCubeObjConfig::enableABShareValue != AscendC::CUBEOBJ_MIX_MODE, \ | 354 | + ASCubeObjConfig::enableABShareValue != AscendC::CUBEOBJ_MIX_MODE, \ |
| 363 | - "If both aType ibshare and bType ibshare are set to true, the values must " \ | 355 | + "If both aType ibshare and bType ibshare are set to true, the values must " \ |
| 364 | - "be the same for all cube objects."); \ | 356 | + "be the same for all cube objects."); \ |
| 365 | - constexpr int8_t asEnableMixDualMaster = ASCubeObjConfig::enableMixDualMasterValue; \ | 357 | + constexpr int8_t asEnableMixDualMaster = ASCubeObjConfig::enableMixDualMasterValue; \ |
| 366 | - static_assert( \ | 358 | + static_assert( \ |
| 367 | - asEnableMixDualMaster != AscendC::CUBEOBJ_MIX_MODE, \ | 359 | + asEnableMixDualMaster != AscendC::CUBEOBJ_MIX_MODE, \ |
| 368 | - "enableMixDualMaster must be consistent for all cube objects."); \ | 360 | + "enableMixDualMaster must be consistent for all cube objects."); \ |
| 369 | - AscendC::KfcCommClient __kfcClient__(workspace, AscendC::GetSubBlockIdx(), asEnableMixDualMaster); \ | 361 | + AscendC::KfcCommClient __kfcClient__(workspace, AscendC::GetSubBlockIdx(), asEnableMixDualMaster); \ |
| 370 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_MATMUL_CLIENT_KFC)); \ | 362 | + if constexpr (!asEnableMixDualMaster) { \ |
| 371 | - if constexpr (!asEnableMixDualMaster) { \ | 363 | + AscendC::g_kfcClient = &__kfcClient__; \ |
| 372 | - AscendC::g_kfcClient = &__kfcClient__; \ | 364 | + } \ |
| 373 | - } \ | 365 | + AscendC::SetMatrixKfc(tpipe, &__kfcClient__, 0, workspace, __VA_ARGS__); \ |
| 374 | - AscendC::SetMatrixKfc(tpipe, &__kfcClient__, 0, workspace, __VA_ARGS__); \ | 366 | + if constexpr (!asEnableMixDualMaster) { \ |
| 375 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_MATMUL_MATRIX_KFC)); \ | 367 | + if constexpr (AscendC::DAV_310_ENABLE_GM) { \ |
| 376 | - if constexpr (!asEnableMixDualMaster) { \ | 368 | + AscendC::ClearWorkspace(reinterpret_cast<__gm__ uint8_t*>(workspace)); \ |
| 377 | - if constexpr (AscendC::DAV_310_ENABLE_GM) { \ | 369 | + } else { \ |
| 378 | - AscendC::ClearWorkspace(reinterpret_cast<__gm__ uint8_t*>(workspace)); \ | 370 | + AscendC::WaitEvent(AscendC::WORKSPACE_SYNC_ID); \ |
| 379 | - } else { \ | 371 | + } \ |
| 380 | - AscendC::WaitEvent(AscendC::WORKSPACE_SYNC_ID); \ | 372 | + } |
| 381 | - } \ | ||
| 382 | - } \ | ||
| 383 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_MATMUL_WAIT_EVE)) | ||
| 384 | 373 | ||
| 385 | 374 | ||
| 386 | -#define REGIST_CUBE_OBJ(tpipe, workspace, ...) \ | 375 | +#define REGIST_CUBE_OBJ(tpipe, workspace, ...) AscendC::InitCurObj(tpipe, __VA_ARGS__) |
| 387 | - AscendC::InitCurObj(tpipe, __VA_ARGS__); \ | ||
| 388 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_MATMUL_SERVER_OBJ)) | ||
| 389 | 376 | ||
| 390 | 377 | ||
| 391 | 378 | ||
| 392 | -#define REGIST_CUBE_OBJ(tpipe, workspace, ...) \ | 379 | +#define REGIST_CUBE_OBJ(tpipe, workspace, ...) AscendC::InitCurObj(tpipe, __VA_ARGS__) |
| 393 | - AscendC::InitCurObj(tpipe, __VA_ARGS__); \ | ||
| 394 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_MATMUL_OBJ)) | ||
| 395 | 380 | ||
| 396 | 381 | ||
| 397 | 382 | ||
| @@ -98,9 +98,10 @@ __aicore__ inline void DumpTensorGM2GMImpl(const GlobalTensor<T>& src, uint32_t | |||
| 98 | 98 | ||
| 99 | __aicore__ inline void DumpTimeStampImpl(uint32_t descId) | 99 | __aicore__ inline void DumpTimeStampImpl(uint32_t descId) |
| 100 | { | 100 | { |
| 101 | + const uint64_t time = __asc_aicore::asc_capture_time_stamp_cycle(); | ||
| 101 | dcci((__gm__ uint64_t*)g_sysPrintFifoSpace, cache_line_t::ENTIRE_DATA_CACHE, dcci_dst_t::CACHELINE_OUT); | 102 | dcci((__gm__ uint64_t*)g_sysPrintFifoSpace, cache_line_t::ENTIRE_DATA_CACHE, dcci_dst_t::CACHELINE_OUT); |
| 102 | if (g_sysPrintFifoSpace != nullptr) { | 103 | if (g_sysPrintFifoSpace != nullptr) { |
| 103 | - __asc_aicore::asc_time_stamp(descId); | 104 | + __asc_aicore::asc_time_stamp_impl(descId, time); |
| 104 | } | 105 | } |
| 105 | } | 106 | } |
| 106 | 107 | ||
| @@ -233,9 +233,6 @@ __aicore__ inline bool TPipe::InitBuffer(T& que, const Std::tuple<U, V>& addr0, | |||
| 233 | KERNEL_LOG_INTERNAL( | 233 | KERNEL_LOG_INTERNAL( |
| 234 | KERNEL_ERROR, "Total buffer num managed by TPipe is %d, should be in range (0, %d]\n", | 234 | KERNEL_ERROR, "Total buffer num managed by TPipe is %d, should be in range (0, %d]\n", |
| 235 | this->g_tpipeImpl.curBufSize_, QBUF_MAX_LEN)); | 235 | this->g_tpipeImpl.curBufSize_, QBUF_MAX_LEN)); |
| 236 | - | ||
| 237 | - PrintTimeStamp(static_cast<uint32_t>(TimeStampId::TIME_STAMP_BUFFER)); | ||
| 238 | - | ||
| 239 | return true; | 236 | return true; |
| 240 | } | 237 | } |
| 241 | 238 | ||
| @@ -153,9 +153,10 @@ __aicore__ inline void PrintfImpl(DumpType printType, __gm__ const char* fmt, Ar | |||
| 153 | 153 | ||
| 154 | __aicore__ inline void DumpTimeStampImpl(uint32_t descId) | 154 | __aicore__ inline void DumpTimeStampImpl(uint32_t descId) |
| 155 | { | 155 | { |
| 156 | + const uint64_t time = __asc_aicore::asc_capture_time_stamp_cycle(); | ||
| 156 | dcci((__gm__ uint64_t*)g_sysPrintFifoSpace, cache_line_t::ENTIRE_DATA_CACHE, dcci_dst_t::CACHELINE_OUT); | 157 | dcci((__gm__ uint64_t*)g_sysPrintFifoSpace, cache_line_t::ENTIRE_DATA_CACHE, dcci_dst_t::CACHELINE_OUT); |
| 157 | if (g_sysPrintFifoSpace != nullptr) { | 158 | if (g_sysPrintFifoSpace != nullptr) { |
| 158 | - __asc_aicore::asc_time_stamp(descId); | 159 | + __asc_aicore::asc_time_stamp_impl(descId, time); |
| 159 | } | 160 | } |
| 160 | } | 161 | } |
| 161 | 162 | ||
| @@ -75,9 +75,6 @@ __aicore__ inline TPipe::TPipe() | |||
| 75 | { | 75 | { |
| 76 | InitSocState(); | 76 | InitSocState(); |
| 77 | Init(); | 77 | Init(); |
| 78 | - | ||
| 79 | - PrintTimeStamp(static_cast<uint32_t>(TimeStampId::TIME_STAMP_TPIPE)); | ||
| 80 | - | ||
| 81 | } | 78 | } |
| 82 | 79 | ||
| 83 | __aicore__ inline TPipe::~TPipe() | 80 | __aicore__ inline TPipe::~TPipe() |
| @@ -243,9 +240,6 @@ __aicore__ inline bool TPipe::InitBuffer(T& que, const Std::tuple<U, V>& addr0, | |||
| 243 | KERNEL_LOG_INTERNAL( | 240 | KERNEL_LOG_INTERNAL( |
| 244 | KERNEL_ERROR, "Total buffer num managed by TPipe is %d, should be in range (0, %d]\n", | 241 | KERNEL_ERROR, "Total buffer num managed by TPipe is %d, should be in range (0, %d]\n", |
| 245 | this->g_tpipeImpl.curBufSize_, QBUF_MAX_LEN)); | 242 | this->g_tpipeImpl.curBufSize_, QBUF_MAX_LEN)); |
| 246 | - | ||
| 247 | - PrintTimeStamp(static_cast<uint32_t>(TimeStampId::TIME_STAMP_BUFFER)); | ||
| 248 | - | ||
| 249 | return true; | 243 | return true; |
| 250 | } | 244 | } |
| 251 | 245 | ||
| @@ -346,9 +340,6 @@ __aicore__ inline bool TPipe::InitBuffer(T& que, uint8_t num, uint32_t len) | |||
| 346 | KERNEL_LOG_INTERNAL( | 340 | KERNEL_LOG_INTERNAL( |
| 347 | KERNEL_ERROR, "tscm addr is %d, limits is %d", | 341 | KERNEL_ERROR, "tscm addr is %d, limits is %d", |
| 348 | this->g_tpipeImpl.bufPool_[static_cast<uint8_t>(Hardware::L1)].maxAddr, this->g_tpipeImpl.tscmBufferPtr_)); | 342 | this->g_tpipeImpl.bufPool_[static_cast<uint8_t>(Hardware::L1)].maxAddr, this->g_tpipeImpl.tscmBufferPtr_)); |
| 349 | - | ||
| 350 | - PrintTimeStamp(static_cast<uint32_t>(TimeStampId::TIME_STAMP_BUFFER)); | ||
| 351 | - | ||
| 352 | return true; | 343 | return true; |
| 353 | } | 344 | } |
| 354 | 345 | ||
| @@ -412,9 +403,6 @@ __aicore__ inline bool TPipe::InitBuffer(TBuf<pos>& buf, uint32_t len) | |||
| 412 | KERNEL_LOG_INTERNAL( | 403 | KERNEL_LOG_INTERNAL( |
| 413 | KERNEL_ERROR, "Total buffer num managed by TPipe is %d, should be in range (0, %d]\n", | 404 | KERNEL_ERROR, "Total buffer num managed by TPipe is %d, should be in range (0, %d]\n", |
| 414 | this->g_tpipeImpl.curBufSize_, QBUF_MAX_LEN)); | 405 | this->g_tpipeImpl.curBufSize_, QBUF_MAX_LEN)); |
| 415 | - | ||
| 416 | - PrintTimeStamp(static_cast<uint32_t>(TimeStampId::TIME_STAMP_BUFFER)); | ||
| 417 | - | ||
| 418 | return true; | 406 | return true; |
| 419 | } | 407 | } |
| 420 | 408 | ||
| @@ -51,10 +51,10 @@ __aicore__ inline void asc_write_time_stamp_tlv( | |||
| 51 | update_write_info(write_info, tlv_len); | 51 | update_write_info(write_info, tlv_len); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | -__aicore__ inline void asc_time_stamp_impl(uint32_t desc_id) | 54 | +__aicore__ inline void asc_time_stamp_impl(uint32_t desc_id, uint64_t time) |
| 55 | { | 55 | { |
| 56 | + enable_asc_diagnostics(); | ||
| 56 | 57 | ||
| 57 | - const uint64_t time = asc_debug_get_system_cycle(); | ||
| 58 | const uint64_t entry = static_cast<uint64_t>(__get_entry_sys_cnt()); | 58 | const uint64_t entry = static_cast<uint64_t>(__get_entry_sys_cnt()); |
| 59 | __gm__ DebugBlockHeadInfo* block_info = get_block_info(); | 59 | __gm__ DebugBlockHeadInfo* block_info = get_block_info(); |
| 60 | if (block_info == nullptr) { | 60 | if (block_info == nullptr) { |
| @@ -69,10 +69,16 @@ __aicore__ inline void asc_time_stamp_impl(uint32_t desc_id) | |||
| 69 | 69 | ||
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | +__aicore__ inline uint64_t asc_capture_time_stamp_cycle() { return asc_debug_get_system_cycle(); } | ||
| 73 | + | ||
| 72 | __aicore__ inline void asc_time_stamp(uint32_t desc_id) | 74 | __aicore__ inline void asc_time_stamp(uint32_t desc_id) |
| 73 | { | 75 | { |
| 76 | + | ||
| 77 | + const uint64_t time = asc_debug_get_system_cycle(); | ||
| 78 | + asc_time_stamp_impl(desc_id, time); | ||
| 79 | + | ||
| 74 | enable_asc_diagnostics(); | 80 | enable_asc_diagnostics(); |
| 75 | - asc_time_stamp_impl(desc_id); | 81 | +#endif |
| 76 | } | 82 | } |
| 77 | 83 | ||
| 78 | __aicore__ inline void asc_prof_start() { bisheng::cce::metrics_prof_start(); } | 84 | __aicore__ inline void asc_prof_start() { bisheng::cce::metrics_prof_start(); } |
| @@ -105,6 +111,10 @@ __aicore__ inline void asc_time_stamp(uint32_t desc_id) | |||
| 105 | { | 111 | { |
| 106 | assert(false && "asc_time_stamp is not supported in cpu mode."); | 112 | assert(false && "asc_time_stamp is not supported in cpu mode."); |
| 107 | } | 113 | } |
| 114 | + | ||
| 115 | +__aicore__ inline uint64_t asc_capture_time_stamp_cycle() { return 0; } | ||
| 116 | + | ||
| 117 | +__aicore__ inline void asc_time_stamp_impl(uint32_t desc_id, uint64_t) { asc_time_stamp(desc_id); } | ||
| 108 | } // namespace __asc_aicore | 118 | } // namespace __asc_aicore |
| 109 | 119 | ||
| 110 | using namespace __asc_aicore; | 120 | using namespace __asc_aicore; |
| @@ -109,18 +109,13 @@ public: | |||
| 109 | }; | 109 | }; |
| 110 | 110 | ||
| 111 | 111 | ||
| 112 | -#define GET_TILING_DATA(tiling_data, tiling_arg) \ | 112 | +#define GET_TILING_DATA(tiling_data, tiling_arg) const TilingData tiling_data; |
| 113 | - const TilingData tiling_data; \ | ||
| 114 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_TILING_DATA)); | ||
| 115 | 113 | ||
| 116 | -#define GET_TILING_DATA_WITH_STRUCT(tiling_struct, tiling_data, tiling_arg) \ | 114 | +#define GET_TILING_DATA_WITH_STRUCT(tiling_struct, tiling_data, tiling_arg) const tiling_struct tiling_data; |
| 117 | - const tiling_struct tiling_data; \ | ||
| 118 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_TILING_DATA_STRUCT)); | ||
| 119 | 115 | ||
| 120 | 116 | ||
| 121 | const tiling_type point# | 117 | const tiling_type point# |
| 122 | - auto& var = point##var.member; \ | 118 | + auto& var = point##var.member; |
| 123 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_TILING_DATA_MEMBER)); | ||
| 124 | 119 | ||
| 125 | 120 | ||
| 126 | 121 | ||
| @@ -115,21 +115,18 @@ __inline__ __attribute__((always_inline)) __aicore__ void InitTilingData( | |||
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | 117 | ||
| 118 | -#define GET_TILING_DATA(tiling_data, tiling_arg) \ | 118 | +#define GET_TILING_DATA(tiling_data, tiling_arg) \ |
| 119 | - TilingDataUnalign tiling_data; \ | 119 | + TilingDataUnalign tiling_data; \ |
| 120 | - InitTilingData<TilingDataUnalign>(tiling_arg, &tiling_data); \ | 120 | + InitTilingData<TilingDataUnalign>(tiling_arg, &tiling_data); |
| 121 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_TILING_DATA)); | ||
| 122 | 121 | ||
| 123 | 122 | ||
| 124 | tiling_struct tiling_data; \ | 123 | tiling_struct tiling_data; \ |
| 125 | - InitTilingData<tiling_struct>(tiling_arg, &tiling_data); \ | 124 | + InitTilingData<tiling_struct>(tiling_arg, &tiling_data); |
| 126 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_TILING_DATA_STRUCT)); | ||
| 127 | 125 | ||
| 128 | -#define GET_TILING_DATA_MEMBER(tiling_type, member, var, tiling) \ | 126 | +#define GET_TILING_DATA_MEMBER(tiling_type, member, var, tiling) \ |
| 129 | - decltype(((tiling_type*)0)->member) var; \ | 127 | + decltype(((tiling_type*)0)->member) var; \ |
| 130 | - size_t offset##var = (size_t)(&((tiling_type*)0)->member); \ | 128 | + size_t offset##var = (size_t)(&((tiling_type*)0)->member); \ |
| 131 | - InitTilingData<decltype(((tiling_type*)0)->member)>(tiling + offset##var, &var); \ | 129 | + InitTilingData<decltype(((tiling_type*)0)->member)>(tiling + offset##var, &var); |
| 132 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_TILING_DATA_MEMBER)); | ||
| 133 | 130 | ||
| 134 | 131 | ||
| 135 | 132 | ||
| @@ -109,18 +109,13 @@ public: | |||
| 109 | }; | 109 | }; |
| 110 | 110 | ||
| 111 | 111 | ||
| 112 | -#define GET_TILING_DATA(tiling_data, tiling_arg) \ | 112 | +#define GET_TILING_DATA(tiling_data, tiling_arg) const TilingData tiling_data; |
| 113 | - const TilingData tiling_data; \ | ||
| 114 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_TILING_DATA)); | ||
| 115 | 113 | ||
| 116 | -#define GET_TILING_DATA_WITH_STRUCT(tiling_struct, tiling_data, tiling_arg) \ | 114 | +#define GET_TILING_DATA_WITH_STRUCT(tiling_struct, tiling_data, tiling_arg) const tiling_struct tiling_data; |
| 117 | - const tiling_struct tiling_data; \ | ||
| 118 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_TILING_DATA_STRUCT)); | ||
| 119 | 115 | ||
| 120 | 116 | ||
| 121 | const tiling_type point# | 117 | const tiling_type point# |
| 122 | - auto& var = point##var.member; \ | 118 | + auto& var = point##var.member; |
| 123 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_TILING_DATA_MEMBER)); | ||
| 124 | 119 | ||
| 125 | 120 | ||
| 126 | 121 | ||
| @@ -109,18 +109,13 @@ public: | |||
| 109 | }; | 109 | }; |
| 110 | 110 | ||
| 111 | 111 | ||
| 112 | -#define GET_TILING_DATA(tiling_data, tiling_arg) \ | 112 | +#define GET_TILING_DATA(tiling_data, tiling_arg) const TilingData tiling_data; |
| 113 | - const TilingData tiling_data; \ | ||
| 114 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_TILING_DATA)); | ||
| 115 | 113 | ||
| 116 | -#define GET_TILING_DATA_WITH_STRUCT(tiling_struct, tiling_data, tiling_arg) \ | 114 | +#define GET_TILING_DATA_WITH_STRUCT(tiling_struct, tiling_data, tiling_arg) const tiling_struct tiling_data; |
| 117 | - const tiling_struct tiling_data; \ | ||
| 118 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_TILING_DATA_STRUCT)); | ||
| 119 | 115 | ||
| 120 | 116 | ||
| 121 | const tiling_type point# | 117 | const tiling_type point# |
| 122 | - auto& var = point##var.member; \ | 118 | + auto& var = point##var.member; |
| 123 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_TILING_DATA_MEMBER)); | ||
| 124 | 119 | ||
| 125 | 120 | ||
| 126 | 121 | ||
| @@ -115,21 +115,18 @@ __inline__ __attribute__((always_inline)) __aicore__ void InitTilingData( | |||
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | 117 | ||
| 118 | -#define GET_TILING_DATA(tiling_data, tiling_arg) \ | 118 | +#define GET_TILING_DATA(tiling_data, tiling_arg) \ |
| 119 | - TilingDataUnalign tiling_data; \ | 119 | + TilingDataUnalign tiling_data; \ |
| 120 | - InitTilingData<TilingDataUnalign>(tiling_arg, &tiling_data); \ | 120 | + InitTilingData<TilingDataUnalign>(tiling_arg, &tiling_data); |
| 121 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_TILING_DATA)); | ||
| 122 | 121 | ||
| 123 | 122 | ||
| 124 | tiling_struct tiling_data; \ | 123 | tiling_struct tiling_data; \ |
| 125 | - InitTilingData<tiling_struct>(tiling_arg, &tiling_data); \ | 124 | + InitTilingData<tiling_struct>(tiling_arg, &tiling_data); |
| 126 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_TILING_DATA_STRUCT)); | ||
| 127 | 125 | ||
| 128 | -#define GET_TILING_DATA_MEMBER(tiling_type, member, var, tiling) \ | 126 | +#define GET_TILING_DATA_MEMBER(tiling_type, member, var, tiling) \ |
| 129 | - decltype(((tiling_type*)0)->member) var; \ | 127 | + decltype(((tiling_type*)0)->member) var; \ |
| 130 | - size_t offset##var = (size_t)(&((tiling_type*)0)->member); \ | 128 | + size_t offset##var = (size_t)(&((tiling_type*)0)->member); \ |
| 131 | - InitTilingData<decltype(((tiling_type*)0)->member)>(tiling + offset##var, &var); \ | 129 | + InitTilingData<decltype(((tiling_type*)0)->member)>(tiling + offset##var, &var); |
| 132 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_TILING_DATA_MEMBER)); | ||
| 133 | 130 | ||
| 134 | 131 | ||
| 135 | 132 | ||
| @@ -109,18 +109,13 @@ public: | |||
| 109 | }; | 109 | }; |
| 110 | 110 | ||
| 111 | 111 | ||
| 112 | -#define GET_TILING_DATA(tiling_data, tiling_arg) \ | 112 | +#define GET_TILING_DATA(tiling_data, tiling_arg) const TilingData tiling_data; |
| 113 | - const TilingData tiling_data; \ | ||
| 114 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_TILING_DATA)); | ||
| 115 | 113 | ||
| 116 | -#define GET_TILING_DATA_WITH_STRUCT(tiling_struct, tiling_data, tiling_arg) \ | 114 | +#define GET_TILING_DATA_WITH_STRUCT(tiling_struct, tiling_data, tiling_arg) const tiling_struct tiling_data; |
| 117 | - const tiling_struct tiling_data; \ | ||
| 118 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_TILING_DATA_STRUCT)); | ||
| 119 | 115 | ||
| 120 | 116 | ||
| 121 | const tiling_type point# | 117 | const tiling_type point# |
| 122 | - auto& var = point##var.member; \ | 118 | + auto& var = point##var.member; |
| 123 | - AscendC::PrintTimeStamp(static_cast<uint32_t>(AscendC::TimeStampId::TIME_STAMP_TILING_DATA_MEMBER)); | ||
| 124 | 119 | ||
| 125 | 120 | ||
| 126 | 121 | ||
| @@ -668,7 +668,6 @@ def _gen_set_workspace_codes( | |||
| 668 | source += " if (ffts_addr != nullptr) {\n" | 668 | source += " if (ffts_addr != nullptr) {\n" |
| 669 | source += " set_ffts_base_addr((uint64_t)ffts_addr);\n" | 669 | source += " set_ffts_base_addr((uint64_t)ffts_addr);\n" |
| 670 | source += " }\n" | 670 | source += " }\n" |
| 671 | - source += add_time_stamp_codes("TIME_STAMP_WRAP_FFTS_ADDR") | ||
| 672 | 671 | ||
| 673 | # restart enable begin position | 672 | # restart enable begin position |
| 674 | if global_var_storage.get_variable("ascendc_enable_aicore_exception_restart"): | 673 | if global_var_storage.get_variable("ascendc_enable_aicore_exception_restart"): |
| @@ -679,7 +678,6 @@ def _gen_set_workspace_codes( | |||
| 679 | source += f"#ifdef {MIX_CORE_MACRO} \n" | 678 | source += f"#ifdef {MIX_CORE_MACRO} \n" |
| 680 | source += " if constexpr (g_coreType == AscendC::AIC) {\n" | 679 | source += " if constexpr (g_coreType == AscendC::AIC) {\n" |
| 681 | source += " matmul::clearWorkspace(workspace);\n" | 680 | source += " matmul::clearWorkspace(workspace);\n" |
| 682 | - source += add_time_stamp_codes("TIME_STAMP_WRAP_CLEAR_WK_SPAC", 2) | ||
| 683 | source += " }\n" | 681 | source += " }\n" |
| 684 | source += "#endif\n" | 682 | source += "#endif\n" |
| 685 | return source | 683 | return source |
| @@ -848,7 +846,6 @@ def gen_kernel_fun( | |||
| 848 | source += gen_init_dump_code() | 846 | source += gen_init_dump_code() |
| 849 | # set mc2 context | 847 | # set mc2 context |
| 850 | source += _gen_set_mc2_ctx_param(opinfo) | 848 | source += _gen_set_mc2_ctx_param(opinfo) |
| 851 | - source += add_time_stamp_codes("TIME_STAMP_WRAP_MC2_CTX") | ||
| 852 | # implicit add aicore exception restart begin position | 849 | # implicit add aicore exception restart begin position |
| 853 | # set workspace | 850 | # set workspace |
| 854 | source += _gen_set_workspace_codes( | 851 | source += _gen_set_workspace_codes( |
| @@ -1397,22 +1397,17 @@ def _get_tiling_data_with_time_stamp(class_name): | |||
| 1397 | class_body += ( | 1397 | class_body += ( |
| 1398 | f" {class_name} tiling_data; \\\n" | 1398 | f" {class_name} tiling_data; \\\n" |
| 1399 | ) | 1399 | ) |
| 1400 | - class_body += ( | 1400 | + class_body += f" InitTilingData<{class_name}>(tiling_arg, &tiling_data);\n" |
| 1401 | - f" InitTilingData<{class_name}>(tiling_arg, &tiling_data); \\\n" | ||
| 1402 | - ) | ||
| 1403 | - class_body += _add_time_stamp_codes("TIME_STAMP_TILING_DATA") | ||
| 1404 | class_body += "#define GET_TILING_DATA_WITH_STRUCT(tiling_struct, tiling_data, tiling_arg) \\\n" | 1401 | class_body += "#define GET_TILING_DATA_WITH_STRUCT(tiling_struct, tiling_data, tiling_arg) \\\n" |
| 1405 | class_body += " REGISTER_TILINGDATA_SIZE(tiling_struct, __COUNTER__); \\\n" | 1402 | class_body += " REGISTER_TILINGDATA_SIZE(tiling_struct, __COUNTER__); \\\n" |
| 1406 | class_body += " tiling_struct tiling_data; \\\n" | 1403 | class_body += " tiling_struct tiling_data; \\\n" |
| 1407 | - class_body += " InitTilingData<tiling_struct>(tiling_arg, &tiling_data); \\\n" | 1404 | + class_body += " InitTilingData<tiling_struct>(tiling_arg, &tiling_data);\n" |
| 1408 | - class_body += _add_time_stamp_codes("TIME_STAMP_TILING_DATA_STRUCT") | ||
| 1409 | 1405 | ||
| 1410 | class_body += "#define GET_TILING_DATA_MEMBER(tiling_type, member, var, tiling) \\\n" | 1406 | class_body += "#define GET_TILING_DATA_MEMBER(tiling_type, member, var, tiling) \\\n" |
| 1411 | class_body += " REGISTER_TILINGDATA_SIZE(tiling_type, __COUNTER__); \\\n" | 1407 | class_body += " REGISTER_TILINGDATA_SIZE(tiling_type, __COUNTER__); \\\n" |
| 1412 | class_body += " decltype(((tiling_type *)0)->member) var; \\\n" | 1408 | class_body += " decltype(((tiling_type *)0)->member) var; \\\n" |
| 1413 | class_body += " size_t offset##var = (size_t)(&((tiling_type*)0)->member); \\\n" | 1409 | class_body += " size_t offset##var = (size_t)(&((tiling_type*)0)->member); \\\n" |
| 1414 | - class_body += " InitTilingData<decltype(((tiling_type *)0)->member)>(tiling + offset##var, &var);\\\n" | 1410 | + class_body += " InitTilingData<decltype(((tiling_type *)0)->member)>(tiling + offset##var, &var);\n" |
| 1415 | - class_body += _add_time_stamp_codes("TIME_STAMP_TILING_DATA_MEMBER") | ||
| 1416 | 1411 | ||
| 1417 | class_body += "#else\n" | 1412 | class_body += "#else\n" |
| 1418 | 1413 | ||
| @@ -635,7 +635,6 @@ def _gen_set_workspace_codes( | |||
| 635 | source += " if (ffts_addr != nullptr) {\n" | 635 | source += " if (ffts_addr != nullptr) {\n" |
| 636 | source += " set_ffts_base_addr((uint64_t)ffts_addr);\n" | 636 | source += " set_ffts_base_addr((uint64_t)ffts_addr);\n" |
| 637 | source += " }\n" | 637 | source += " }\n" |
| 638 | - source += add_time_stamp_codes("TIME_STAMP_WRAP_FFTS_ADDR") | ||
| 639 | 638 | ||
| 640 | # restart enable begin position | 639 | # restart enable begin position |
| 641 | if global_var_storage.get_variable("ascendc_enable_aicore_exception_restart"): | 640 | if global_var_storage.get_variable("ascendc_enable_aicore_exception_restart"): |
| @@ -646,7 +645,6 @@ def _gen_set_workspace_codes( | |||
| 646 | source += f"#ifdef {MIX_CORE_MACRO} \n" | 645 | source += f"#ifdef {MIX_CORE_MACRO} \n" |
| 647 | source += " if constexpr (g_coreType == AscendC::AIC) {\n" | 646 | source += " if constexpr (g_coreType == AscendC::AIC) {\n" |
| 648 | source += " matmul::clearWorkspace(workspace);\n" | 647 | source += " matmul::clearWorkspace(workspace);\n" |
| 649 | - source += add_time_stamp_codes("TIME_STAMP_WRAP_CLEAR_WK_SPAC", 2) | ||
| 650 | source += " }\n" | 648 | source += " }\n" |
| 651 | source += "#endif\n" | 649 | source += "#endif\n" |
| 652 | return source | 650 | return source |
| @@ -815,7 +813,6 @@ def gen_kernel_fun( | |||
| 815 | source += gen_init_dump_code() | 813 | source += gen_init_dump_code() |
| 816 | # set mc2 context | 814 | # set mc2 context |
| 817 | source += _gen_set_mc2_ctx_param(opinfo) | 815 | source += _gen_set_mc2_ctx_param(opinfo) |
| 818 | - source += add_time_stamp_codes("TIME_STAMP_WRAP_MC2_CTX") | ||
| 819 | # implicit add aicore exception restart begin position | 816 | # implicit add aicore exception restart begin position |
| 820 | # set workspace | 817 | # set workspace |
| 821 | source += _gen_set_workspace_codes( | 818 | source += _gen_set_workspace_codes( |
| @@ -1399,22 +1399,17 @@ def _get_tiling_data_with_time_stamp(class_name): | |||
| 1399 | class_body += ( | 1399 | class_body += ( |
| 1400 | f" {class_name} tiling_data; \\\n" | 1400 | f" {class_name} tiling_data; \\\n" |
| 1401 | ) | 1401 | ) |
| 1402 | - class_body += ( | 1402 | + class_body += f" InitTilingData<{class_name}>(tiling_arg, &tiling_data);\n" |
| 1403 | - f" InitTilingData<{class_name}>(tiling_arg, &tiling_data); \\\n" | ||
| 1404 | - ) | ||
| 1405 | - class_body += _add_time_stamp_codes("TIME_STAMP_TILING_DATA") | ||
| 1406 | class_body += "#define GET_TILING_DATA_WITH_STRUCT(tiling_struct, tiling_data, tiling_arg) \\\n" | 1403 | class_body += "#define GET_TILING_DATA_WITH_STRUCT(tiling_struct, tiling_data, tiling_arg) \\\n" |
| 1407 | class_body += " REGISTER_TILINGDATA_SIZE(tiling_struct, __COUNTER__); \\\n" | 1404 | class_body += " REGISTER_TILINGDATA_SIZE(tiling_struct, __COUNTER__); \\\n" |
| 1408 | class_body += " tiling_struct tiling_data; \\\n" | 1405 | class_body += " tiling_struct tiling_data; \\\n" |
| 1409 | - class_body += " InitTilingData<tiling_struct>(tiling_arg, &tiling_data); \\\n" | 1406 | + class_body += " InitTilingData<tiling_struct>(tiling_arg, &tiling_data);\n" |
| 1410 | - class_body += _add_time_stamp_codes("TIME_STAMP_TILING_DATA_STRUCT") | ||
| 1411 | 1407 | ||
| 1412 | class_body += "#define GET_TILING_DATA_MEMBER(tiling_type, member, var, tiling) \\\n" | 1408 | class_body += "#define GET_TILING_DATA_MEMBER(tiling_type, member, var, tiling) \\\n" |
| 1413 | class_body += " REGISTER_TILINGDATA_SIZE(tiling_type, __COUNTER__); \\\n" | 1409 | class_body += " REGISTER_TILINGDATA_SIZE(tiling_type, __COUNTER__); \\\n" |
| 1414 | class_body += " decltype(((tiling_type *)0)->member) var; \\\n" | 1410 | class_body += " decltype(((tiling_type *)0)->member) var; \\\n" |
| 1415 | class_body += " size_t offset##var = (size_t)(&((tiling_type*)0)->member); \\\n" | 1411 | class_body += " size_t offset##var = (size_t)(&((tiling_type*)0)->member); \\\n" |
| 1416 | - class_body += " InitTilingData<decltype(((tiling_type *)0)->member)>(tiling + offset##var, &var);\\\n" | 1412 | + class_body += " InitTilingData<decltype(((tiling_type *)0)->member)>(tiling + offset##var, &var);\n" |
| 1417 | - class_body += _add_time_stamp_codes("TIME_STAMP_TILING_DATA_MEMBER") | ||
| 1418 | 1413 | ||
| 1419 | class_body += "#else\n" | 1414 | class_body += "#else\n" |
| 1420 | 1415 | ||