1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FFRT_SDEPENDENCE_MANAGER_H 17 #define FFRT_SDEPENDENCE_MANAGER_H 18 19 #include "dm/dependence_manager.h" 20 21 namespace ffrt { 22 class SDependenceManager : public DependenceManager { 23 public: Instance()24 static SDependenceManager& Instance() 25 { 26 static SDependenceManager ins; 27 return ins; 28 } 29 30 void onSubmit(bool has_handle, ffrt_task_handle_t &handle, ffrt_function_header_t *f, const ffrt_deps_t *ins, 31 const ffrt_deps_t *outs, const task_attr_private *attr) override; 32 33 void onWait() override; 34 35 void onWait(const ffrt_deps_t* deps) override; 36 37 int onExecResults(ffrt_task_handle_t handle) override; 38 39 void onTaskDone(CPUEUTask* task) override; 40 41 private: 42 SDependenceManager(); 43 ~SDependenceManager() override; 44 45 void RemoveRepeatedDeps(std::vector<CPUEUTask*>& in_handles, const ffrt_deps_t* ins, const ffrt_deps_t* outs, 46 std::vector<const void *>& insNoDup, std::vector<const void *>& outsNoDup); 47 void MapSignature2Deps(SCPUEUTask* task, const std::vector<const void*>& inDeps, 48 const std::vector<const void*>& outDeps, std::vector<std::pair<VersionCtx*, NestType>>& inVersions, 49 std::vector<std::pair<VersionCtx*, NestType>>& outVersions); 50 51 fast_mutex& criticalMutex_; 52 }; 53 } // namespace ffrt 54 #endif