Skip to content

patch op name discrepancy in oss #8491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions backends/cadence/aot/functions_hifi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,21 @@
- arg_meta: null
kernel_name: cadence::impl::HiFi::quantized_linear_out

- func: cadence::quantized_linear.per_tensor_out(Tensor src, Tensor weight, Tensor bias, SymInt src_zero_point, SymInt weight_zero_point, SymInt out_multiplier, SymInt out_shift, SymInt out_zero_point, Tensor? offset, *, Tensor(a!) out) -> Tensor(a!)
kernels:
- arg_meta: null
kernel_name: cadence::impl::HiFi::quantized_linear_per_tensor_out

- func: cadence::quantized_relu.out(Tensor X, Tensor X_zero_point, int out_zero_point, Tensor out_multiplier, Tensor out_shift, *, Tensor(a!) out) -> Tensor(a!)
kernels:
- arg_meta: null
kernel_name: cadence::impl::HiFi::quantized_relu_out

- func: cadence::quantized_relu.per_tensor_out(Tensor X, int X_zero_point, int out_zero_point, int out_multiplier, int out_shift, *, Tensor(a!) out) -> Tensor(a!)
kernels:
- arg_meta: null
kernel_name: cadence::impl::HiFi::quantized_relu_per_tensor_out

- func: cadence::quantized_linear.per_tensor_out(Tensor src, Tensor weight, Tensor bias, SymInt src_zero_point, SymInt weight_zero_point, SymInt out_multiplier, SymInt out_shift, SymInt out_zero_point, Tensor? offset, *, Tensor(a!) out) -> Tensor(a!)
kernels:
- arg_meta: null
Expand Down
4 changes: 2 additions & 2 deletions backends/cadence/hifi/operators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ target_include_directories(

# Custom ops that are needed to run the test model.
add_library(
custom_ops "quantized_linear_out.cpp" "quantized_layer_norm.cpp"
"quantize_per_tensor.cpp" "quantized_relu_out.cpp" "dequantize_per_tensor.cpp"
custom_ops "op_quantized_linear_out.cpp" "op_quantized_layer_norm.cpp"
"op_quantize_per_tensor.cpp" "op_quantized_relu_out.cpp" "op_dequantize_per_tensor.cpp"
)
target_include_directories(
custom_ops PUBLIC ${ROOT_DIR}/.. ${CMAKE_BINARY_DIR}
Expand Down
10 changes: 10 additions & 0 deletions backends/cadence/hifi/operators/op_clamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,16 @@ Tensor& clamp_Tensor_out(

return out;
}

Tensor& clamp_tensor_out(
RuntimeContext& ctx,
const Tensor& in,
const executorch::aten::optional<Tensor>& min_opt,
const executorch::aten::optional<Tensor>& max_opt,
Tensor& out) {
clamp_Tensor_out(ctx, in, min_opt, max_opt, out);
}

} // namespace native
} // namespace HiFi
} // namespace impl
Expand Down
10 changes: 10 additions & 0 deletions backends/cadence/hifi/operators/op_mean.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,16 @@ Tensor& mean_out(
return out;
}

Tensor& mean_dim_out(
RuntimeContext& ctx,
const Tensor& in,
optional<ArrayRef<int64_t>> dim_list,
bool keepdim,
optional<ScalarType> dtype,
Tensor& out) {
mean_out(ctx, in, dim_list, keepdim, dtype, out);
}

} // namespace native
} // namespace HiFi
} // namespace impl
Expand Down
40 changes: 40 additions & 0 deletions backends/cadence/hifi/operators/op_quantized_relu_out.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,46 @@ void quantized_relu_per_tensor_out(
}
}

void quantized_relu_per_tensor_out(
KernelRuntimeContext& ctx,
const Tensor& input,
const Tensor& in_zero_point,
const int64_t out_zero_point,
const Tensor& out_multiplier,
const Tensor& out_shift,
Tensor& output) {
int8_t _in_zero_point = in_zero_point.const_data_ptr<int8_t>()[0];
int32_t _out_multiplier = out_multiplier.const_data_ptr<int32_t>()[0];
int32_t _out_shift = out_shift.const_data_ptr<int32_t>()[0];

quantized_relu_per_tensor_out(
ctx,
input,
_in_zero_point,
out_zero_point,
_out_multiplier,
_out_shift,
output);
}

void quantized_relu_out(
KernelRuntimeContext& ctx,
const Tensor& input,
const int64_t in_zero_point,
const int64_t out_zero_point,
const int64_t out_multiplier,
const int64_t out_shift,
Tensor& output) {
quantized_relu_per_tensor_out(
ctx,
input,
in_zero_point,
out_zero_point,
out_multiplier,
out_shift,
output);
}

} // namespace native
} // namespace HiFi
} // namespace impl
Expand Down
9 changes: 9 additions & 0 deletions backends/cadence/hifi/operators/op_softmax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,15 @@ Tensor& _softmax_out(
return out;
}

Tensor& softmax_out(
KernelRuntimeContext& ctx,
const Tensor& in,
int64_t dim,
bool half_to_float,
Tensor& out) {
_softmax_out(ctx, in, dim, half_to_float, out);
}

} // namespace native
} // namespace HiFi
} // namespace impl
Expand Down
Loading