mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Introduce TORCH_ABI_VERSION and a runtime aoti_torch_abi_version C shim ABI (#148892)
Importable https://github.com/pytorch/pytorch/pull/148836 Pull Request resolved: https://github.com/pytorch/pytorch/pull/148892 Approved by: https://github.com/albanD
This commit is contained in:
parent
98b3f1db9f
commit
fcb633fafa
|
|
@ -9,6 +9,18 @@
|
||||||
/// Indicates the patch version of LibTorch.
|
/// Indicates the patch version of LibTorch.
|
||||||
#define TORCH_VERSION_PATCH @TORCH_VERSION_PATCH@
|
#define TORCH_VERSION_PATCH @TORCH_VERSION_PATCH@
|
||||||
|
|
||||||
/// Indicates the version of LibTorch.
|
/// 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 \
|
#define TORCH_VERSION \
|
||||||
"@TORCH_VERSION_MAJOR@.@TORCH_VERSION_MINOR@.@TORCH_VERSION_PATCH@"
|
"@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 \
|
||||||
|
(uint64_t)TORCH_VERSION_MAJOR << 56 | \
|
||||||
|
(uint64_t)TORCH_VERSION_MINOR << 48 | \
|
||||||
|
(uint64_t)TORCH_VERSION_PATCH << 40 | \
|
||||||
|
TORCH_VERSION_ABI_TAG << 0
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,9 @@ AOTI_TORCH_EXPORT int32_t aoti_torch_memory_format_channels_last();
|
||||||
AOTI_TORCH_EXPORT int32_t aoti_torch_memory_format_channels_last_3d();
|
AOTI_TORCH_EXPORT int32_t aoti_torch_memory_format_channels_last_3d();
|
||||||
AOTI_TORCH_EXPORT int32_t aoti_torch_memory_format_preserve_format();
|
AOTI_TORCH_EXPORT int32_t aoti_torch_memory_format_preserve_format();
|
||||||
|
|
||||||
|
// Get TORCH_ABI_VERSION of the built libtorch.so
|
||||||
|
AOTI_TORCH_EXPORT uint64_t aoti_torch_abi_version();
|
||||||
|
|
||||||
// Functions for converting a single-element tensor to a scalar value
|
// Functions for converting a single-element tensor to a scalar value
|
||||||
AOTI_TORCH_EXPORT AOTITorchError
|
AOTI_TORCH_EXPORT AOTITorchError
|
||||||
aoti_torch_item_float16(AtenTensorHandle tensor, c10::Half* ret_value);
|
aoti_torch_item_float16(AtenTensorHandle tensor, c10::Half* ret_value);
|
||||||
|
|
|
||||||
|
|
@ -231,6 +231,13 @@ AOTI_TORCH_SCALAR_TO_TENSOR_IMPL(
|
||||||
ComplexDouble)
|
ComplexDouble)
|
||||||
#undef AOTI_TORCH_SCALAR_TO_TENSOR_IMPL
|
#undef AOTI_TORCH_SCALAR_TO_TENSOR_IMPL
|
||||||
|
|
||||||
|
#ifndef C10_MOBILE
|
||||||
|
#include <torch/version.h>
|
||||||
|
uint64_t aoti_torch_abi_version() {
|
||||||
|
return TORCH_ABI_VERSION;
|
||||||
|
}
|
||||||
|
#endif // C10_MOBILE
|
||||||
|
|
||||||
bool aoti_torch_grad_mode_is_enabled() {
|
bool aoti_torch_grad_mode_is_enabled() {
|
||||||
return c10::GradMode::is_enabled();
|
return c10::GradMode::is_enabled();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user