CIRCT  19.0.0git
Utilities.h
Go to the documentation of this file.
1 //===- Utilities.h - Library of scheduling utilities ------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines a library of scheduling utilities.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef CIRCT_SCHEDULING_UTILITIES_H
14 #define CIRCT_SCHEDULING_UTILITIES_H
15 
17 
18 #include "llvm/Support/raw_ostream.h"
19 
20 #include <functional>
21 
22 namespace circt {
23 namespace scheduling {
24 
25 using HandleOpFn = std::function<LogicalResult(Operation *)>;
26 /// Visit \p prob's operations in topological order, using an internal worklist.
27 ///
28 /// \p fun is expected to report success if the given operation was handled
29 /// successfully, and failure if an unhandled predecessor was detected.
30 ///
31 /// Fails if the dependence graph contains cycles.
32 LogicalResult handleOperationsInTopologicalOrder(Problem &prob, HandleOpFn fun);
33 
34 /// Analyse combinational chains in \p prob's dependence graph and determine
35 /// pairs of operations that must be separated by at least one time step in
36 /// order to prevent the accumulated delays exceeding the given \p cycleTime.
37 /// The dependences in the \p result vector require special handling in the
38 /// concrete scheduling algorithm.
39 ///
40 /// Fails if \p prob contains operator types with incoming/outgoing delays
41 /// greater than \p cycleTime, or if the dependence graph contains cycles.
42 LogicalResult
44  SmallVectorImpl<Problem::Dependence> &result);
45 
46 /// Assuming \p prob is scheduled and contains (integer) start times, this
47 /// method fills in the start times in cycle in an ASAP fashion.
48 ///
49 /// Fails if the dependence graph contains cycles.
50 LogicalResult computeStartTimesInCycle(ChainingProblem &prob);
51 
52 /// Export \p prob as a DOT graph into \p fileName.
53 void dumpAsDOT(Problem &prob, StringRef fileName);
54 
55 /// Print \p prob as a DOT graph onto \p stream.
56 void dumpAsDOT(Problem &prob, raw_ostream &stream);
57 
58 } // namespace scheduling
59 } // namespace circt
60 
61 #endif // CIRCT_SCHEDULING_UTILITIES_H
This class models the accumulation of physical propagation delays on combinational paths along SSA de...
Definition: Problems.h:340
This class models the most basic scheduling problem.
Definition: Problems.h:87
LogicalResult handleOperationsInTopologicalOrder(Problem &prob, HandleOpFn fun)
Visit prob's operations in topological order, using an internal worklist.
Definition: Utilities.cpp:21
void dumpAsDOT(Problem &prob, StringRef fileName)
Export prob as a DOT graph into fileName.
Definition: Utilities.cpp:55
std::function< LogicalResult(Operation *)> HandleOpFn
Definition: Utilities.h:25
LogicalResult computeChainBreakingDependences(ChainingProblem &prob, float cycleTime, SmallVectorImpl< Problem::Dependence > &result)
Analyse combinational chains in prob's dependence graph and determine pairs of operations that must b...
LogicalResult computeStartTimesInCycle(ChainingProblem &prob)
Assuming prob is scheduled and contains (integer) start times, this method fills in the start times i...
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21