-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathExecUnitTypes.fs
More file actions
117 lines (96 loc) · 3.53 KB
/
Copy pathExecUnitTypes.fs
File metadata and controls
117 lines (96 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
namespace SymTensor.Compiler
open System
open System.Diagnostics
open System.Collections.Generic
open Tensor.Utils
open SymTensor
open UExprTypes
[<AutoOpen>]
module ExecUnitsTypes =
/// a channel id
type ChannelIdT = string
/// manikins representing the data in each channel
type ChannelManikinsT = Map<ChannelIdT, ArrayNDManikinT>
/// manikins representing the data in each channel and flag if it is shared
type ChannelManikinsAndSharedT = Map<ChannelIdT, ArrayNDManikinT * bool>
/// requests for manikins representing the data in each channel
type ChannelReqsT = Map<ChannelIdT, ArrayNDManikinT option>
/// a command to be executed
type IExecItem =
abstract VisualizationText: string
/// Id of an ExecUnitT
type ExecUnitIdT = int
/// a sequence of ExecItems to evaluate an op
type ExecUnitT = {
Id: ExecUnitIdT
DependsOn: ExecUnitIdT list
Items: IExecItem list
Expr: UExprT
Manikins: ArrayNDManikinT list
Channels: ChannelManikinsAndSharedT
Srcs: ArrayNDManikinT list
ExtraMem: MemManikinT list
RerunAfter: ExecUnitIdT list
}
/// result of an evaluation request
type EvalResultT = {
ExecUnitId: ExecUnitIdT
Channels: ChannelManikinsAndSharedT
}
/// an evaluation request
type EvalReqT = {
Id: int
Expr: UExprT
ChannelReqs: ChannelReqsT
OnCompletion: EvalResultT -> unit
}
type MemAllocatorT = TypeNameT -> int64 -> MemAllocKindT -> MemManikinT
type ExecItemsForOpArgs = {
MemAllocator: MemAllocatorT
Target: ChannelManikinsT
Op: UOpT
UExpr: UExprT
Metadata: UMetadata
Srcs: ChannelManikinsAndSharedT list
SubmitInitItems: IExecItem list -> unit
}
type TraceItemsForExprArgs = {
MemAllocator: MemAllocatorT
Target: ChannelManikinsT
Expr: UExprT
}
type TrgtGivenSrcsArgs = {
MemAllocator: MemAllocatorT
TargetRequest: ChannelReqsT
Op: UOpT
Metadata: UMetadata
Srcs: ChannelManikinsAndSharedT list
}
type SrcReqsArgs = {
TargetRequest: ChannelReqsT
Op: UOpT
Metadata: UMetadata
SrcShapes: Map<ChannelT, NShapeSpecT> list
}
/// record containing functions called by the ExecUnitT generator
type ExecUnitsGeneratorT = {
ExecItemsForOp: ExecItemsForOpArgs -> IExecItem list
TracePreItemsForExpr: TraceItemsForExprArgs -> IExecItem list
TracePostItemsForExpr: TraceItemsForExprArgs -> IExecItem list
TrgtGivenSrcs: TrgtGivenSrcsArgs -> ChannelManikinsAndSharedT
SrcReqs: SrcReqsArgs -> ChannelReqsT list
}
/// generated ExecUnits for an expression
type ExecUnitsForExprT = {
Expr: UExprT
ExecUnits: ExecUnitT list
Result: EvalResultT
MemAllocs: MemAllocManikinT list
InitItems: IExecItem list
}
/// Diagnostic information from a compilation.
type CompileDiagnosticsT = {
UExpr: UExprT
ExecUnits: ExecUnitT list
SubDiagnostics: Map<UExprT, CompileDiagnosticsT>
}