From c34344a7344678867a40b3cbc31d8ff5565e79e1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 6 Jul 2022 05:49:15 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- taichi/codegen/llvm/codegen_llvm.cpp | 3 ++- taichi/ir/snode.cpp | 6 +++--- taichi/ir/type.h | 4 ++-- taichi/ir/type_factory.cpp | 4 ++-- taichi/python/export_lang.cpp | 3 ++- tests/python/test_api.py | 4 ++-- tests/python/test_quant_array.py | 3 ++- 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/taichi/codegen/llvm/codegen_llvm.cpp b/taichi/codegen/llvm/codegen_llvm.cpp index 723db02a5f5a0..28ddb70db301d 100644 --- a/taichi/codegen/llvm/codegen_llvm.cpp +++ b/taichi/codegen/llvm/codegen_llvm.cpp @@ -1736,7 +1736,8 @@ void CodeGenLLVM::create_offload_struct_for(OffloadedStmt *stmt, bool spmd) { leaf_block = leaf_block->parent; } else { TI_ERROR( - "A bit-vectorized struct-for must loop over a quant array with a dense " + "A bit-vectorized struct-for must loop over a quant array with a " + "dense " "parent"); } } diff --git a/taichi/ir/snode.cpp b/taichi/ir/snode.cpp index e8f41e8744dd1..19da1b753b556 100644 --- a/taichi/ir/snode.cpp +++ b/taichi/ir/snode.cpp @@ -146,9 +146,9 @@ SNode &SNode::bit_struct(int num_bits, bool packed) { } SNode &SNode::quant_array(const std::vector &axes, - const std::vector &sizes, - int bits, - bool packed) { + const std::vector &sizes, + int bits, + bool packed) { auto &snode = create_node(axes, sizes, SNodeType::quant_array, packed); snode.physical_type = TypeFactory::get_instance().get_primitive_int_type(bits, false); diff --git a/taichi/ir/type.h b/taichi/ir/type.h index c8b60a7e3b888..9e4eb5b44f644 100644 --- a/taichi/ir/type.h +++ b/taichi/ir/type.h @@ -301,8 +301,8 @@ class BitStructType : public Type { class QuantArrayType : public Type { public: QuantArrayType(PrimitiveType *physical_type, - Type *element_type_, - int num_elements_) + Type *element_type_, + int num_elements_) : physical_type_(physical_type), element_type_(element_type_), num_elements_(num_elements_) { diff --git a/taichi/ir/type_factory.cpp b/taichi/ir/type_factory.cpp index 0294d383f183d..443dafae7faa4 100644 --- a/taichi/ir/type_factory.cpp +++ b/taichi/ir/type_factory.cpp @@ -87,8 +87,8 @@ Type *TypeFactory::get_bit_struct_type(PrimitiveType *physical_type, } Type *TypeFactory::get_quant_array_type(PrimitiveType *physical_type, - Type *element_type, - int num_elements) { + Type *element_type, + int num_elements) { quant_array_types_.push_back(std::make_unique( physical_type, element_type, num_elements)); return quant_array_types_.back().get(); diff --git a/taichi/python/export_lang.cpp b/taichi/python/export_lang.cpp index ebcfd4ef80874..943fcfd5f72d9 100644 --- a/taichi/python/export_lang.cpp +++ b/taichi/python/export_lang.cpp @@ -521,7 +521,8 @@ void export_lang(py::module &m) { bool))(&SNode::bitmasked), py::return_value_policy::reference) .def("bit_struct", &SNode::bit_struct, py::return_value_policy::reference) - .def("quant_array", &SNode::quant_array, py::return_value_policy::reference) + .def("quant_array", &SNode::quant_array, + py::return_value_policy::reference) .def("place", &SNode::place) .def("data_type", [](SNode *snode) { return snode->dt; }) .def("name", [](SNode *snode) { return snode->name; }) diff --git a/tests/python/test_api.py b/tests/python/test_api.py index ed943e41e9142..242c141aa1cad 100644 --- a/tests/python/test_api.py +++ b/tests/python/test_api.py @@ -97,8 +97,8 @@ def _get_expected_matrix_apis(): 'parent', 'shape', 'snode', 'to_numpy', 'to_paddle', 'to_torch' ] user_api[ti.FieldsBuilder] = [ - 'bit_struct', 'bitmasked', 'deactivate_all', 'dense', 'dynamic', 'finalize', - 'lazy_dual', 'lazy_grad', 'place', 'pointer', 'quant_array' + 'bit_struct', 'bitmasked', 'deactivate_all', 'dense', 'dynamic', + 'finalize', 'lazy_dual', 'lazy_grad', 'place', 'pointer', 'quant_array' ] user_api[ti.math] = [ 'acos', 'asin', 'atan2', 'cconj', 'cdiv', 'ceil', 'cexp', 'cinv', 'clamp', diff --git a/tests/python/test_quant_array.py b/tests/python/test_quant_array.py index 89e4af4abe19f..cb075827588d7 100644 --- a/tests/python/test_quant_array.py +++ b/tests/python/test_quant_array.py @@ -77,7 +77,8 @@ def test_quant_array_struct_for(): qi7 = ti.types.quant.int(7) x = ti.field(dtype=qi7) - cell.dense(ti.i, block_size // 4).quant_array(ti.i, 4, num_bits=32).place(x) + cell.dense(ti.i, block_size // 4).quant_array(ti.i, 4, + num_bits=32).place(x) @ti.kernel def activate():