pytorch/torch/headeronly/version.h.in
Mikayla Gawarecki fefb546b91 Add TORCH_TARGET_VERSION for stable ABI (#164356)
And update it so comparisons can be done by the preprocessor

**Note: We also need to gate in shim.h and figure out how to enforce this**

Differential Revision: [D85683549](https://our.internmc.facebook.com/intern/diff/D85683549)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164356
Approved by: https://github.com/janeyx99
2025-10-29 15:41:28 +00:00

27 lines
936 B
C

#pragma once
/// Indicates the major version of LibTorch.
#define TORCH_VERSION_MAJOR @TORCH_VERSION_MAJOR@
/// Indicates the minor version of LibTorch.
#define TORCH_VERSION_MINOR @TORCH_VERSION_MINOR@
/// Indicates the patch version of LibTorch.
#define TORCH_VERSION_PATCH @TORCH_VERSION_PATCH@
/// Indicates the ABI version tag of LibTorch.
#define TORCH_VERSION_ABI_TAG 0
/// Indicates the version of LibTorch as a string literal.
#define TORCH_VERSION \
"@TORCH_VERSION_MAJOR@.@TORCH_VERSION_MINOR@.@TORCH_VERSION_PATCH@"
/// Indicates the ABI version of LibTorch as a single uint64.
/// [ byte ][ byte ][ byte ][ byte ][ byte ][ byte ][ byte ][ byte ]
/// [ MAJ ][ MIN ][ PATCH][ ABI TAG ]
#define TORCH_ABI_VERSION ( \
((0ULL + TORCH_VERSION_MAJOR) << 56) | \
((0ULL + TORCH_VERSION_MINOR) << 48) | \
((0ULL + TORCH_VERSION_PATCH) << 40) | \
((0ULL + TORCH_VERSION_ABI_TAG) << 0))