From 8670df604fcc81f74a1607b02b49c7ab9a728039 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Thu, 29 Jun 2023 17:11:54 +0800 Subject: [PATCH] increase some log level in ir to avoid too much log (#54947) --- paddle/ir/core/ir_context.cc | 17 +++++++---------- paddle/ir/core/op_base.h | 4 ++-- paddle/ir/core/op_info_impl.cc | 10 +++++----- paddle/ir/core/storage_manager.cc | 12 ++++++------ 4 files changed, 20 insertions(+), 23 deletions(-) diff --git a/paddle/ir/core/ir_context.cc b/paddle/ir/core/ir_context.cc index 6f4399ca8dc..acef7c4c026 100644 --- a/paddle/ir/core/ir_context.cc +++ b/paddle/ir/core/ir_context.cc @@ -56,7 +56,7 @@ class IrContextImpl { void RegisterAbstractType(ir::TypeId type_id, AbstractType *abstract_type) { std::lock_guard guard(registed_abstract_types_lock_); - VLOG(4) << "Register an abstract_type of: [TypeId_hash=" + VLOG(6) << "Register an abstract_type of: [TypeId_hash=" << std::hash()(type_id) << ", AbstractType_ptr=" << abstract_type << "]."; registed_abstract_types_.emplace(type_id, abstract_type); @@ -66,7 +66,7 @@ class IrContextImpl { std::lock_guard guard(registed_abstract_types_lock_); auto iter = registed_abstract_types_.find(type_id); if (iter != registed_abstract_types_.end()) { - VLOG(4) << "Found a cached abstract_type of: [TypeId_hash=" + VLOG(6) << "Found a cached abstract_type of: [TypeId_hash=" << std::hash()(type_id) << ", AbstractType_ptr=" << iter->second << "]."; return iter->second; @@ -79,7 +79,7 @@ class IrContextImpl { void RegisterAbstractAttribute(ir::TypeId type_id, AbstractAttribute *abstract_attribute) { std::lock_guard guard(registed_abstract_attributes_lock_); - VLOG(4) << "Register an abstract_attribute of: [TypeId_hash=" + VLOG(6) << "Register an abstract_attribute of: [TypeId_hash=" << std::hash()(type_id) << ", AbstractAttribute_ptr=" << abstract_attribute << "]."; registed_abstract_attributes_.emplace(type_id, abstract_attribute); @@ -105,7 +105,7 @@ class IrContextImpl { void RegisterOpInfo(const std::string &name, OpInfo info) { std::lock_guard guard(registed_op_infos_lock_); - VLOG(4) << "Register an operation of: [Name=" << name + VLOG(6) << "Register an operation of: [Name=" << name << ", OpInfo ptr=" << info.AsOpaquePointer() << "]."; registed_op_infos_.emplace(name, info); } @@ -114,7 +114,7 @@ class IrContextImpl { std::lock_guard guard(registed_op_infos_lock_); auto iter = registed_op_infos_.find(name); if (iter != registed_op_infos_.end()) { - VLOG(4) << "Found a cached OpInfo of: [name=" << name + VLOG(8) << "Found a cached OpInfo of: [name=" << name << ", OpInfo: ptr=" << iter->second.AsOpaquePointer() << "]."; return iter->second; } @@ -125,7 +125,7 @@ class IrContextImpl { void RegisterDialect(std::string name, Dialect *dialect) { std::lock_guard guard(registed_dialect_lock_); - VLOG(4) << "Register a dialect of: [name=" << name + VLOG(6) << "Register a dialect of: [name=" << name << ", dialect_ptr=" << dialect << "]."; registed_dialect_.emplace(name, dialect); } @@ -138,7 +138,7 @@ class IrContextImpl { std::lock_guard guard(registed_dialect_lock_); auto iter = registed_dialect_.find(name); if (iter != registed_dialect_.end()) { - VLOG(4) << "Found a cached dialect of: [name=" << name + VLOG(6) << "Found a cached dialect of: [name=" << name << ", dialect_ptr=" << iter->second << "]."; return iter->second; } @@ -225,7 +225,6 @@ void IrContext::RegisterAbstractAttribute( if (GetRegisteredAbstractAttribute(type_id) == nullptr) { impl().RegisterAbstractAttribute( type_id, new AbstractAttribute(std::move(abstract_attribute))); - VLOG(4) << "<--- Attribute registered into IrContext. --->"; } else { LOG(WARNING) << " Attribute already registered."; } @@ -278,7 +277,6 @@ void IrContext::RegisterAbstractType(ir::TypeId type_id, if (GetRegisteredAbstractType(type_id) == nullptr) { impl().RegisterAbstractType(type_id, new AbstractType(std::move(abstract_type))); - VLOG(4) << "<--- Type registered into IrContext. --->"; } else { LOG(WARNING) << " type already registered."; } @@ -304,7 +302,6 @@ void IrContext::RegisterOpInfo(Dialect *dialect, attributes_name, verify); impl().RegisterOpInfo(name, info); - VLOG(4) << name << " op registered into IrContext. --->"; } } diff --git a/paddle/ir/core/op_base.h b/paddle/ir/core/op_base.h index 5a3f62c60ad..16b2d3c9dec 100644 --- a/paddle/ir/core/op_base.h +++ b/paddle/ir/core/op_base.h @@ -152,7 +152,7 @@ class ConstructInterfacesOrTraits { static void PlacementConstrctInterface( InterfaceValue *&p_interface) { // NOLINT p_interface->swap(InterfaceValue::get()); - VLOG(4) << "New a interface: id[" + VLOG(6) << "New a interface: id[" << (p_interface->type_id()).AsOpaquePointer() << "]."; ++p_interface; } @@ -161,7 +161,7 @@ class ConstructInterfacesOrTraits { template static void PlacementConstrctTrait(ir::TypeId *&p_trait) { // NOLINT *p_trait = TypeId::get(); - VLOG(4) << "New a trait: id[" << p_trait->AsOpaquePointer() << "]."; + VLOG(6) << "New a trait: id[" << p_trait->AsOpaquePointer() << "]."; ++p_trait; } }; diff --git a/paddle/ir/core/op_info_impl.cc b/paddle/ir/core/op_info_impl.cc index c28686d10aa..119506b6655 100644 --- a/paddle/ir/core/op_info_impl.cc +++ b/paddle/ir/core/op_info_impl.cc @@ -27,12 +27,12 @@ OpInfo OpInfoImpl::Create(Dialect *dialect, // (1) Malloc memory for interfaces, traits, opinfo_impl. size_t interfaces_num = interface_map.size(); size_t traits_num = trait_set.size(); - VLOG(4) << "Create OpInfoImpl with: " << interfaces_num << " interfaces, " + VLOG(6) << "Create OpInfoImpl with: " << interfaces_num << " interfaces, " << traits_num << " traits, " << attributes_num << " attributes."; size_t base_size = sizeof(InterfaceValue) * interfaces_num + sizeof(TypeId) * traits_num + sizeof(OpInfoImpl); char *base_ptr = static_cast(::operator new(base_size)); - VLOG(4) << "Malloc " << base_size << " Bytes at " + VLOG(6) << "Malloc " << base_size << " Bytes at " << static_cast(base_ptr); if (interfaces_num > 0) { std::sort(interface_map.begin(), interface_map.end()); @@ -49,7 +49,7 @@ OpInfo OpInfoImpl::Create(Dialect *dialect, base_ptr += traits_num * sizeof(TypeId); } // Construct OpInfoImpl. - VLOG(4) << "Construct OpInfoImpl at " << base_ptr << " ......"; + VLOG(6) << "Construct OpInfoImpl at " << base_ptr << " ......"; OpInfo op_info = OpInfo(new (base_ptr) OpInfoImpl(dialect, op_id, op_name, @@ -120,7 +120,7 @@ void *OpInfoImpl::GetInterfaceImpl(TypeId interface_id) const { } void OpInfoImpl::Destroy() { - VLOG(4) << "Destroy op_info impl at " << this; + VLOG(6) << "Destroy op_info impl at " << this; // (1) free interfaces char *base_ptr = reinterpret_cast(this) - sizeof(ir::TypeId) * num_traits_ - @@ -133,7 +133,7 @@ void OpInfoImpl::Destroy() { } } // (2) free memeory - VLOG(4) << "Free base_ptr " << base_ptr; + VLOG(6) << "Free base_ptr " << reinterpret_cast(base_ptr); free(base_ptr); } diff --git a/paddle/ir/core/storage_manager.cc b/paddle/ir/core/storage_manager.cc index 8385c3d1fe4..7bdc131bbc3 100644 --- a/paddle/ir/core/storage_manager.cc +++ b/paddle/ir/core/storage_manager.cc @@ -44,7 +44,7 @@ struct ParametricStorageManager { auto pr = parametric_instances_.equal_range(hash_value); while (pr.first != pr.second) { if (equal_func(pr.first->second)) { - VLOG(4) << "Found a cached parametric storage of: [param_hash=" + VLOG(6) << "Found a cached parametric storage of: [param_hash=" << hash_value << ", storage_ptr=" << pr.first->second << "]."; return pr.first->second; } @@ -53,7 +53,7 @@ struct ParametricStorageManager { } StorageBase *storage = constructor(); parametric_instances_.emplace(hash_value, storage); - VLOG(4) << "No cache found, construct and cache a new parametric storage " + VLOG(6) << "No cache found, construct and cache a new parametric storage " "of: [param_hash=" << hash_value << ", storage_ptr=" << storage << "]."; return storage; @@ -76,7 +76,7 @@ StorageManager::StorageBase *StorageManager::GetParametricStorageImpl( std::function equal_func, std::function constructor) { std::lock_guard guard(parametric_instance_lock_); - VLOG(4) << "Try to get a parametric storage of: [TypeId_hash=" + VLOG(6) << "Try to get a parametric storage of: [TypeId_hash=" << std::hash()(type_id) << ", param_hash=" << hash_value << "]."; if (parametric_instance_.find(type_id) == parametric_instance_.end()) { @@ -89,7 +89,7 @@ StorageManager::StorageBase *StorageManager::GetParametricStorageImpl( StorageManager::StorageBase *StorageManager::GetParameterlessStorageImpl( TypeId type_id) { std::lock_guard guard(parameterless_instance_lock_); - VLOG(4) << "Try to get a parameterless storage of: [TypeId_hash=" + VLOG(6) << "Try to get a parameterless storage of: [TypeId_hash=" << std::hash()(type_id) << "]."; if (parameterless_instance_.find(type_id) == parameterless_instance_.end()) IR_THROW("TypeId not found in IrContext."); @@ -100,7 +100,7 @@ StorageManager::StorageBase *StorageManager::GetParameterlessStorageImpl( void StorageManager::RegisterParametricStorageImpl( TypeId type_id, std::function destroy) { std::lock_guard guard(parametric_instance_lock_); - VLOG(4) << "Register a parametric storage of: [TypeId_hash=" + VLOG(6) << "Register a parametric storage of: [TypeId_hash=" << std::hash()(type_id) << "]."; parametric_instance_.emplace( type_id, std::make_unique(destroy)); @@ -109,7 +109,7 @@ void StorageManager::RegisterParametricStorageImpl( void StorageManager::RegisterParameterlessStorageImpl( TypeId type_id, std::function constructor) { std::lock_guard guard(parameterless_instance_lock_); - VLOG(4) << "Register a parameterless storage of: [TypeId_hash=" + VLOG(6) << "Register a parameterless storage of: [TypeId_hash=" << std::hash()(type_id) << "]."; if (parameterless_instance_.find(type_id) != parameterless_instance_.end()) IR_THROW("storage class already registered"); -- GitLab