Skip to content

Commit cb3487c

Browse files
committed
Update base for Update on "make etrecord support export program"
Differential Revision: [D77965102](https://our.internmc.facebook.com/intern/diff/D77965102/) [ghstack-poisoned]
2 parents ed9c4de + 55b3540 commit cb3487c

Some content is hidden

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

52 files changed

+600
-705
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9b498d3bb28b8e3411ce464dd2755c5b96d92c8f
1+
7cda4017ddda554752e89069ae205be5e8388f59

.ci/scripts/check_c10_sync.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ pushd pytorch
1212
git checkout "$pytorch_pin"
1313
popd
1414
"$(dirname "${BASH_SOURCE[0]}")"/compare_dirs.sh runtime/core/portable_type/c10/c10 pytorch/c10
15-
"$(dirname "${BASH_SOURCE[0]}")"/compare_dirs.sh runtime/core/portable_type/c10/torch/standalone pytorch/torch/standalone
15+
"$(dirname "${BASH_SOURCE[0]}")"/compare_dirs.sh runtime/core/portable_type/c10/torch/headeronly pytorch/torch/headeronly

backends/arm/_passes/TARGETS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ python_library(
66
deps = [
77
"//executorch/backends/arm:tosa_quant_utils",
88
"//executorch/backends/arm:tosa_utils",
9+
"//executorch/backends/arm/tosa/dialect:lib",
910
"//executorch/backends/transforms:fuse_view_copy",
1011
"//executorch/backends/transforms:remove_getitem_op",
1112
"//executorch/backends/transforms:replace_scalar_with_tensor",

backends/arm/tosa/dialect/TARGETS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
load("@fbcode_macros//build_defs:python_library.bzl", "python_library")
2+
3+
python_library(
4+
name = "lib",
5+
srcs = glob(["*.py"]),
6+
)

backends/cadence/aot/compiler.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ def trace(
6666
# Make the model inference mode by calling model.eval()
6767
model.eval()
6868

69-
# Prevent mkldnn decompositions
70-
torch._C._set_mkldnn_enabled(False)
71-
7269
# Get default decompositions
7370
decomp_table = torch.export.default_decompositions()
7471

backends/cadence/aot/functions_hifi.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
- op: clamp.Tensor_out
7676
kernels:
7777
- arg_meta: null
78-
kernel_name: cadence::impl::HiFi::clamp_tensor_out
78+
kernel_name: cadence::impl::HiFi::clamp_Tensor_out
7979

8080
- op: clone.out
8181
kernels:
@@ -100,7 +100,7 @@
100100
- op: eq.Tensor_out
101101
kernels:
102102
- arg_meta: null
103-
kernel_name: cadence::impl::HiFi::eq_tensor_out
103+
kernel_name: cadence::impl::HiFi::eq_Tensor_out
104104

105105
- op: fmod.Tensor_out
106106
kernels:
@@ -120,12 +120,12 @@
120120
- op: ge.Scalar_out
121121
kernels:
122122
- arg_meta: null
123-
kernel_name: cadence::impl::HiFi::ge_scalar_out
123+
kernel_name: cadence::impl::HiFi::ge_Scalar_out
124124

125125
- op: ge.Tensor_out
126126
kernels:
127127
- arg_meta: null
128-
kernel_name: cadence::impl::HiFi::ge_tensor_out
128+
kernel_name: cadence::impl::HiFi::ge_Tensor_out
129129

130130
- op: gelu.out
131131
kernels:
@@ -135,12 +135,12 @@
135135
- op: gt.Scalar_out
136136
kernels:
137137
- arg_meta: null
138-
kernel_name: cadence::impl::HiFi::gt_scalar_out
138+
kernel_name: cadence::impl::HiFi::gt_Scalar_out
139139

140140
- op: gt.Tensor_out
141141
kernels:
142142
- arg_meta: null
143-
kernel_name: cadence::impl::HiFi::gt_tensor_out
143+
kernel_name: cadence::impl::HiFi::gt_Tensor_out
144144

145145
- op: hardtanh.out
146146
kernels:
@@ -150,27 +150,27 @@
150150
- op: le.Scalar_out
151151
kernels:
152152
- arg_meta: null
153-
kernel_name: cadence::impl::HiFi::le_scalar_out
153+
kernel_name: cadence::impl::HiFi::le_Scalar_out
154154

155155
- op: le.Tensor_out
156156
kernels:
157157
- arg_meta: null
158-
kernel_name: cadence::impl::HiFi::le_tensor_out
158+
kernel_name: cadence::impl::HiFi::le_Tensor_out
159159

160160
- op: lt.Scalar_out
161161
kernels:
162162
- arg_meta: null
163-
kernel_name: cadence::impl::HiFi::lt_scalar_out
163+
kernel_name: cadence::impl::HiFi::lt_Scalar_out
164164

165165
- op: lt.Tensor_out
166166
kernels:
167167
- arg_meta: null
168-
kernel_name: cadence::impl::HiFi::lt_tensor_out
168+
kernel_name: cadence::impl::HiFi::lt_Tensor_out
169169

170170
- op: masked_fill.Scalar_out
171171
kernels:
172172
- arg_meta: null
173-
kernel_name: cadence::impl::HiFi::masked_fill_scalar_out
173+
kernel_name: cadence::impl::HiFi::masked_fill_Scalar_out
174174

175175
- op: max_pool2d_with_indices.out
176176
kernels:
@@ -185,7 +185,7 @@
185185
- op: mean.out
186186
kernels:
187187
- arg_meta: null
188-
kernel_name: cadence::impl::HiFi::mean_out
188+
kernel_name: cadence::impl::HiFi::mean_out
189189

190190
- op: minimum.out
191191
kernels:
@@ -205,7 +205,7 @@
205205
- op: ne.Tensor_out
206206
kernels:
207207
- arg_meta: null
208-
kernel_name: cadence::impl::HiFi::ne_tensor_out
208+
kernel_name: cadence::impl::HiFi::ne_Tensor_out
209209

210210
- op: permute_copy.out
211211
kernels:
@@ -289,11 +289,11 @@
289289
kernels:
290290
- arg_meta: null
291291
kernel_name: cadence::impl::HiFi::dequantize_per_tensor_out
292-
292+
293293
- func: cadence::quantized_conv.out(Tensor input, Tensor weight, Tensor bias, int[] stride, SymInt[] padding, int[] dilation, int groups, int input_zero_point, Tensor weight_zero_point, Tensor bias_scale, float out_scale, int out_zero_point, Tensor out_multiplier, Tensor out_shift, bool channel_last=False, *, Tensor(a!) out) -> Tensor(a!)
294294
kernels:
295295
- arg_meta: null
296-
kernel_name: cadence::impl::HiFi::quantized_conv_out
296+
kernel_name: cadence::impl::HiFi::quantized_conv_out
297297

298298
- func: cadence::quantized_layer_norm.out(Tensor input, Tensor in_scale, Tensor in_zero_point, int[] normalized_shape, Tensor weight, Tensor bias, float eps, float output_scale, int output_zero_point, *, Tensor(a!) out) -> Tensor(a!)
299299
kernels:

backends/cadence/aot/replace_ops.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2329,7 +2329,7 @@ def call(self, graph_module: torch.fx.GraphModule) -> PassResult:
23292329
# Extract an argument to a separate full op.
23302330
with graph_module.graph.inserting_before(mul_node):
23312331
full_tensor = graph_module.graph.call_function(
2332-
exir_ops.edge.aten.full.default, args=([1], full_arg)
2332+
torch.ops.aten.full.default, args=([1], full_arg)
23332333
)
23342334
new_mul_node = graph_module.graph.call_function(
23352335
torch.ops.aten.mul.Tensor, args=(x_arg, full_tensor)
@@ -2449,4 +2449,5 @@ class CadenceReplaceOpsInGraph:
24492449
ReplaceAtenApproxGeluWithApproxGeluPass,
24502450
ReplaceSplitWithSlicePass,
24512451
ReplacePowWithMulPass,
2452+
ReplaceMulTensorWithMulAndFullOpsPass,
24522453
]

backends/cadence/aot/tests/test_replace_ops_passes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1933,7 +1933,7 @@ def test_extract_mul_argument_to_full(
19331933
graph_after_passes,
19341934
expected_op_counts={
19351935
torch.ops.aten.mul.Tensor: 1,
1936-
exir_ops.edge.aten.full.default: 1,
1936+
torch.ops.aten.full.default: 1,
19371937
},
19381938
)
19391939
)

backends/cadence/hifi/operators/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ target_include_directories(
8888

8989
# Custom ops that are needed to run the test model.
9090
add_library(
91-
custom_ops "op_quantized_linear_out.cpp" "op_quantized_layer_norm.cpp" "quantized_matmul_out.cpp"
91+
custom_ops "op_quantized_linear_out.cpp" "op_quantized_layer_norm.cpp" "op_quantized_matmul_out.cpp"
9292
"op_quantize_per_tensor.cpp" "op_quantized_relu_out.cpp" "op_dequantize_per_tensor.cpp"
9393
"op_quantized_conv_out.cpp" "op_quantized_fully_connected_out"
9494
)

backends/cadence/hifi/operators/op_bitwise_and.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ Tensor& bitwise_and_Tensor_out(
169169
return out;
170170
}
171171

172-
return torch::executor::native::internal::bitwise_tensor_out<op_name>(
173-
ctx, a, b, out);
172+
return torch::executor::native::internal::
173+
bitwise_tensor_out<std::bit_and, op_name>(ctx, a, b, out);
174174
}
175175

176176
Tensor& bitwise_and_Scalar_out(
@@ -180,8 +180,8 @@ Tensor& bitwise_and_Scalar_out(
180180
Tensor& out) {
181181
// @lint-ignore CLANGTIDY facebook-hte-CArray
182182
static constexpr const char op_name[] = "bitwise_and.Scalar_out";
183-
return torch::executor::native::internal::bitwise_scalar_out<op_name>(
184-
ctx, a, b, out);
183+
return torch::executor::native::internal::
184+
bitwise_scalar_out<std::bit_and, op_name>(ctx, a, b, out);
185185
}
186186

187187
} // namespace native

0 commit comments

Comments
 (0)