Merged
fix(machine): Add aicore-resolve macro #5549
huangluAdd on Aug 19
fix(machine): Add aicore-resolve macro #5549
Merged
Merged fromlululu40888/pypto_1masterintocann/pyptomaster
Pull Request has been successfully merged by CANN-robot.
(Thank you for huanglu's contribution.)atomgit-bot
Aug 19 Comments:
Aug 19 Comments:
变更摘要
本 PR 为 machine 侧新增 aicore-resolve(DRCO,Dependency Resolving by aiCOre)调度能力:通过环境变量 ENABLE_AICORE_RESOLVE 与编译宏 -DENABLE_AICORE_RESOLVE=1/0 控制开关,开启后任务依赖由 AICore 设备端自行解析,不再依赖 AICPU 调度流。设备端新增 KernelEntryDrco 调度主循环,从 per-core 待处理队列、local/global ready 队列取任务执行并通过原子递减 predCount 解析后继;主机侧新增 DrcoRootFuncList 构造、ready 队列按核分发、备份/恢复/重定位等配套逻辑,并新增对应单测。
主要改动
- 设备端 DRCO 调度入口:新增
framework/src/interface/machine/device/tilefwk/aicore_entry_drco.h(KernelEntryDrco、ExecDrcoResolve及 local/global ready 队列读写函数),aicore_entry.h的KernelEntry在IS_AICORE && ENABLE_AICORE_RESOLVE时直接转入KernelEntryDrco。 - 开关与宏透传:
aikernel_define.h定义ENABLE_AICORE_RESOLVE默认 0,aicpu_common.h的DeviceArgs增加运行时字段enableAicoreResolve,common.h新增IsAicoreResolveEnabled()读取环境变量,aicore_compiler.cpp、compile_control_bin.cpp、backend.cpp将开关编译为-DENABLE_AICORE_RESOLVE=1/0。 - 依赖与队列数据结构扩展:
DrcoRootFuncData移入DynFuncData并在FillOneDynFuncData初始化;DrcoDeviceTaskReadyQueue::Append增加rootFuncList参数;predcount_t由uint16_t改为int32_t;dev_encode.cpp为每个 op 编码DevAscendFunctionOperationSuccInfo(staticIndex/staticSize/stitchIndex);DevAscendFunctionDuppedStitch重构为aikernel_device_task.h中的DevAscendFunctionDuppedStitchNode,PushBack改名为SafePushBack。 - 主机侧任务构造与缓存恢复:
DeviceTaskContext新增InitDrcoRootFuncList、BuildDrcoRootFuncData、DispatchReadyQueueToCores/DispatchDieReadyQueueToCores,将 AIV/AIC 任务分发到各核 per-core 队列;DevControlFlowCache增加 drco 队列的备份/恢复与RelocDrcoRootFuncList重定位;slab_ws_allocator.h与dev_workspace.*新增PER_CORE_PENDING_QUE/LOCAL_READY_QUE/GLOBAL_READY_QUE/PRED_COUNT内存类型及分配函数;device_task.h的FillDeviceRuntimeOffset新增deviceTaskReadyQueueOffset,dev_start_args.h的DevStartArgs新增drcoDeviceTaskReadyQueue,并将RuntimeDataRingBufferHead重构为继承RuntimeDataRingBufferHeadData。 - 启动与同步路径改造:开启 aicore-resolve 后
device_launcher.cpp、kernel_bundle_launch.cpp跳过 AICPU 调度流同步(LaunchSyncTask直接返回、DynamicLaunchSynchronize跳过 sched 流同步),改由同步 aicore 流;aicore_runtime.h的WaitAicoreStart提前返回;device_ctrl.h改为向设备任务 ready 队列Append任务并在DeviceTaskMemTryRecycle中依据executedTaskCount/ctrlNotFreeFlag回收工作区内存。


Incorrect?
atomgit-bot
Aug 19 Comments:
Aug 19 Comments:
Aug 19 Added label: stat/needs-squash
Aug 19 Added label: cann-cla/yes
153 messages are collapsed here。 See more
Aug 21 Added label: ci-pipeline-passed
Jie Yin
Aug 22 Comments:
Aug 22 Comments:
/lgtm


袁野
Aug 22 Comments:
Aug 22 Comments:
/approve


Aug 22 Added label: lgtmapproved
Aug 22 Merged pull request
fix(machine): Add aicore-resolve macro