Skip to content

Commit 9ec3de5

Browse files
committed
remove extra libtorch dependency
this diff removes extra libtorch dependency on cuda delegate, and introd missing bf16 and int64 shim layers Differential Revision: [D84207378](https://our.internmc.facebook.com/intern/diff/D84207378/) [ghstack-poisoned]
1 parent ab1c5c1 commit 9ec3de5

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

backends/aoti/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ target_compile_options(aoti_common PUBLIC -fexceptions -frtti -fPIC)
4040
# Ensure symbols are exported properly
4141
target_link_options(aoti_common PUBLIC -Wl,--export-dynamic)
4242

43-
# Link against PyTorch libraries and standard libraries
43+
# Link against ExecuTorch libraries and standard libraries
4444
target_link_libraries(aoti_common PUBLIC extension_tensor ${CMAKE_DL_LIBS})
4545
executorch_target_link_options_shared_lib(aoti_common)
4646

backends/aoti/common_shims.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,18 @@ int32_t aoti_torch_layout_strided() {
127127
}
128128

129129
// Dtype constants - these return the PyTorch dtype codes
130-
// Currently only float32 is supported, but using robust enum-based approach
131130
int32_t aoti_torch_dtype_float32() {
132131
return 6; // PyTorch's float32 dtype code
133132
}
134133

134+
int32_t aoti_torch_dtype_bfloat16() {
135+
return 15; // PyTorch's bfloat16 dtype code
136+
}
137+
138+
int32_t aoti_torch_dtype_int64() {
139+
return 4; // PyTorch's int64 dtype code
140+
}
141+
135142
// Cleanup functions
136143
void cleanup_tensor_metadata() {
137144
internal::tensor_to_sizes.clear();

backends/aoti/common_shims.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ AOTITorchError aoti_torch_get_dim(Tensor* tensor, int64_t* ret_dim);
5858
int32_t aoti_torch_device_type_cpu();
5959
int32_t aoti_torch_layout_strided();
6060
int32_t aoti_torch_dtype_float32();
61+
int32_t aoti_torch_dtype_bfloat16();
62+
int32_t aoti_torch_dtype_int64();
6163

6264
// Autograd mode functions
6365
int32_t aoti_torch_grad_mode_is_enabled();

backends/cuda/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ target_link_options(aoti_cuda PUBLIC -Wl,--export-dynamic)
5555

5656
# Link against CUDA::cudart, common AOTI library, and PyTorch CUDA libraries
5757
target_link_libraries(
58-
aoti_cuda
59-
PUBLIC aoti_common CUDA::cudart ${CMAKE_DL_LIBS}
60-
# Link PyTorch libraries for AOTI CUDA functions
61-
${TORCH_LIBRARIES}
58+
aoti_cuda PUBLIC aoti_common CUDA::cudart ${CMAKE_DL_LIBS}
6259
)
6360
# If you need other CUDA libraries, link them similarly:
6461
# target_link_libraries(aoti_cuda PUBLIC CUDA::cublas CUDA::cufft ...)

0 commit comments

Comments
 (0)