/* * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef FFRT_SDEPENDENCE_MANAGER_H #define FFRT_SDEPENDENCE_MANAGER_H #include "dependence_manager.h" namespace ffrt { class SDependenceManager : public DependenceManager { public: static SDependenceManager& Instance() { static SDependenceManager ins; return ins; } void onSubmit(bool has_handle, ffrt_task_handle_t &handle, ffrt_function_header_t *f, const ffrt_deps_t *ins, const ffrt_deps_t *outs, const task_attr_private *attr) override; void onWait() override; #ifdef QOS_DEPENDENCY void onWait(const ffrt_deps_t* deps, int64_t deadline = -1) override; #else void onWait(const ffrt_deps_t* deps) override; #endif int onExecResults(const ffrt_deps_t *deps) override; void onTaskDone(CPUEUTask* task) override; private: SDependenceManager(); ~SDependenceManager() override; void RemoveRepeatedDeps(std::vector& in_handles, const ffrt_deps_t* ins, const ffrt_deps_t* outs, std::vector& insNoDup, std::vector& outsNoDup); void MapSignature2Deps(SCPUEUTask* task, const std::vector& inDeps, const std::vector& outDeps, std::vector>& inVersions, std::vector>& outVersions); fast_mutex& criticalMutex_; }; } // namespace ffrt #endif