Skip to content

Commit d0b9034

Browse files
committed
undo internal change
1 parent d8fafd3 commit d0b9034

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

backends/aoti/common_shims.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,20 @@
77
*/
88

99
#include <executorch/backends/aoti/common_shims.h>
10-
#include <executorch/extension/tensor/tensor_ptr.h>
1110
#include <executorch/runtime/platform/log.h>
1211
#include <cstdint>
1312

1413
namespace executorch {
1514
namespace backends {
1615
namespace aoti {
1716

17+
namespace internal {
1818
// Global storage for tensor metadata
1919
AOTI_SHIM_EXPORT std::unordered_map<Tensor*, std::vector<int64_t>>
2020
tensor_to_sizes;
2121
AOTI_SHIM_EXPORT std::unordered_map<Tensor*, std::vector<int64_t>>
2222
tensor_to_strides;
23+
} // namespace internal
2324

2425
extern "C" {
2526

@@ -51,10 +52,10 @@ AOTITorchError aoti_torch_get_storage_offset(
5152
}
5253

5354
AOTITorchError aoti_torch_get_strides(Tensor* tensor, int64_t** ret_strides) {
54-
auto it = tensor_to_strides.find(tensor);
55+
auto it = internal::tensor_to_strides.find(tensor);
5556
bool needs_update = false;
5657

57-
if (it == tensor_to_strides.end()) {
58+
if (it == internal::tensor_to_strides.end()) {
5859
needs_update = true;
5960
} else {
6061
// CRITICAL: Multimodal models reuse tensors with different shapes across
@@ -75,7 +76,7 @@ AOTITorchError aoti_torch_get_strides(Tensor* tensor, int64_t** ret_strides) {
7576
for (int i = 0; i < tensor->dim(); i++) {
7677
strides[i] = tensor_strides[i];
7778
}
78-
it = tensor_to_strides.insert_or_assign(tensor, std::move(strides)).first;
79+
it = internal::tensor_to_strides.insert_or_assign(tensor, std::move(strides)).first;
7980
}
8081

8182
// For 0D tensors, data() returns nullptr on empty vectors, but we need to
@@ -97,10 +98,10 @@ AOTITorchError aoti_torch_get_dtype(Tensor* tensor, int32_t* ret_dtype) {
9798
}
9899

99100
AOTITorchError aoti_torch_get_sizes(Tensor* tensor, int64_t** ret_sizes) {
100-
auto it = tensor_to_sizes.find(tensor);
101+
auto it = internal::tensor_to_sizes.find(tensor);
101102
bool needs_update = false;
102103

103-
if (it == tensor_to_sizes.end()) {
104+
if (it == internal::tensor_to_sizes.end()) {
104105
needs_update = true;
105106
} else {
106107
// CRITICAL: Multimodal models reuse tensors with different shapes across
@@ -121,7 +122,7 @@ AOTITorchError aoti_torch_get_sizes(Tensor* tensor, int64_t** ret_sizes) {
121122
for (int i = 0; i < tensor->dim(); i++) {
122123
sizes[i] = tensor_sizes[i];
123124
}
124-
it = tensor_to_sizes.insert_or_assign(tensor, std::move(sizes)).first;
125+
it = internal::tensor_to_sizes.insert_or_assign(tensor, std::move(sizes)).first;
125126
}
126127

127128
// For 0D tensors, data() returns nullptr on empty vectors, but we need to
@@ -194,8 +195,8 @@ size_t aoti_torch_dtype_element_size(int32_t dtype) {
194195

195196
// Cleanup functions
196197
void cleanup_tensor_metadata() {
197-
tensor_to_sizes.clear();
198-
tensor_to_strides.clear();
198+
internal::tensor_to_sizes.clear();
199+
internal::tensor_to_strides.clear();
199200
}
200201

201202
void aoti_torch_warn(

0 commit comments

Comments
 (0)