Skip to content

Commit 78e48c1

Browse files
committed
Update base for Update on "[ET-VK] Add convolution cases to codegen"
TSIA Differential Revision: [D55829466](https://our.internmc.facebook.com/intern/diff/D55829466/) [ghstack-poisoned]
1 parent 30f9a54 commit 78e48c1

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

backends/vulkan/runtime/graph/ops/impl/Conv2d.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ void resize_conv2d_node(
3434
if (ndim == 4) {
3535
new_out_sizes.at(ndim - 4) = self.sizes().at(ndim - 4);
3636
}
37-
const auto weight_sizes = graph->get_val(extra_args[0]).toTensorRef().sizes;
37+
const auto& weight_sizes = graph->get_val(extra_args[0]).toTensorRef().sizes;
3838
new_out_sizes.at(ndim - 3) =
3939
transposed ? weight_sizes.at(ndim - 3) : weight_sizes.at(ndim - 4);
4040

4141
// Height, Width
42-
const auto new_out_sizes_hw = calc_out_sizes_hw(
42+
const auto& new_out_sizes_hw = calc_out_sizes_hw(
4343
*graph,
4444
self.sizes(),
4545
extra_args[0],
@@ -102,7 +102,7 @@ api::ShaderInfo get_conv2d_shader(
102102
case Conv2dMethod::Depthwise:
103103
kernel_name << "conv2d_dw";
104104
if (!prepack_weights) {
105-
const auto weight_sizes = graph.get_val(weight).toTensorRef().sizes;
105+
const auto& weight_sizes = graph.get_val(weight).toTensorRef().sizes;
106106
if (weight_sizes.at(2) == 3 && weight_sizes.at(3) == 3) {
107107
kernel_name << "_output_tile_3x3";
108108
}
@@ -181,7 +181,7 @@ ValueRef prepack_weights(
181181
const ValueRef vref,
182182
const Conv2dMethod method) {
183183
const auto original_sizes = graph.get_val(vref).toTensorRef().sizes;
184-
const auto final_sizes = get_final_sizes(original_sizes, method);
184+
const auto& final_sizes = get_final_sizes(original_sizes, method);
185185

186186
ValueRef v = graph.add_tensor(
187187
final_sizes,
@@ -196,7 +196,7 @@ ValueRef prepack_weights(
196196
api::ShaderInfo shader =
197197
get_conv2d_shader(graph, t, /*prepack_weights = */ true, method, vref);
198198

199-
const auto padded_sizes = get_padded_sizes(original_sizes, method);
199+
const auto& padded_sizes = get_padded_sizes(original_sizes, method);
200200

201201
graph.prepack_nodes().emplace_back(new PrepackNode(
202202
graph,
@@ -235,13 +235,13 @@ Conv2dParams create_conv2d_params(
235235
const ValueRef weight,
236236
const KernelParams& p,
237237
const bool transposed) {
238-
const auto overlay_region = api::utils::make_ivec2({
238+
const auto& overlay_region = api::utils::make_ivec2({
239239
p.kernel_size.data[0] +
240240
(p.kernel_size.data[0] - 1) * (p.dilation.data[0] - 1),
241241
p.kernel_size.data[1] +
242242
(p.kernel_size.data[1] - 1) * (p.dilation.data[1] - 1),
243243
});
244-
const auto weight_sizes = graph.get_val(weight).toTensorRef().sizes;
244+
const auto& weight_sizes = graph.get_val(weight).toTensorRef().sizes;
245245
const int32_t in_group_size =
246246
api::utils::safe_downcast<int32_t>(api::utils::align_up(
247247
transposed ? weight_sizes.at(0) : weight_sizes.at(1), INT64_C(4)));
@@ -269,7 +269,7 @@ Conv2dMethod get_conv2d_method(
269269
const ValueRef weight,
270270
const int64_t groups,
271271
const bool transposed) {
272-
const auto weight_sizes = graph.get_val(weight).toTensorRef().sizes;
272+
const auto& weight_sizes = graph.get_val(weight).toTensorRef().sizes;
273273
if (!transposed && weight_sizes.at(0) == groups && weight_sizes.at(1) == 1) {
274274
return Conv2dMethod::Depthwise;
275275
}

backends/vulkan/runtime/graph/ops/impl/Pool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void resize_max_pool2d_node(
3535
new_out_sizes.at(ndim - 3) = self.sizes().at(ndim - 3);
3636

3737
// Height, Width
38-
const auto new_out_sizes_hw = calc_out_sizes_hw(
38+
const auto& new_out_sizes_hw = calc_out_sizes_hw(
3939
*graph,
4040
self.sizes(),
4141
extra_args[0],

0 commit comments

Comments
 (0)