Skip to content

Commit

Permalink
Fix lints from HUD (pytorch#7110)
Browse files Browse the repository at this point in the history
run lintrunner

Co-authored-by: lind <[email protected]>
  • Loading branch information
davidlin54 and lind authored Nov 27, 2024
1 parent d136206 commit a2619e1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 29 deletions.
12 changes: 6 additions & 6 deletions backends/cadence/fusion_g3/operators/op_add.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,26 +95,26 @@ Tensor& add_out(
}

for (int i = 0; i < max_dim; i++) {
out_shape[i] = 1;
out_shape[i] = 1;
inp1_shape[i] = 1;
inp2_shape[i] = 1;
}
int offset_out = max_dim - out.dim();

int offset_out = max_dim - out.dim();
int offset_inp1 = max_dim - a.dim();
int offset_inp2 = max_dim - b.dim();

for (int i = 0; i < out.dim(); i++) {
out_shape[i + offset_out] = out.size(i);
}
for (int i = 0; i < a.dim(); i++) {
inp1_shape[i + offset_inp1] = a.size(i);
}
for (int i = 0; i < b.dim(); i++) {
inp2_shape[i + offset_inp2] = b.size(i);
inp2_shape[i + offset_inp2] = b.size(i);
}

if ((compute_type == ScalarType::Int) && (optimized)){
if ((compute_type == ScalarType::Int) && (optimized)) {
const int* const inp1_data = a.const_data_ptr<int>();
const int* const inp2_data = b.const_data_ptr<int>();
int* const out_data = out.mutable_data_ptr<int>();
Expand Down
10 changes: 5 additions & 5 deletions backends/cadence/fusion_g3/operators/op_mul.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,23 @@ Tensor& mul_out(
}

for (int i = 0; i < max_dim; i++) {
out_shape[i] = 1;
out_shape[i] = 1;
inp1_shape[i] = 1;
inp2_shape[i] = 1;
}
int offset_out = max_dim - out.dim();

int offset_out = max_dim - out.dim();
int offset_inp1 = max_dim - a.dim();
int offset_inp2 = max_dim - b.dim();

for (int i = 0; i < out.dim(); i++) {
out_shape[i + offset_out] = out.size(i);
}
for (int i = 0; i < a.dim(); i++) {
inp1_shape[i + offset_inp1] = a.size(i);
}
for (int i = 0; i < b.dim(); i++) {
inp2_shape[i + offset_inp2] = b.size(i);
inp2_shape[i + offset_inp2] = b.size(i);
}

if ((compute_type == ScalarType::Int) && (optimized)) {
Expand Down
1 change: 0 additions & 1 deletion backends/cadence/hifi/operators/op_maximum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ using torch::executor::apply_binary_elementwise_fn;
using torch::executor::Error;
using torch::executor::resize_to_broadcast_target_size;


namespace cadence {
namespace impl {
namespace HiFi {
Expand Down
1 change: 0 additions & 1 deletion backends/cadence/hifi/operators/op_pow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,3 @@ Tensor& pow_Scalar_out(
} // namespace HiFi
} // namespace impl
} // namespace cadence

31 changes: 15 additions & 16 deletions backends/cadence/hifi/operators/quantized_linear_out.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ using ::executorch::aten::Tensor;
using ::executorch::runtime::getLeadingDims;
using ::executorch::runtime::KernelRuntimeContext;


// The nnlib kernel to compute quantized linear via matmul.
// The nnlib kernel to compute quantized linear via matmul.

void _quantized_linear_asym8u(
const Tensor& in,
Expand All @@ -48,22 +47,22 @@ void _quantized_linear_asym8u(
const int32_t* __restrict__ bias_data = bias.const_data_ptr<int32_t>();
uint8_t* __restrict__ out_data = out.mutable_data_ptr<uint8_t>();
int32_t ret = xa_nn_matmul_asym8uxasym8u_asym8u(
out_data,
weight_data,
in_data,
bias_data,
out_dim,
in_dim,
in_dim,
leading_dims,
in_dim,
out_dim,
1,
out_data,
weight_data,
in_data,
bias_data,
out_dim,
in_dim,
in_dim,
leading_dims,
in_dim,
out_dim,
1,
-weight_zero_point.const_data_ptr<int32_t>()[0], // mat1_zero_bias
-in_zero_point, // mat2_zero_bias
out_multiplier.const_data_ptr<int32_t>()[0],
out_shift.const_data_ptr<int32_t>()[0],
out_zero_point);
out_multiplier.const_data_ptr<int32_t>()[0],
out_shift.const_data_ptr<int32_t>()[0],
out_zero_point);
ET_DCHECK_MSG(ret == 0, "HiFi quantized::linear failed");
}

Expand Down

0 comments on commit a2619e1

Please sign in to comment.