LCOV - code coverage report
Current view: top level - aicpu_schedule/stub - host_cpu_scheduler.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 94.6 % 148 140
Test Date: 2026-08-12 11:05:02 Functions: 89.8 % 88 79

            Line data    Source code
       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              : #include <list>
      11              : #include "profiling_adp.h"
      12              : #include "aicpu_engine.h"
      13              : #include "ascend_hal.h"
      14              : #include "task_queue.h"
      15              : #include "dump_task.h"
      16              : #include "aicpusd_status.h"
      17              : #include "aicpu_async_event.h"
      18              : #include "aicpusd_mpi_mgr.h"
      19              : #include "aicpusd_task_queue.h"
      20              : #include "aicpusd_queue_event_process.h"
      21              : #include "aicpusd_context.h"
      22              : #include "tdt/status.h"
      23              : #include "tsd.h"
      24              : #include "common/type_def.h"
      25              : 
      26              : namespace aicpu {
      27              : #ifdef __cplusplus
      28              : extern "C" {
      29              : #endif
      30              : 
      31            1 : bool IsProfOpen() { return false; }
      32              : 
      33            1 : bool IsModelProfOpen() { return false; }
      34              : 
      35            1 : void UpdateMode(bool mode) { (void)mode; }
      36            1 : void UpdateModelMode(const bool mode) { (void)mode; }
      37              : 
      38            1 : uint64_t GetSystemTick() { return 0; }
      39              : 
      40            1 : uint64_t GetSystemTickFreq() { return 0; }
      41              : 
      42            1 : void SendToProfiling(const std::string& sendData, const std::string& mark)
      43              : {
      44              :     UNUSED(sendData);
      45              :     UNUSED(mark);
      46            1 : }
      47              : 
      48            1 : int32_t SetProfHandle(std::shared_ptr<ProfMessage> prof)
      49              : {
      50              :     UNUSED(prof);
      51            1 :     return 0;
      52              : }
      53              : 
      54            1 : uint64_t NowMicros() { return 1; }
      55              : 
      56            1 : void ReleaseProfiling() {}
      57              : 
      58            1 : void InitProfiling(const uint32_t deviceId, const pid_t hostPid, const uint32_t channelId)
      59              : {
      60              :     UNUSED(deviceId);
      61              :     UNUSED(hostPid);
      62              :     UNUSED(channelId);
      63            1 : }
      64              : 
      65            0 : void InitProfilingDataInfo(const uint32_t deviceId, const pid_t hostPid, const uint32_t channelId)
      66              : {
      67              :     UNUSED(deviceId);
      68              :     UNUSED(hostPid);
      69              :     UNUSED(channelId);
      70            0 : }
      71              : 
      72            0 : void SetProfilingFlagForKFC(const uint32_t flag) { UNUSED(flag); }
      73            0 : void LoadProfilingLib() {}
      74              : #ifdef __cplusplus
      75              : }
      76              : #endif
      77              : 
      78            1 : ProfMessage::ProfMessage(const char* tag) : tag_(tag) {}
      79              : 
      80            1 : ProfMessage::~ProfMessage() {}
      81              : 
      82            1 : int32_t ProfModelMessage::ReportProfModelMessage() { return 0; }
      83              : 
      84            1 : int32_t SetMsprofReporterCallback(MsprofReporterCallback reportCallback)
      85              : {
      86              :     UNUSED(reportCallback);
      87            1 :     return 0;
      88              : }
      89              : } // namespace aicpu
      90              : 
      91            1 : int32_t aeCallInterface(const void* const addr)
      92              : {
      93              :     UNUSED(addr);
      94            1 :     return AE_STATUS_SUCCESS;
      95              : }
      96              : 
      97            1 : aeStatus_t aeBatchLoadKernelSo(const uint32_t kernelType, const uint32_t loadSoNum, const char* const* const soNames)
      98              : {
      99              :     UNUSED(kernelType);
     100              :     UNUSED(loadSoNum);
     101              :     UNUSED(soNames);
     102            1 :     return AE_STATUS_SUCCESS;
     103              : }
     104              : 
     105            1 : aeStatus_t aeCloseSo(uint32_t kernelType, const char* soName)
     106              : {
     107              :     UNUSED(kernelType);
     108              :     UNUSED(soName);
     109            1 :     return AE_STATUS_SUCCESS;
     110              : }
     111              : 
     112            1 : drvError_t drvHdcGetCapacity(struct drvHdcCapacity* capacity)
     113              : {
     114              :     UNUSED(capacity);
     115            1 :     return DRV_ERROR_NONE;
     116              : }
     117              : 
     118            1 : int32_t TsdDestroy(const uint32_t deviceId, const TsdWaitType waitType, const uint32_t hostPid, const uint32_t vfId)
     119              : {
     120              :     UNUSED(deviceId);
     121              :     UNUSED(waitType);
     122              :     UNUSED(hostPid);
     123              :     UNUSED(vfId);
     124            1 :     return 0;
     125              : }
     126              : 
     127            1 : int32_t StartupResponse(
     128              :     const uint32_t deviceId, const TsdWaitType waitType, const uint32_t hostPid, const uint32_t vfId)
     129              : {
     130              :     UNUSED(deviceId);
     131              :     UNUSED(waitType);
     132              :     UNUSED(hostPid);
     133              :     UNUSED(vfId);
     134            1 :     return 0;
     135              : }
     136              : 
     137            1 : int32_t WaitForShutDown(const uint32_t deviceId)
     138              : {
     139              :     UNUSED(deviceId);
     140            1 :     return 0;
     141              : }
     142              : 
     143            1 : int32_t StopWaitForCustAicpu() { return 0; }
     144              : 
     145              : namespace AicpuSchedule {
     146            1 : StatusCode GetAicpuDeployContext(DeployContext& deployContext)
     147              : {
     148            1 :     deployContext = DeployContext::HOST;
     149            1 :     return AICPU_SCHEDULE_OK;
     150              : }
     151              : 
     152            8 : OpDumpTaskManager& OpDumpTaskManager::GetInstance()
     153              : {
     154            8 :     static OpDumpTaskManager instance;
     155            8 :     return instance;
     156              : }
     157              : 
     158            1 : void OpDumpTaskManager::ClearResource() {}
     159              : 
     160            1 : int32_t OpDumpTaskManager::DumpOpInfo(
     161              :     TaskInfoExt& dumpTaskInfo, const uint32_t streamId, const uint32_t taskId, const uint32_t contextId,
     162              :     const uint32_t threadId)
     163              : {
     164              :     UNUSED(dumpTaskInfo);
     165              :     UNUSED(streamId);
     166              :     UNUSED(taskId);
     167              :     UNUSED(contextId);
     168              :     UNUSED(threadId);
     169            1 :     return AICPU_SCHEDULE_OK;
     170              : }
     171            2 : int32_t OpDumpTaskManager::DumpOpInfo(
     172              :     const uint32_t streamId, const uint32_t taskId, const uint32_t streamId1, const uint32_t taskId1)
     173              : {
     174              :     UNUSED(streamId);
     175              :     UNUSED(taskId);
     176              :     UNUSED(streamId1);
     177              :     UNUSED(taskId1);
     178            2 :     return AICPU_SCHEDULE_OK;
     179              : }
     180              : 
     181            1 : int32_t OpDumpTaskManager::DumpOpInfo(TaskInfoExt& dumpTaskInfo, const DumpFileName& dumpFileName)
     182              : {
     183              :     UNUSED(dumpTaskInfo);
     184              :     UNUSED(dumpFileName);
     185            1 :     return AICPU_SCHEDULE_OK;
     186              : }
     187              : 
     188            1 : int32_t OpDumpTaskManager::DumpOpInfoForUnknowShape(
     189              :     const uint64_t opMappingInfoAddr, const uint64_t opMappingInfoLen) const
     190              : {
     191              :     UNUSED(opMappingInfoAddr);
     192              :     UNUSED(opMappingInfoLen);
     193            1 :     return AICPU_SCHEDULE_OK;
     194              : }
     195              : 
     196            0 : int32_t OpDumpTaskManager::LoadOpMappingInfo(
     197              :     const char_t* const infoAddr, const uint32_t len, AicpuSqeAdapter& aicpuSqeAdapter)
     198              : {
     199              :     UNUSED(infoAddr);
     200              :     UNUSED(len);
     201              :     UNUSED(aicpuSqeAdapter);
     202            0 :     return AICPU_SCHEDULE_OK;
     203              : }
     204            2 : int32_t OpDumpTaskManager::LoadOpMappingInfo(const char_t* const infoAddr, const uint32_t len)
     205              : {
     206              :     UNUSED(infoAddr);
     207              :     UNUSED(len);
     208            2 :     return AICPU_SCHEDULE_OK;
     209              : }
     210              : 
     211            4 : DumpSessionManager& DumpSessionManager::GetInstance()
     212              : {
     213            4 :     static DumpSessionManager instance;
     214            4 :     return instance;
     215              : }
     216              : 
     217            1 : IDE_SESSION DumpSessionManager::GetSession(int32_t hostPid, uint32_t deviceId)
     218              : {
     219              :     UNUSED(hostPid);
     220              :     UNUSED(deviceId);
     221            1 :     sessionsMap_.clear();
     222            1 :     return nullptr;
     223              : }
     224              : 
     225            1 : IDE_SESSION DumpSessionManager::ReacquireSession(int32_t hostPid, uint32_t deviceId)
     226              : {
     227              :     UNUSED(hostPid);
     228              :     UNUSED(deviceId);
     229            1 :     sessionsMap_.clear();
     230            1 :     return nullptr;
     231              : }
     232              : 
     233            1 : void DumpSessionManager::CloseAllSessions()
     234              : {
     235            1 :     sessionsMap_.clear();
     236            1 :     return;
     237              : }
     238              : 
     239            1 : IDE_SESSION DumpSessionManager::CreateIdeDumpSession(int32_t hostPid, uint32_t deviceId) const
     240              : {
     241              :     UNUSED(hostPid);
     242              :     UNUSED(deviceId);
     243            1 :     return nullptr;
     244              : }
     245              : 
     246            1 : int32_t AicpuQueueEventProcess::ProcessQsMsg(const event_info& event)
     247              : {
     248              :     UNUSED(event);
     249            1 :     return AICPU_SCHEDULE_OK;
     250              : }
     251              : 
     252            1 : int32_t AicpuQueueEventProcess::ProcessDrvMsg(const event_info& event)
     253              : {
     254              :     UNUSED(event);
     255            1 :     return AICPU_SCHEDULE_OK;
     256              : }
     257              : 
     258            1 : int32_t AicpuQueueEventProcess::ProcessProxyMsg(const event_info& event)
     259              : {
     260              :     UNUSED(event);
     261            1 :     return AICPU_SCHEDULE_OK;
     262              : }
     263              : 
     264            3 : AicpuQueueEventProcess& AicpuQueueEventProcess::GetInstance()
     265              : {
     266            3 :     static AicpuQueueEventProcess instance;
     267            3 :     return instance;
     268              : }
     269              : 
     270              : namespace mpi {
     271            4 : MpiDvppStatisticManager& MpiDvppStatisticManager::Instance()
     272              : {
     273            4 :     static MpiDvppStatisticManager statisticManagerInstance;
     274            4 :     return statisticManagerInstance;
     275              : }
     276              : 
     277            1 : MpiDvppStatisticManager::~MpiDvppStatisticManager() {}
     278              : 
     279            1 : int32_t MpiDvppStatisticManager::PrintStatisticInfo() const { return AicpuSchedule::AICPU_SCHEDULE_OK; }
     280              : 
     281            1 : void MpiDvppStatisticManager::Record() {}
     282              : 
     283            1 : void MpiDvppStatisticManager::InitMpiDvpp() {}
     284              : 
     285            1 : void MpiDvppStatisticManager::OnPulse(const MpiDvppTimePoint& nowTimePoint) { UNUSED(nowTimePoint); }
     286              : } // namespace mpi
     287              : 
     288            1 : bool TaskQueue::Enqueue(const aicpu::Closure& closure)
     289              : {
     290              :     UNUSED(closure);
     291            1 :     return true;
     292              : }
     293              : 
     294            1 : bool TaskQueue::Dequeue(aicpu::Closure& closure)
     295              : {
     296              :     UNUSED(closure);
     297            1 :     return true;
     298              : }
     299              : 
     300            1 : void TaskQueue::Clear() {}
     301              : 
     302            3 : std::string TaskQueue::DebugString() { return ""; }
     303              : 
     304            1 : bool TaskMap::BatchAddTask(const AICPUSharderTaskInfo& taskInfo, const std::queue<aicpu::Closure>& queue)
     305              : {
     306              :     UNUSED(taskInfo);
     307              :     UNUSED(queue);
     308            1 :     return true;
     309              : }
     310              : 
     311            1 : bool TaskMap::PopTask(const AICPUSharderTaskInfo& taskInfo, aicpu::Closure& closure)
     312              : {
     313              :     UNUSED(taskInfo);
     314              :     UNUSED(closure);
     315            1 :     return true;
     316              : }
     317              : 
     318            1 : void TaskMap::Clear() {}
     319              : 
     320            3 : std::string TaskMap::DebugString() { return ""; }
     321              : 
     322              : } // namespace AicpuSchedule
     323              : 
     324              : namespace aicpu {
     325            1 : AsyncEventManager::AsyncEventManager() {}
     326              : 
     327            1 : AsyncEventManager::~AsyncEventManager() {}
     328              : 
     329            7 : AsyncEventManager& AsyncEventManager::GetInstance()
     330              : {
     331            7 :     static AsyncEventManager asyncEventManager;
     332            7 :     return asyncEventManager;
     333              : }
     334              : 
     335            1 : void AsyncEventManager::Register(const NotifyFunc& notify)
     336              : {
     337              :     UNUSED(notify);
     338            1 :     return;
     339              : }
     340              : 
     341            1 : void AsyncEventManager::NotifyWait(void* notifyParam, const uint32_t paramLen)
     342              : {
     343              :     UNUSED(notifyParam);
     344              :     UNUSED(paramLen);
     345            1 :     return;
     346              : }
     347              : 
     348            1 : bool AsyncEventManager::RegEventCb(
     349              :     const uint32_t eventId, const uint32_t subEventId, const EventProcessCallBack& cb, const int32_t times)
     350              : {
     351              :     UNUSED(eventId);
     352              :     UNUSED(subEventId);
     353              :     UNUSED(cb);
     354              :     UNUSED(times);
     355            1 :     return true;
     356              : }
     357              : 
     358            1 : void AsyncEventManager::ProcessEvent(const uint32_t eventId, const uint32_t subEventId, void* param)
     359              : {
     360              :     UNUSED(eventId);
     361              :     UNUSED(subEventId);
     362              :     UNUSED(param);
     363            1 :     return;
     364              : }
     365              : 
     366            1 : bool AsyncEventManager::RegOpEventCb(
     367              :     const uint32_t eventId, const uint32_t subEventId, const EventProcessCallBack& cb) const
     368              : {
     369              :     UNUSED(eventId);
     370              :     UNUSED(subEventId);
     371              :     UNUSED(cb);
     372            1 :     return true;
     373              : }
     374              : 
     375            1 : void AsyncEventManager::UnregOpEventCb(const uint32_t eventId, const uint32_t subEventId) const
     376              : {
     377              :     UNUSED(eventId);
     378              :     UNUSED(subEventId);
     379            1 : }
     380              : 
     381            1 : void AsyncEventManager::ProcessOpEvent(const uint32_t eventId, const uint32_t subEventId, void* const param) const
     382              : {
     383              :     UNUSED(eventId);
     384              :     UNUSED(subEventId);
     385              :     UNUSED(param);
     386            1 : }
     387              : } // namespace aicpu
     388              : 
     389              : namespace DataPreprocess {
     390            1 : TaskQueueMgr& TaskQueueMgr::GetInstance()
     391              : {
     392            1 :     static TaskQueueMgr instance;
     393            1 :     return instance;
     394              : }
     395              : 
     396            3 : TaskQueueMgr::TaskQueueMgr() {}
     397            3 : TaskQueueMgr::~TaskQueueMgr() {}
     398            1 : void TaskQueueMgr::OnPreprocessEvent(uint32_t eventId) { UNUSED(eventId); }
     399              : } // namespace DataPreprocess
     400              : 
     401              : namespace tdt {
     402            1 : int32_t TDTServerInit(const uint32_t deviceID, const std::list<uint32_t>& bindCoreList)
     403              : {
     404              :     UNUSED(deviceID);
     405              :     UNUSED(bindCoreList);
     406            1 :     return 0;
     407              : }
     408              : 
     409            1 : int32_t TDTServerStop() { return 0; }
     410              : 
     411          759 : StatusFactory* StatusFactory::GetInstance()
     412              : {
     413          759 :     static StatusFactory instance;
     414          759 :     return &instance;
     415              : }
     416              : 
     417          757 : void StatusFactory::RegisterErrorNo(const uint32_t err, const std::string& desc)
     418              : {
     419              :     UNUSED(err);
     420              :     UNUSED(desc);
     421          757 : }
     422              : 
     423            1 : std::string StatusFactory::GetErrDesc(const uint32_t err)
     424              : {
     425              :     UNUSED(err);
     426            2 :     return "";
     427              : }
     428              : 
     429            1 : std::string StatusFactory::GetErrCodeDesc(uint32_t errCode)
     430              : {
     431              :     UNUSED(errCode);
     432            2 :     return "";
     433              : }
     434              : 
     435            1 : StatusFactory::StatusFactory() {}
     436              : } // namespace tdt
     437              : 
     438            1 : int halTsDevRecord(unsigned int devId, unsigned int tsId, unsigned int record_type, unsigned int record_Id)
     439              : {
     440              :     (void)devId;
     441              :     (void)tsId;
     442              :     (void)record_type;
     443              :     (void)record_Id;
     444            1 :     return 0;
     445              : }
     446              : 
     447              : #ifdef __cplusplus
     448              : extern "C" {
     449              : #endif
     450              : 
     451            1 : int32_t CreateOrFindCustPid(
     452              :     const uint32_t deviceId, const uint32_t loadLibNum, const char* const loadLibName[], const uint32_t hostPid,
     453              :     const uint32_t vfId, const char* groupNameList, const uint32_t groupNameNum, int32_t* custProcPid, bool* firstStart)
     454              : {
     455              :     UNUSED(deviceId);
     456              :     UNUSED(loadLibNum);
     457              :     UNUSED(loadLibName);
     458              :     UNUSED(vfId);
     459              :     UNUSED(groupNameList);
     460              :     UNUSED(hostPid);
     461              :     UNUSED(groupNameNum);
     462              :     UNUSED(firstStart);
     463              :     UNUSED(custProcPid);
     464            1 :     return 0;
     465              : }
     466              : 
     467            1 : int tsDevSendMsgAsync(unsigned int devId, unsigned int tsId, char* msg, unsigned int msgLen, unsigned int handleId)
     468              : {
     469              :     UNUSED(devId);
     470              :     UNUSED(tsId);
     471              :     UNUSED(msg);
     472              :     UNUSED(handleId);
     473              :     UNUSED(msgLen);
     474            1 :     return 0;
     475              : }
     476              : 
     477            0 : int32_t SendUpdateProfilingRspToTsd(
     478              :     const uint32_t deviceId, const uint32_t waitType, const uint32_t hostPid, const uint32_t vfId)
     479              : {
     480              :     UNUSED(deviceId);
     481              :     UNUSED(waitType);
     482              :     UNUSED(hostPid);
     483              :     UNUSED(vfId);
     484            0 :     return 0;
     485              : }
     486            1 : int32_t SetSubProcScheduleMode(
     487              :     const uint32_t deviceId, const uint32_t waitType, const uint32_t hostPid, const uint32_t vfId,
     488              :     const struct SubProcScheduleModeInfo* scheInfo)
     489              : {
     490              :     UNUSED(deviceId);
     491              :     UNUSED(waitType);
     492              :     UNUSED(hostPid);
     493              :     UNUSED(vfId);
     494              :     UNUSED(scheInfo);
     495            1 :     return 0;
     496              : }
     497              : #ifdef __cplusplus
     498              : }
     499              : #endif
        

Generated by: LCOV version 2.0-1