Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 9 additions & 18 deletions backends/aoti/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,25 @@ endif()
include(${EXECUTORCH_ROOT}/tools/cmake/Utils.cmake)
find_package_torch()

# Common AOTI functionality - combines all AOTI common components
set(_aoti_common_sources common_shims.cpp)
add_library(aoti_common STATIC ${_aoti_common_sources})
# Common AOTI functionality - header-only library for common shims
add_library(aoti_common INTERFACE)
target_include_directories(
aoti_common
PUBLIC $<BUILD_INTERFACE:${EXECUTORCH_ROOT}> $<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${EXECUTORCH_ROOT}/..>
INTERFACE $<BUILD_INTERFACE:${EXECUTORCH_ROOT}>
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${EXECUTORCH_ROOT}/..>
)
target_compile_options(
aoti_common
PUBLIC $<$<CXX_COMPILER_ID:MSVC>:/EHsc /GR>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-fexceptions -frtti -fPIC>
INTERFACE $<$<CXX_COMPILER_ID:MSVC>:/EHsc /GR>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-fexceptions -frtti -fPIC>
)
target_compile_definitions(
aoti_common PRIVATE $<$<PLATFORM_ID:Windows>:EXPORT_AOTI_FUNCTIONS>
aoti_common INTERFACE $<$<PLATFORM_ID:Windows>:EXPORT_AOTI_FUNCTIONS>
)
# Ensure symbols are exported properly
if(APPLE)
target_link_options(aoti_common PUBLIC -Wl,-export_dynamic)
else()
target_link_options(
aoti_common PUBLIC $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wl,--export-dynamic>
)
endif()

# Link against ExecuTorch libraries and standard libraries
target_link_libraries(aoti_common PUBLIC extension_tensor ${CMAKE_DL_LIBS})
executorch_target_link_options_shared_lib(aoti_common)
target_link_libraries(aoti_common INTERFACE extension_tensor ${CMAKE_DL_LIBS})

install(
TARGETS aoti_common
Expand Down
12 changes: 12 additions & 0 deletions backends/aoti/aoti_delegate_handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
#include <executorch/runtime/core/error.h>
#include <executorch/runtime/core/evalue.h>
#include <string>
#include <vector>

#ifdef CUDA_AVAILABLE
#include <executorch/backends/aoti/slim/core/slim_tensor.h>
#endif

namespace executorch {
namespace backends {
Expand Down Expand Up @@ -95,6 +100,13 @@ struct AOTIDelegateHandle {
AOTInductorModelContainerGetNumOutputsFunc get_num_outputs;
AOTInductorModelContainerRunFunc run;
AOTInductorModelUpdateConstantsFromBlobFunc update_constants_from_blob;

#ifdef CUDA_AVAILABLE
// Cached output tensors for skip-copy optimization.
// When copy-skip is enabled, output SlimTensors are cached here to keep
// GPU memory alive while the caller processes the results.
std::vector<slim::SlimTensor> cached_outputs;
#endif
};

} // namespace aoti
Expand Down
268 changes: 0 additions & 268 deletions backends/aoti/common_shims.cpp

This file was deleted.

Loading
Loading