xref: /aosp_15_r20/external/pytorch/docs/source/torch.compiler_ir.rst (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1.. _torch.compiler_ir:
2
3IRs
4===============
5
6PyTorch 2.0 offers two set of IRs for backends to interface with: Core Aten IR and Prims IR.
7
8Core Aten IR
9--------------------
10
11Core aten ops is the core subset of aten operators that can be used to compose other operators.
12Core aten IR is fully functional, and there is no `inplace` or `_out` variants in this opset.
13In contrast to Prims IR, core aten ops reuses the existing aten ops in "native_functions.yaml",
14and it doesn't further decompose ops into explicit type promotion and broadcasting ops.
15This opset is designed to serve as the functional IR to interface with backends.
16
17.. warning::
18  This opset is still under active development, more ops will be added in the future.
19
20.. csv-table::
21   :file: ../build/ir/aten_ops.csv
22   :widths: auto
23   :header-rows: 1
24
25Prims IR
26-----------
27
28Prims IR is a set of primitive operators that can be used to compose other operators.
29Prims IR is a lower level opset than core aten IR, and it further decomposes ops into explicit
30type promotion and broadcasting ops: prims.convert_element_type and prims.broadcast_in_dim.
31This opset is designed to interface with compiler backends.
32
33.. warning::
34  This opset is still under active development, more ops will be added in the future.
35
36.. csv-table::
37   :file: ../build/ir/prims_ops.csv
38   :widths: auto
39   :header-rows: 1
40