Skip to content
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

#12901: Remove extraneous value: int parameter from ttnn.bitwise_not #12902

Closed
wants to merge 3 commits into from
Closed
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
3 changes: 1 addition & 2 deletions tests/tt_eager/python_api_testing/sweep_tests/tt_lib_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,6 @@ def eltwise_bitwise_xor(
def eltwise_bitwise_not(
x,
*args,
value,
device,
dtype,
layout,
Expand All @@ -898,7 +897,7 @@ def eltwise_bitwise_not(
**kwargs,
):
t0 = setup_tt_tensor(x, device, layout[0], input_mem_config[0], dtype[0])
t1 = ttnn.bitwise_not(t0, value, memory_config=output_mem_config, queue_id=0)
t1 = ttnn.bitwise_not(t0, memory_config=output_mem_config, queue_id=0)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides this, is there any test that need to update? BTW, how do I run tests locally?


return tt2torch_tensor(t1)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ inline void llk_math_eltwise_unary_sfpu_bitwise_not_init() {
}

template <bool APPROXIMATE>
inline void llk_math_eltwise_unary_sfpu_bitwise_not(uint dst_index, uint param0, int vector_mode = (int)VectorMode::RC) {
inline void llk_math_eltwise_unary_sfpu_bitwise_not(uint dst_index, int vector_mode = (int)VectorMode::RC) {
llk_math_eltwise_unary_sfpu_params<APPROXIMATE>
(ckernel::sfpu::calculate_bitwise_not<APPROXIMATE>,
dst_index, vector_mode, param0);
dst_index, vector_mode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ inline void llk_math_eltwise_unary_sfpu_bitwise_not_init() {
}

template <bool APPROXIMATE>
inline void llk_math_eltwise_unary_sfpu_bitwise_not(uint dst_index, uint param0, int vector_mode = (int)VectorMode::RC) {
inline void llk_math_eltwise_unary_sfpu_bitwise_not(uint dst_index, int vector_mode = (int)VectorMode::RC) {
llk_math_eltwise_unary_sfpu_params<APPROXIMATE>
(ckernel::sfpu::calculate_bitwise_not<APPROXIMATE>,
dst_index, vector_mode, param0);
dst_index, vector_mode);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ namespace ckernel {
* |-----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | idst | The index of the tile in DST register buffer to modify the computation of | uint32_t | Must be less than the size of the DST register buffer | True |
*/
ALWI void bitwise_not_tile(uint32_t idst, uint32_t param0) {
MATH((llk_math_eltwise_unary_sfpu_bitwise_not<APPROX>(idst, param0)));
ALWI void bitwise_not_tile(uint32_t idst) {
MATH((llk_math_eltwise_unary_sfpu_bitwise_not<APPROX>(idst)));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@ std::pair<std::string, std::string> get_op_init_and_func_parameterized(
op_init_and_name = {
"bitwise_xor_tile_init();", fmt::format("bitwise_xor_tile({}, {}u);", idst, std::to_string((uint)param0))};
break;
case UnaryOpType::BITWISE_NOT:
op_init_and_name = {
"bitwise_not_tile_init();", fmt::format("bitwise_not_tile({}, {}u);", idst, std::to_string((uint)param0))};
break;
case UnaryOpType::BITWISE_AND:
op_init_and_name = {
"bitwise_and_tile_init();", fmt::format("bitwise_and_tile({}, {}u);", idst, std::to_string((uint)param0))};
Expand Down Expand Up @@ -326,6 +322,9 @@ std::pair<string, string> get_op_init_and_func_default(UnaryOpType op_type, std:
case UnaryOpType::NEG:
op_init_and_name = {"negative_tile_init();", fmt::format("negative_tile({});", idst)};
break;
case UnaryOpType::BITWISE_NOT:
op_init_and_name = {"bitwise_not_tile_init();", fmt::format("bitwise_not_tile({});", idst)};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C/C++ code as string interests me a lot. Does it mean that we collate the C/C++ code somewhere and invokes a compiler in turn?

break;
default: TT_ASSERT(false && "Undefined non-parametrized op type");
}
return op_init_and_name;
Expand Down
2 changes: 1 addition & 1 deletion ttnn/cpp/ttnn/operations/eltwise/unary/unary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ template struct ExecuteUnary<UnaryOpType::ABS>;
template struct ExecuteUnary<UnaryOpType::ACOS>;
template struct ExecuteUnary<UnaryOpType::ASIN>;
template struct ExecuteUnary<UnaryOpType::ATAN>;
template struct ExecuteUnary<UnaryOpType::BITWISE_NOT>;
template struct ExecuteUnary<UnaryOpType::COS>;
template struct ExecuteUnary<UnaryOpType::ERFINV>;
template struct ExecuteUnary<UnaryOpType::EXP2>;
Expand Down Expand Up @@ -373,7 +374,6 @@ template struct ExecuteUnaryWithIntegerParameter<UnaryOpType::RIGHT_SHIFT, int32
template struct ExecuteUnaryWithIntegerParameter<UnaryOpType::BITWISE_AND, int32_t>;
template struct ExecuteUnaryWithIntegerParameter<UnaryOpType::BITWISE_OR, int32_t>;
template struct ExecuteUnaryWithIntegerParameter<UnaryOpType::BITWISE_XOR, int32_t>;
template struct ExecuteUnaryWithIntegerParameter<UnaryOpType::BITWISE_NOT, int32_t>;


template <UnaryOpType unary_op_type, typename T>
Expand Down
3 changes: 1 addition & 2 deletions ttnn/cpp/ttnn/operations/eltwise/unary/unary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ REGISTER_UNARY_OPERATION_OVERLOAD(abs, ABS);
REGISTER_UNARY_OPERATION(acos, ACOS);
REGISTER_UNARY_OPERATION(asin, ASIN);
REGISTER_UNARY_OPERATION(atan, ATAN);
REGISTER_UNARY_OPERATION(bitwise_not, BITWISE_NOT);
REGISTER_UNARY_OPERATION(cos, COS);
REGISTER_UNARY_OPERATION(erfinv, ERFINV);
REGISTER_UNARY_OPERATION(exp2, EXP2);
Expand Down Expand Up @@ -331,8 +332,6 @@ REGISTER_UNARY_OPERATION_WITH_INTEGER_PARAMETER(bitwise_right_shift, RIGHT_SHIFT
REGISTER_UNARY_OPERATION_WITH_INTEGER_PARAMETER(bitwise_and, BITWISE_AND, int32_t);
REGISTER_UNARY_OPERATION_WITH_INTEGER_PARAMETER(bitwise_or, BITWISE_OR, int32_t);
REGISTER_UNARY_OPERATION_WITH_INTEGER_PARAMETER(bitwise_xor, BITWISE_XOR, int32_t);
REGISTER_UNARY_OPERATION_WITH_INTEGER_PARAMETER(bitwise_not, BITWISE_NOT, int32_t);



// Other unaries
Expand Down
2 changes: 1 addition & 1 deletion ttnn/cpp/ttnn/operations/eltwise/unary/unary_pybind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1329,6 +1329,7 @@ void py_module(py::module& module) {
detail::bind_unary_operation(module, ttnn::acos, R"doc(\mathrm{{output\_tensor}}_i = acos(\mathrm{{input\_tensor}}_i))doc");
detail::bind_unary_operation(module, ttnn::asin, R"doc(\mathrm{{output\_tensor}}_i = asin(\mathrm{{input\_tensor}}_i))doc");
detail::bind_unary_operation(module, ttnn::atan, R"doc(\mathrm{{output\_tensor}}_i = atan(\mathrm{{input\_tensor}}_i))doc");
detail::bind_unary_operation(module, ttnn::bitwise_not, "Input tensor needs to be in the range [-2147483647, 2147483647], INT32 dtype. Support provided only for Wormhole_B0.");
detail::bind_unary_operation(module, ttnn::cos, R"doc(\mathrm{{output\_tensor}}_i = cos(\mathrm{{input\_tensor}}_i))doc");
detail::bind_unary_operation(module, ttnn::erfinv, R"doc(\mathrm{{output\_tensor}}_i = erfinv(\mathrm{{input\_tensor}}_i))doc",
R"doc(Supported dtypes, layouts, and ranks:
Expand Down Expand Up @@ -1459,7 +1460,6 @@ void py_module(py::module& module) {
detail::bind_unary_operation_with_integer_parameter(module, ttnn::bitwise_and, "value", "scalar value", "Input tensor needs to be positive, INT32 dtype. Support provided only for Wormhole_B0.");
detail::bind_unary_operation_with_integer_parameter(module, ttnn::bitwise_or, "value", "scalar value", "Input tensor needs to be positive, INT32 dtype. Support provided only for Wormhole_B0.");
detail::bind_unary_operation_with_integer_parameter(module, ttnn::bitwise_xor, "value", "scalar value", "Input tensor needs to be positive, INT32 dtype. Support provided only for Wormhole_B0.");
detail::bind_unary_operation_with_integer_parameter(module, ttnn::bitwise_not, "value", "scalar value", "Input tensor needs to be in the range [-2147483647, 2147483647], INT32 dtype. Support provided only for Wormhole_B0.");


// Unary ops with dim parameter
Expand Down