1*523fa7a6SAndroid Build Coastguard Worker# Runtime Compatibility Policy 2*523fa7a6SAndroid Build Coastguard Worker 3*523fa7a6SAndroid Build Coastguard WorkerThis document describes the compatibility guarantees between the [PTE file 4*523fa7a6SAndroid Build Coastguard Workerformat](https://pytorch.org/executorch/stable/pte-file-format.html) and the 5*523fa7a6SAndroid Build Coastguard WorkerExecuTorch runtime. 6*523fa7a6SAndroid Build Coastguard Worker 7*523fa7a6SAndroid Build Coastguard Worker> [!IMPORTANT] 8*523fa7a6SAndroid Build Coastguard Worker> The [canonical version of this document](https://github.com/pytorch/executorch/tree/main/runtime/COMPATIBILITY.md) 9*523fa7a6SAndroid Build Coastguard Worker> is in the `main` branch of the `pytorch/executorch` GitHub repo. 10*523fa7a6SAndroid Build Coastguard Worker 11*523fa7a6SAndroid Build Coastguard Worker## Backward compatibility (BC) 12*523fa7a6SAndroid Build Coastguard Worker 13*523fa7a6SAndroid Build Coastguard WorkerDefinition: Whether an older version of a PTE file can run on a newer version of 14*523fa7a6SAndroid Build Coastguard Workerthe runtime. 15*523fa7a6SAndroid Build Coastguard Worker 16*523fa7a6SAndroid Build Coastguard WorkerA PTE file created at a particular ExecuTorch version using stable 17*523fa7a6SAndroid Build Coastguard Worker(non-deprecated and non-experimental) APIs can be loaded and executed by a 18*523fa7a6SAndroid Build Coastguard Workerruntime built from a minimum of one following non-patch (major or minor) 19*523fa7a6SAndroid Build Coastguard Workerrelease. For example: 20*523fa7a6SAndroid Build Coastguard Worker 21*523fa7a6SAndroid Build Coastguard Worker* A PTE file created with version `1.2.0` will be compatible with version 22*523fa7a6SAndroid Build Coastguard Worker `1.3.0`, and possibly more. 23*523fa7a6SAndroid Build Coastguard Worker* If `1.2.0` is followed by a major release, then a PTE file created with 24*523fa7a6SAndroid Build Coastguard Worker version `1.2.0` will be compatible with version `2.0.0`, and possibly more. 25*523fa7a6SAndroid Build Coastguard Worker 26*523fa7a6SAndroid Build Coastguard WorkerExecuTorch minor releases happen every three months, following the PyTorch 27*523fa7a6SAndroid Build Coastguard Workerrelease cadence. This means that a PTE file will be supported for at least six 28*523fa7a6SAndroid Build Coastguard Workermonths: the release in which it was built (three months) and the following 29*523fa7a6SAndroid Build Coastguard Workerrelease (another three months). 30*523fa7a6SAndroid Build Coastguard Worker 31*523fa7a6SAndroid Build Coastguard WorkerThese are minimum guarantees. We will strive to maintain compatibility for as 32*523fa7a6SAndroid Build Coastguard Workerlong as possible, but it may depend on the features used by a particular PTE 33*523fa7a6SAndroid Build Coastguard Workerfile: see "Feature-specific limitations" below. 34*523fa7a6SAndroid Build Coastguard Worker 35*523fa7a6SAndroid Build Coastguard Worker### Feature-specific limitations 36*523fa7a6SAndroid Build Coastguard Worker 37*523fa7a6SAndroid Build Coastguard WorkerA PTE file may symbolically refer to functionality outside the file itself: 38*523fa7a6SAndroid Build Coastguard Workeroperators or backends. These are linked directly into the runtime, and have 39*523fa7a6SAndroid Build Coastguard Workertheir own compatibility guarantees, but must satisfy the minimum BC guarantees 40*523fa7a6SAndroid Build Coastguard Workerabove. 41*523fa7a6SAndroid Build Coastguard Worker 42*523fa7a6SAndroid Build Coastguard Worker**Operators**: Core ATen operators must comply with the [Core ATen opset 43*523fa7a6SAndroid Build Coastguard Workerbackward & forward compatibility 44*523fa7a6SAndroid Build Coastguard Workerpolicy](https://dev-discuss.pytorch.org/t/core-aten-opset-backward-forward-compatibility-policy/1772). 45*523fa7a6SAndroid Build Coastguard WorkerCustom operators (that are not part of Core ATen) have no explicit guarantees, 46*523fa7a6SAndroid Build Coastguard Workerbut the owners of those custom operators should try to provide similar 47*523fa7a6SAndroid Build Coastguard Workerguarantees, and clearly document them. 48*523fa7a6SAndroid Build Coastguard Worker 49*523fa7a6SAndroid Build Coastguard Worker**Backends**: A delegated payload in a PTE file must remain loadable and 50*523fa7a6SAndroid Build Coastguard Workerexecutable by its associated backend for at least the version range described 51*523fa7a6SAndroid Build Coastguard Workerabove. Each backend may provide longer guarantees, which may be described in a 52*523fa7a6SAndroid Build Coastguard Workerfile named `//executorch/backends/{name}/COMPATIBILITY.md`, or in a similar 53*523fa7a6SAndroid Build Coastguard Workerlocation for backends whose code lives outside the `executorch` repo. 54*523fa7a6SAndroid Build Coastguard Worker 55*523fa7a6SAndroid Build Coastguard Worker## Forward compatibility (FC) 56*523fa7a6SAndroid Build Coastguard Worker 57*523fa7a6SAndroid Build Coastguard WorkerDefinition: Whether a newer version of a PTE file can run on an older version of 58*523fa7a6SAndroid Build Coastguard Workerthe runtime. 59*523fa7a6SAndroid Build Coastguard Worker 60*523fa7a6SAndroid Build Coastguard WorkerExecuTorch does not make guarantees about forward compatibility. It is possible 61*523fa7a6SAndroid Build Coastguard Workerfor a newer PTE file to be loaded and executed by an older version of the 62*523fa7a6SAndroid Build Coastguard Workerruntime, but it is not guaranteed. The parameters used to generate the PTE file 63*523fa7a6SAndroid Build Coastguard Workermay affect this compatibility. 64