Skip to content

Commit f3ec544

Browse files
dbortfacebook-github-bot
authored andcommitted
Remove references to exec_aten::RuntimeContext (#5257)
Summary: Pull Request resolved: #5257 RuntimeContext should never have been in that namespace since it's not an ATen type. There are still other internal users outside of //executorch, but the important thing right now is that we set good examples for OSS users. Differential Revision: D62478758
1 parent 75a56a2 commit f3ec544

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+52
-51
lines changed

extension/llm/custom_ops/op_sdpa_aot.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Tensor& sdpa_with_kv_cache_out_no_context(
3333
// @lint-ignore CLANGTIDY facebook-hte-ParameterMightThrowOnCopy
3434
const optional<double> scale,
3535
Tensor& output) {
36-
exec_aten::RuntimeContext context{};
36+
executorch::runtime::KernelRuntimeContext context{};
3737
return torch::executor::native::sdpa_with_kv_cache_out(
3838
context,
3939
q_projected,

extension/llm/custom_ops/op_sdpa_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ exec_aten::Tensor op_scaled_dot_product_attention(
2828
bool is_causal,
2929
exec_aten::optional<double> scale,
3030
exec_aten::Tensor& out) {
31-
exec_aten::RuntimeContext context{};
31+
executorch::runtime::KernelRuntimeContext context{};
3232
return torch::executor::native::flash_attention_kernel_out(
3333
context, query, key, value, attn_mask, dropout_p, is_causal, scale, out);
3434
}

extension/llm/custom_ops/op_sdpa_with_kv_cache_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ exec_aten::Tensor op_sdpa_with_kv_cache(
3131
bool is_causal,
3232
exec_aten::optional<double> scale,
3333
exec_aten::Tensor& out) {
34-
exec_aten::RuntimeContext context{};
34+
executorch::runtime::KernelRuntimeContext context{};
3535
return torch::executor::native::sdpa_with_kv_cache_out(
3636
context,
3737
query,

kernels/aten/cpu/op__to_dim_order_copy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Tensor& _to_dim_order_copy_out(
115115
bool non_blocking,
116116
OptionalArrayRef<int64_t> dim_order,
117117
Tensor& out) {
118-
exec_aten::RuntimeContext ctx{};
118+
executorch::runtime::KernelRuntimeContext ctx{};
119119
return _to_dim_order_copy_out(ctx, self, non_blocking, dim_order, out);
120120
}
121121

kernels/optimized/cpu/op_gelu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace {
3838
*/
3939
template <typename CTYPE>
4040
void gelu(
41-
exec_aten::RuntimeContext& context,
41+
executorch::runtime::KernelRuntimeContext& context,
4242
const Tensor& input,
4343
string_view approximate,
4444
Tensor& output) {

kernels/portable/cpu/op__to_dim_order_copy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Tensor& _to_dim_order_copy_out(
118118
bool non_blocking,
119119
OptionalArrayRef<int64_t> dim_order,
120120
Tensor& out) {
121-
exec_aten::RuntimeContext context{};
121+
executorch::runtime::KernelRuntimeContext context{};
122122
return _to_dim_order_copy_out(context, self, non_blocking, dim_order, out);
123123
}
124124

kernels/portable/test/op_gelu_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ using torch::executor::testing::TensorFactory;
2525
// executorch/kernels/test/op_gelu_test.cpp instead.
2626

2727
Tensor& op_gelu_out(const Tensor& self, string_view approximate, Tensor& out) {
28-
exec_aten::RuntimeContext context{};
28+
executorch::runtime::KernelRuntimeContext context{};
2929
return torch::executor::native::gelu_out(context, self, approximate, out);
3030
}
3131

kernels/quantized/test/op_add_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
using namespace ::testing;
2222
using exec_aten::ArrayRef;
2323
using exec_aten::optional;
24-
using exec_aten::RuntimeContext;
2524
using exec_aten::Scalar;
2625
using exec_aten::ScalarType;
2726
using exec_aten::Tensor;
27+
using executorch::runtime::KernelRuntimeContext;
2828
using torch::executor::native::add_out;
2929
using torch::executor::native::dequantize_per_tensor_out;
3030
using torch::executor::native::quantize_per_tensor_out;
@@ -193,7 +193,7 @@ TEST(OpQuantizeAddTest, ConsitencyWithReferencePattern) {
193193

194194
optional<ScalarType> out_dtype = optional<ScalarType>();
195195

196-
RuntimeContext context{};
196+
KernelRuntimeContext context{};
197197
// q -> qadd -> dq
198198
// 3.5 / 0.5 + 1 = 8
199199
quantize_per_tensor_out(

kernels/quantized/test/op_embedding4b_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
using namespace ::testing;
2020
using exec_aten::ArrayRef;
2121
using exec_aten::optional;
22-
using exec_aten::RuntimeContext;
2322
using exec_aten::ScalarType;
2423
using exec_aten::Tensor;
24+
using executorch::runtime::KernelRuntimeContext;
2525
using torch::executor::native::quantized_embedding_4bit_out;
2626

2727
using torch::executor::testing::TensorFactory;
@@ -62,7 +62,7 @@ TEST(OpQuantizedEmbedding4bTest, TestGroupWiseQuantizedEmbedding) {
6262
EXPECT_TENSOR_EQ(out, expected);
6363

6464
out = tf.zeros({3, 4});
65-
auto context = RuntimeContext();
65+
auto context = KernelRuntimeContext();
6666
torch::executor::native::quantized_embedding_4bit_out(
6767
context,
6868
qweight,

kernels/quantized/test/op_embedding_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
using namespace ::testing;
2222
using exec_aten::ArrayRef;
2323
using exec_aten::optional;
24-
using exec_aten::RuntimeContext;
2524
using exec_aten::Scalar;
2625
using exec_aten::ScalarType;
2726
using exec_aten::Tensor;
27+
using executorch::runtime::KernelRuntimeContext;
2828
using torch::executor::native::dequantize_per_tensor_out;
2929
using torch::executor::native::embedding_out;
3030
using torch::executor::native::quantize_per_tensor_out;
@@ -120,7 +120,7 @@ TEST(OpQuantizedEmbeddingTest, ConsitencyWithReferencePattern) {
120120

121121
TensorFactory<ScalarType::Byte> tfo;
122122
Tensor qweight = tfo.zeros({3, 1});
123-
RuntimeContext context{};
123+
KernelRuntimeContext context{};
124124
// 3.5 / 0.5 + 1 = 8
125125
// 5.5 / 0.5 + 1 = 12
126126
// 1 / 0.5 + 1 = 3

kernels/quantized/test/op_mixed_linear_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
using namespace ::testing;
2020
using exec_aten::optional;
21-
using exec_aten::RuntimeContext;
2221
using exec_aten::ScalarType;
2322
using exec_aten::Tensor;
23+
using executorch::runtime::KernelRuntimeContext;
2424
using torch::executor::native::quantized_mixed_linear_out;
2525
using torch::executor::testing::TensorFactory;
2626

@@ -57,7 +57,7 @@ void test_dtype() {
5757
/*sizes=*/{1, 2},
5858
/*data=*/{2.3, 3.6});
5959

60-
RuntimeContext ctx{};
60+
KernelRuntimeContext ctx{};
6161

6262
quantized_mixed_linear_out(
6363
ctx, input, weight, weight_scales, opt_weight_zp, opt_dtype_out, out);
@@ -112,7 +112,7 @@ void test_dtype_partials() {
112112
{(1.0 * 5 + 1.5 * 3) * 0.2 + 2.0 * 1 * 1,
113113
(1.0 * 4 + 1.5 * 2) * 0.4 + 2.0 * 1 * 0.5});
114114

115-
RuntimeContext ctx{};
115+
KernelRuntimeContext ctx{};
116116

117117
quantized_mixed_linear_out(
118118
ctx, input, weight, weight_scales, opt_weight_zp, opt_dtype_out, out);

kernels/quantized/test/op_mixed_mm_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
using namespace ::testing;
2020
using exec_aten::optional;
21-
using exec_aten::RuntimeContext;
2221
using exec_aten::ScalarType;
2322
using exec_aten::Tensor;
23+
using executorch::runtime::KernelRuntimeContext;
2424
using torch::executor::native::quantized_mixed_mm_out;
2525
using torch::executor::testing::TensorFactory;
2626

@@ -55,7 +55,7 @@ void test_dtype() {
5555
/*sizes=*/{1, 2},
5656
/*data=*/{3.8, 3.0});
5757

58-
RuntimeContext ctx{};
58+
KernelRuntimeContext ctx{};
5959

6060
quantized_mixed_mm_out(ctx, input, weight, weight_scales, opt_weight_zp, out);
6161

kernels/test/TestUtil.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,6 @@ class OperatorTest : public ::testing::Test {
116116
}
117117

118118
protected:
119-
exec_aten::RuntimeContext context_;
119+
executorch::runtime::KernelRuntimeContext context_;
120120
bool expect_failure_;
121121
};

kernels/test/custom_kernel_example/op_relu.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ namespace native {
1818

1919
using Tensor = exec_aten::Tensor;
2020
using ScalarType = exec_aten::ScalarType;
21-
using exec_aten::RuntimeContext;
2221
using executor::Error;
22+
using executorch::runtime::KernelRuntimeContext;
2323

2424
namespace {
2525

@@ -61,7 +61,8 @@ void relu(const Tensor& input, Tensor& output) {
6161
*
6262
* relu.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
6363
*/
64-
Tensor& my_relu_out(RuntimeContext& context, const Tensor& input, Tensor& out) {
64+
Tensor&
65+
my_relu_out(KernelRuntimeContext& context, const Tensor& input, Tensor& out) {
6566
(void)context;
6667
resize(out, input.sizes());
6768
ET_KERNEL_CHECK(

kernels/test/op_atan2_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ using torch::executor::testing::SupportedFeatures;
2323
using torch::executor::testing::TensorFactory;
2424

2525
Tensor& op_atan2_out(const Tensor& self, const Tensor& other, Tensor& out) {
26-
exec_aten::RuntimeContext context{};
26+
executorch::runtime::KernelRuntimeContext context{};
2727
return torch::executor::aten::atan2_outf(context, self, other, out);
2828
}
2929

kernels/test/op_cdist_forward_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Tensor& op_cdist_forward_out(
2828
double p,
2929
optional<int64_t> compute_mode,
3030
Tensor& out) {
31-
exec_aten::RuntimeContext context{};
31+
executorch::runtime::KernelRuntimeContext context{};
3232
return torch::executor::aten::_cdist_forward_outf(
3333
context, x1, x2, p, compute_mode, out);
3434
}

kernels/test/op_clamp_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ class OpClampTensorOutTest : public OperatorTest {
260260
const optional<Tensor>& min,
261261
const optional<Tensor>& max,
262262
Tensor& out) {
263-
exec_aten::RuntimeContext context{};
263+
executorch::runtime::KernelRuntimeContext context{};
264264
return torch::executor::aten::clamp_outf(context, self, min, max, out);
265265
}
266266
};

kernels/test/op_diagonal_copy_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Tensor& op_diagonal_copy_out(
2727
int64_t dim1,
2828
int64_t dim2,
2929
Tensor& out) {
30-
exec_aten::RuntimeContext context{};
30+
executorch::runtime::KernelRuntimeContext context{};
3131
return torch::executor::aten::diagonal_copy_outf(
3232
context, input, offset, dim1, dim2, out);
3333
}

kernels/test/op_expm1_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ using torch::executor::testing::SupportedFeatures;
2323
using torch::executor::testing::TensorFactory;
2424

2525
Tensor& op_expm1_out(const Tensor& a, Tensor& out) {
26-
exec_aten::RuntimeContext context{};
26+
executorch::runtime::KernelRuntimeContext context{};
2727
return torch::executor::aten::expm1_outf(context, a, out);
2828
}
2929

kernels/test/op_flip_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ using exec_aten::Tensor;
2222
using torch::executor::testing::TensorFactory;
2323

2424
Tensor& op_flip_out(const Tensor& input, IntArrayRef dims, Tensor& out) {
25-
exec_aten::RuntimeContext context{};
25+
executorch::runtime::KernelRuntimeContext context{};
2626
return torch::executor::aten::flip_outf(context, input, dims, out);
2727
}
2828

kernels/test/op_ge_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#include <gtest/gtest.h>
1616

1717
using namespace ::testing;
18-
using exec_aten::RuntimeContext;
1918
using exec_aten::Scalar;
2019
using exec_aten::ScalarType;
2120
using exec_aten::Tensor;
21+
using executorch::runtime::KernelRuntimeContext;
2222
using torch::executor::testing::TensorFactory;
2323

2424
class OpGeTensorOutTest : public OperatorTest {

kernels/test/op_gt_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#include <gtest/gtest.h>
1616

1717
using namespace ::testing;
18-
using exec_aten::RuntimeContext;
1918
using exec_aten::Scalar;
2019
using exec_aten::ScalarType;
2120
using exec_aten::Tensor;
21+
using executorch::runtime::KernelRuntimeContext;
2222
using torch::executor::testing::TensorFactory;
2323

2424
class OpGtScalarOutTest : public OperatorTest {

kernels/test/op_le_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#include <gtest/gtest.h>
1616

1717
using namespace ::testing;
18-
using exec_aten::RuntimeContext;
1918
using exec_aten::Scalar;
2019
using exec_aten::ScalarType;
2120
using exec_aten::Tensor;
21+
using executorch::runtime::KernelRuntimeContext;
2222
using torch::executor::testing::TensorFactory;
2323

2424
class OpLeScalarOutTest : public OperatorTest {

kernels/test/op_log10_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ using torch::executor::testing::SupportedFeatures;
2323
using torch::executor::testing::TensorFactory;
2424

2525
Tensor& op_log10_out(const Tensor& a, Tensor& out) {
26-
exec_aten::RuntimeContext context{};
26+
executorch::runtime::KernelRuntimeContext context{};
2727
return torch::executor::aten::log10_outf(context, a, out);
2828
}
2929

kernels/test/op_log1p_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ using torch::executor::testing::SupportedFeatures;
2323
using torch::executor::testing::TensorFactory;
2424

2525
Tensor& op_log1p_out(const Tensor& a, Tensor& out) {
26-
exec_aten::RuntimeContext context{};
26+
executorch::runtime::KernelRuntimeContext context{};
2727
return torch::executor::aten::log1p_outf(context, a, out);
2828
}
2929

kernels/test/op_log2_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ using torch::executor::testing::SupportedFeatures;
2323
using torch::executor::testing::TensorFactory;
2424

2525
Tensor& op_log2_out(const Tensor& a, Tensor& out) {
26-
exec_aten::RuntimeContext context{};
26+
executorch::runtime::KernelRuntimeContext context{};
2727
return torch::executor::aten::log2_outf(context, a, out);
2828
}
2929

kernels/test/op_lt_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#include <gtest/gtest.h>
1616

1717
using namespace ::testing;
18-
using exec_aten::RuntimeContext;
1918
using exec_aten::Scalar;
2019
using exec_aten::ScalarType;
2120
using exec_aten::Tensor;
21+
using executorch::runtime::KernelRuntimeContext;
2222
using torch::executor::testing::TensorFactory;
2323

2424
class OpLtScalarOutTest : public OperatorTest {

kernels/test/op_maximum_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ using exec_aten::Tensor;
2121
using torch::executor::testing::TensorFactory;
2222

2323
Tensor& op_maximum_out(const Tensor& self, const Tensor& other, Tensor& out) {
24-
exec_aten::RuntimeContext context{};
24+
executorch::runtime::KernelRuntimeContext context{};
2525
return torch::executor::aten::maximum_outf(context, self, other, out);
2626
}
2727

kernels/test/op_native_batch_norm_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class OpNativeBatchNormLegitOutTest : public OperatorTest {
6161
exec_aten::Tensor& out0,
6262
exec_aten::Tensor& out1,
6363
exec_aten::Tensor& out2) {
64-
exec_aten::RuntimeContext context{};
64+
executorch::runtime::KernelRuntimeContext context{};
6565
return torch::executor::aten::_native_batch_norm_legit_outf(
6666
context,
6767
input,

kernels/test/op_native_group_norm_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ ::std::tuple<Tensor&, Tensor&, Tensor&> op_native_group_norm_out(
3232
Tensor& out0,
3333
Tensor& out1,
3434
Tensor& out2) {
35-
exec_aten::RuntimeContext context{};
35+
executorch::runtime::KernelRuntimeContext context{};
3636
return torch::executor::aten::native_group_norm_outf(
3737
context, input, weight, bias, N, C, HxW, group, eps, out0, out1, out2);
3838
}

kernels/test/op_ne_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#include <gtest/gtest.h>
1616

1717
using namespace ::testing;
18-
using exec_aten::RuntimeContext;
1918
using exec_aten::Scalar;
2019
using exec_aten::ScalarType;
2120
using exec_aten::Tensor;
21+
using executorch::runtime::KernelRuntimeContext;
2222
using torch::executor::testing::TensorFactory;
2323

2424
class OpNeTest : public OperatorTest {
@@ -34,7 +34,7 @@ class OpNeTest : public OperatorTest {
3434
Tensor a = tf_input.make(/*sizes=*/{2, 2}, /*data=*/{2, 3, 2, 4});
3535
Tensor b = tf_input.make({2, 2}, {2, 2, 2, 2});
3636
Tensor out = tf_bool.zeros({2, 2});
37-
RuntimeContext context{};
37+
KernelRuntimeContext context{};
3838

3939
torch::executor::aten::ne_outf(context, a, b, out);
4040
EXPECT_TENSOR_EQ(out, tf_bool.make({2, 2}, {false, true, false, true}));

kernels/test/op_pdist_forward_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ using exec_aten::Tensor;
2222
using torch::executor::testing::TensorFactory;
2323

2424
Tensor& op_pdist_forward_out(const Tensor& input, double p, Tensor& out) {
25-
exec_aten::RuntimeContext context{};
25+
executorch::runtime::KernelRuntimeContext context{};
2626
return torch::executor::aten::_pdist_forward_outf(context, input, p, out);
2727
}
2828

0 commit comments

Comments
 (0)