• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "dependence_manager.h"
19 
20 namespace ffrt {
21 class SDependenceManager : public DependenceManager {
22 public:
Instance()23     static SDependenceManager& Instance()
24     {
25         static SDependenceManager ins;
26         return ins;
27     }
28 
29     void onSubmit(bool has_handle, ffrt_task_handle_t &handle, ffrt_function_header_t *f,
30         const ffrt_deps_t *ins, const ffrt_deps_t *outs, const task_attr_private *attr) override;
31 
32     void onSubmitUV(ffrt_executor_task_t* task, const task_attr_private* attr) override;
33 
34     void onWait() override;
35 
36 #ifdef QOS_DEPENDENCY
37     void onWait(const ffrt_deps_t* deps, int64_t deadline = -1) override;
38 #else
39     void onWait(const ffrt_deps_t* deps) override;
40 #endif
41 
42     void onTaskDone(CPUEUTask* task) override;
43 
44 private:
45     SDependenceManager();
46     ~SDependenceManager();
47 
48     void MapSignature2Deps(SCPUEUTask* task, const std::vector<const void*>& inDeps,
49         const std::vector<const void*>& outDeps, std::vector<std::pair<VersionCtx*, NestType>>& inVersions,
50         std::vector<std::pair<VersionCtx*, NestType>>& outVersions);
51 
52     fast_mutex& criticalMutex_;
53 };
54 } // namespace ffrt
55 #endif
56