Skip to content

Commit eca1561

Browse files
lucylqmergennachin
authored andcommitted
Add concepts (#884)
Summary: Pull Request resolved: #884 Add some more concepts Reviewed By: mergennachin Differential Revision: D50250661 fbshipit-source-id: b94643c8878934e1d2435d77033fe9df34db1597
1 parent 5776c73 commit eca1561

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

docs/source/compiler-custom-compiler-passes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This is an
3131
way where we execute each node and recreate the graph except with
3232
transformations specified. This allows us to preserve the IR Spec by ensuring
3333
that all nodes created while in the pass meet the IR Spec including ensuring that
34-
metadata such as stack trace, FakeTensor values, and torch.nn.Module heirarchy
34+
metadata such as stack trace, FakeTensor values, and torch.nn.Module hierarchy
3535
are preserved and updated depending on the transformations made.
3636

3737
To implement this pass, we can create a subclass of

docs/source/concepts.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ A specific hardware (like GPU, NPU) or a software stack (like XNNPACK) that cons
3636

3737
Backend dialect is the result of exporting Edge dialect to specific backend. It’s target-aware, and may contain operators or submodules that are only meaningful to the target backend. This dialect allows the introduction of target-specific operators that do not conform to the schema defined in the Core ATen Operator Set and are not shown in ATen or Edge Dialect.
3838

39-
## [Backend Specific Operator]
39+
## Backend registry
40+
41+
A table mapping backend names to backend interfaces. This allows backends to be called via name during runtime.
42+
43+
## Backend Specific Operator
4044

4145
These are operators that are not part of ATen dialect or Edge dialect. Backend specific operators are only introduced by passes that happen after Edge dialect (see Backend dialect). These operators are specific to the target backend and will generally execute faster.
4246

@@ -48,6 +52,10 @@ An open-source, large scale build system. Used to build ExecuTorch.
4852

4953
An open-source, cross-platform family of tools designed to build, test and package software. Used to build ExecuTorch.
5054

55+
## Codegen
56+
57+
In ExecuTorch, code generation is used to generate the [kernel registration library](./kernel-library-selective_build.md).
58+
5159
## Core ATen Dialect
5260

5361
Core ATen dialect contains the core ATen operators along with higher order operators (control flow) and registered custom operators.
@@ -122,12 +130,16 @@ An ExecuTorch `Program` maps string names like `forward` to specific ExecuTorch
122130

123131
## executor_runner
124132

125-
The ExecuTorch runtime that executes the exported PyTorch model on-device.
133+
A sample wrapper around the ExecuTorch runtime which includes all the operators and backends.
126134

127135
## [EXIR](./ir-exir.md)
128136

129137
The **EX**port **I**ntermediate **R**epresentation (IR) from `torch.export`. Contains the computational graph of the model. All EXIR graphs are valid [FX graphs](https://pytorch.org/docs/stable/fx.html#torch.fx.Graph).
130138

139+
## `ExportedProgram`
140+
141+
The output of `torch.export` that bundles the computational graph of a PyTorch model (usually an `nn.Module`) with the parameters or weights that the model consumes.
142+
131143
## [flatbuffer](https://github.com/google/flatbuffers)
132144

133145
Memory efficient, cross platform serialization library. In the context of ExecuTorch, eager mode Pytorch models are exported to flatbuffer, which is the format consumed by the ExecuTorch runtime.
@@ -136,6 +148,10 @@ Memory efficient, cross platform serialization library. In the context of ExecuT
136148

137149
The cost of various loading and initialization tasks (not inference). For example; loading a program, initializing executor, kernel and backend-delegate dispatch, and runtime memory utilization.
138150

151+
## Functional ATen operators
152+
153+
ATen operators that do not have any side effects.
154+
139155
## [Graph](./ir-exir.md)
140156

141157
An EXIR Graph is a PyTorch program represented in the form of a DAG (directed acyclic graph). Each node in the graph represents a particular computation or operation, and edges of this graph consist of references between nodes. Note: all EXIR graphs are valid [FX graphs](https://pytorch.org/docs/stable/fx.html#torch.fx.Graph).
@@ -156,6 +172,11 @@ A representation of a program between the source and target languages. Generally
156172

157173
An implementation of an operator. There can be multiple implementations of an operator for different backends/inputs/etc.
158174

175+
176+
## Kernel registry / Operator registry
177+
178+
A table with mappings between kernel names and their implementations. This allows the ExecuTorch runtime to resolve references to kernels during execution.
179+
159180
## Lowering
160181

161182
The process of transforming a model to run on various backends. It is called 'lowering' as it is moving code closer to the hardware. In ExecuTorch, lowering is performed as part of backend delegation.
@@ -176,9 +197,11 @@ Function on tensors. This is the abstraction; kernels are the implementation. Th
176197

177198
Operator fusion is the process of combining multiple operators into a single compound operator, resulting in faster computation due to fewer kernel launches and fewer memory read/writes. This is a performance advantage of graph mode vs eager mode.
178199

179-
## Operator registration
200+
## Out variant
201+
202+
Instead of allocating returned tensors in kernel implementations, an operator's out variant will take in a pre-allocated tensor to its out kwarg, and store the result there.
180203

181-
Operators need to be registered with the ExecuTorch runtime. This allows the compiler to resolve references to the operator in code.
204+
This makes it easier for memory planners to perform tensor lifetime analysis. In ExecuTorch, an out variant pass is performed before memory planning.
182205

183206
## [PAL (Platform Abstraction Layer)](./runtime-platform-abstraction-layer.md)
184207

0 commit comments

Comments
 (0)