Skip to content

Commit 41221b5

Browse files
committed
Update on "[slimtensor] Add from_etensor factory function for ETensor to SlimTensor conversion"
Add from_etensor() factory function that creates a SlimTensor from an ExecuTorch portable tensor (ETensor), copying data to a target device. Key features: - Handles int32_t to int64_t conversion for sizes/strides (ETensor uses int32_t, SlimTensor uses int64_t) - Supports CPU and CUDA target devices via storage()->copy_() - Preserves tensor strides (non-contiguous layouts) - Provides both reference and pointer overloads Differential Revision: [D90539554](https://our.internmc.facebook.com/intern/diff/D90539554/) [ghstack-poisoned]
2 parents dc8ba96 + 5c96040 commit 41221b5

4 files changed

Lines changed: 7 additions & 8 deletions

File tree

backends/aoti/slim/core/test/test_as_strided.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <gtest/gtest.h>
1010

1111
#include <executorch/backends/aoti/slim/core/slim_tensor.h>
12-
#include <executorch/backends/aoti/slim/core/slim_tensor_view_incl.h>
12+
1313
#include <executorch/backends/aoti/slim/factory/empty.h>
1414

1515
#ifdef CUDA_AVAILABLE

backends/aoti/slim/core/test/test_permute_reshape.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <gtest/gtest.h>
1010

1111
#include <executorch/backends/aoti/slim/core/slim_tensor.h>
12-
#include <executorch/backends/aoti/slim/core/slim_tensor_view_incl.h>
12+
1313
#include <executorch/backends/aoti/slim/factory/empty.h>
1414

1515
#ifdef CUDA_AVAILABLE

backends/aoti/slim/core/test/test_slimtensor_copy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#include <executorch/backends/aoti/slim/core/slim_tensor.h>
1212
#include <executorch/backends/aoti/slim/core/storage.h>
13-
#include <executorch/backends/aoti/slim/factory/empty.h>
13+
1414

1515
namespace executorch::backends::aoti::slim {
1616

backends/cuda/CMakeLists.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,11 @@ install(
9797
DESTINATION lib
9898
)
9999

100-
# CUDA-specific AOTI shim symbols (dynamically linked) Uses
101-
# common_shims_slim.cpp for SlimTensor-based shim implementations
100+
# CUDA-specific AOTI shim symbols (dynamically linked)
102101
set(_aoti_cuda_shim_sources
103-
runtime/shims/memory.cpp runtime/guard.cpp runtime/shims/cuda_guard.cpp
104-
runtime/shims/int4mm.cu ${EXECUTORCH_ROOT}/backends/aoti/common_shims.cpp
105-
${EXECUTORCH_ROOT}/backends/aoti/common_shims_slim.cpp
102+
runtime/shims/memory.cpp runtime/shims/tensor_attribute.cpp
103+
runtime/guard.cpp runtime/shims/cuda_guard.cpp runtime/shims/int4mm.cu
104+
${EXECUTORCH_ROOT}/backends/aoti/common_shims.cpp
106105
)
107106

108107
add_library(aoti_cuda_shims SHARED ${_aoti_cuda_shim_sources})

0 commit comments

Comments
 (0)