From 1e8b0f32b016d010e34fb4bbfc5c257266404b28 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 11 Jul 2022 06:07:02 +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 | 6 ++++-- taichi/codegen/llvm/codegen_llvm_quant.cpp | 9 ++++++--- taichi/ir/type.h | 3 ++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/taichi/codegen/llvm/codegen_llvm.cpp b/taichi/codegen/llvm/codegen_llvm.cpp index 1b1b41c1ca3f4..9f822e201f7c6 100644 --- a/taichi/codegen/llvm/codegen_llvm.cpp +++ b/taichi/codegen/llvm/codegen_llvm.cpp @@ -1394,9 +1394,11 @@ void CodeGenLLVM::visit(GlobalStoreStmt *stmt) { auto ptr_type = stmt->dest->ret_type->as(); if (ptr_type->is_bit_pointer()) { auto pointee_type = ptr_type->get_pointee_type(); - if (stmt->dest->as()->input_snode->type == SNodeType::bit_struct) { + if (stmt->dest->as()->input_snode->type == + SNodeType::bit_struct) { TI_ERROR( - "Bit struct stores with type {} should have been handled by BitStructStoreStmt.", + "Bit struct stores with type {} should have been handled by " + "BitStructStoreStmt.", pointee_type->to_string()); } if (auto qit = pointee_type->cast()) { diff --git a/taichi/codegen/llvm/codegen_llvm_quant.cpp b/taichi/codegen/llvm/codegen_llvm_quant.cpp index 5ff0dc0f32650..b916c4f243f94 100644 --- a/taichi/codegen/llvm/codegen_llvm_quant.cpp +++ b/taichi/codegen/llvm/codegen_llvm_quant.cpp @@ -42,10 +42,12 @@ llvm::Value *CodeGenLLVM::atomic_add_quant_fixed(AtomicOpStmt *stmt, tlctx->get_constant(qit->get_num_bits()), val_store}); } -llvm::Value *CodeGenLLVM::to_quant_fixed(llvm::Value *real, QuantFixedType *qfxt) { +llvm::Value *CodeGenLLVM::to_quant_fixed(llvm::Value *real, + QuantFixedType *qfxt) { // Compute int(real * (1.0 / scale) + 0.5) auto compute_type = qfxt->get_compute_type(); - auto s = builder->CreateFPCast(tlctx->get_constant(1.0 / qfxt->get_scale()), llvm_type(compute_type)); + auto s = builder->CreateFPCast(tlctx->get_constant(1.0 / qfxt->get_scale()), + llvm_type(compute_type)); auto input_real = builder->CreateFPCast(real, llvm_type(compute_type)); auto scaled = builder->CreateFMul(input_real, s); @@ -80,7 +82,8 @@ void CodeGenLLVM::store_quant_fixed(llvm::Value *bit_ptr, QuantFixedType *qfxt, llvm::Value *value, bool atomic) { - store_quant_int(bit_ptr, qfxt->get_digits_type()->as(), to_quant_fixed(value, qfxt), atomic); + store_quant_int(bit_ptr, qfxt->get_digits_type()->as(), + to_quant_fixed(value, qfxt), atomic); } void CodeGenLLVM::store_masked(llvm::Value *byte_ptr, diff --git a/taichi/ir/type.h b/taichi/ir/type.h index 9ce1b03591bdd..3863b0fee6e65 100644 --- a/taichi/ir/type.h +++ b/taichi/ir/type.h @@ -309,7 +309,8 @@ class QuantArrayType : public Type { if (auto qit = element_type_->cast()) { element_num_bits_ = qit->get_num_bits(); } else if (auto qfxt = element_type_->cast()) { - element_num_bits_ = qfxt->get_digits_type()->as()->get_num_bits(); + element_num_bits_ = + qfxt->get_digits_type()->as()->get_num_bits(); } else { TI_ERROR("Quant array only supports quant int/fixed type for now."); }