未验证 提交 8670df60 编写于 作者: L Leo Chen 提交者: GitHub

increase some log level in ir to avoid too much log (#54947)

上级 af127342
...@@ -56,7 +56,7 @@ class IrContextImpl { ...@@ -56,7 +56,7 @@ class IrContextImpl {
void RegisterAbstractType(ir::TypeId type_id, AbstractType *abstract_type) { void RegisterAbstractType(ir::TypeId type_id, AbstractType *abstract_type) {
std::lock_guard<ir::SpinLock> guard(registed_abstract_types_lock_); std::lock_guard<ir::SpinLock> 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<ir::TypeId>()(type_id) << std::hash<ir::TypeId>()(type_id)
<< ", AbstractType_ptr=" << abstract_type << "]."; << ", AbstractType_ptr=" << abstract_type << "].";
registed_abstract_types_.emplace(type_id, abstract_type); registed_abstract_types_.emplace(type_id, abstract_type);
...@@ -66,7 +66,7 @@ class IrContextImpl { ...@@ -66,7 +66,7 @@ class IrContextImpl {
std::lock_guard<ir::SpinLock> guard(registed_abstract_types_lock_); std::lock_guard<ir::SpinLock> guard(registed_abstract_types_lock_);
auto iter = registed_abstract_types_.find(type_id); auto iter = registed_abstract_types_.find(type_id);
if (iter != registed_abstract_types_.end()) { 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<ir::TypeId>()(type_id) << std::hash<ir::TypeId>()(type_id)
<< ", AbstractType_ptr=" << iter->second << "]."; << ", AbstractType_ptr=" << iter->second << "].";
return iter->second; return iter->second;
...@@ -79,7 +79,7 @@ class IrContextImpl { ...@@ -79,7 +79,7 @@ class IrContextImpl {
void RegisterAbstractAttribute(ir::TypeId type_id, void RegisterAbstractAttribute(ir::TypeId type_id,
AbstractAttribute *abstract_attribute) { AbstractAttribute *abstract_attribute) {
std::lock_guard<ir::SpinLock> guard(registed_abstract_attributes_lock_); std::lock_guard<ir::SpinLock> 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<ir::TypeId>()(type_id) << std::hash<ir::TypeId>()(type_id)
<< ", AbstractAttribute_ptr=" << abstract_attribute << "]."; << ", AbstractAttribute_ptr=" << abstract_attribute << "].";
registed_abstract_attributes_.emplace(type_id, abstract_attribute); registed_abstract_attributes_.emplace(type_id, abstract_attribute);
...@@ -105,7 +105,7 @@ class IrContextImpl { ...@@ -105,7 +105,7 @@ class IrContextImpl {
void RegisterOpInfo(const std::string &name, OpInfo info) { void RegisterOpInfo(const std::string &name, OpInfo info) {
std::lock_guard<ir::SpinLock> guard(registed_op_infos_lock_); std::lock_guard<ir::SpinLock> 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() << "]."; << ", OpInfo ptr=" << info.AsOpaquePointer() << "].";
registed_op_infos_.emplace(name, info); registed_op_infos_.emplace(name, info);
} }
...@@ -114,7 +114,7 @@ class IrContextImpl { ...@@ -114,7 +114,7 @@ class IrContextImpl {
std::lock_guard<ir::SpinLock> guard(registed_op_infos_lock_); std::lock_guard<ir::SpinLock> guard(registed_op_infos_lock_);
auto iter = registed_op_infos_.find(name); auto iter = registed_op_infos_.find(name);
if (iter != registed_op_infos_.end()) { 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() << "]."; << ", OpInfo: ptr=" << iter->second.AsOpaquePointer() << "].";
return iter->second; return iter->second;
} }
...@@ -125,7 +125,7 @@ class IrContextImpl { ...@@ -125,7 +125,7 @@ class IrContextImpl {
void RegisterDialect(std::string name, Dialect *dialect) { void RegisterDialect(std::string name, Dialect *dialect) {
std::lock_guard<ir::SpinLock> guard(registed_dialect_lock_); std::lock_guard<ir::SpinLock> guard(registed_dialect_lock_);
VLOG(4) << "Register a dialect of: [name=" << name VLOG(6) << "Register a dialect of: [name=" << name
<< ", dialect_ptr=" << dialect << "]."; << ", dialect_ptr=" << dialect << "].";
registed_dialect_.emplace(name, dialect); registed_dialect_.emplace(name, dialect);
} }
...@@ -138,7 +138,7 @@ class IrContextImpl { ...@@ -138,7 +138,7 @@ class IrContextImpl {
std::lock_guard<ir::SpinLock> guard(registed_dialect_lock_); std::lock_guard<ir::SpinLock> guard(registed_dialect_lock_);
auto iter = registed_dialect_.find(name); auto iter = registed_dialect_.find(name);
if (iter != registed_dialect_.end()) { 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 << "]."; << ", dialect_ptr=" << iter->second << "].";
return iter->second; return iter->second;
} }
...@@ -225,7 +225,6 @@ void IrContext::RegisterAbstractAttribute( ...@@ -225,7 +225,6 @@ void IrContext::RegisterAbstractAttribute(
if (GetRegisteredAbstractAttribute(type_id) == nullptr) { if (GetRegisteredAbstractAttribute(type_id) == nullptr) {
impl().RegisterAbstractAttribute( impl().RegisterAbstractAttribute(
type_id, new AbstractAttribute(std::move(abstract_attribute))); type_id, new AbstractAttribute(std::move(abstract_attribute)));
VLOG(4) << "<--- Attribute registered into IrContext. --->";
} else { } else {
LOG(WARNING) << " Attribute already registered."; LOG(WARNING) << " Attribute already registered.";
} }
...@@ -278,7 +277,6 @@ void IrContext::RegisterAbstractType(ir::TypeId type_id, ...@@ -278,7 +277,6 @@ void IrContext::RegisterAbstractType(ir::TypeId type_id,
if (GetRegisteredAbstractType(type_id) == nullptr) { if (GetRegisteredAbstractType(type_id) == nullptr) {
impl().RegisterAbstractType(type_id, impl().RegisterAbstractType(type_id,
new AbstractType(std::move(abstract_type))); new AbstractType(std::move(abstract_type)));
VLOG(4) << "<--- Type registered into IrContext. --->";
} else { } else {
LOG(WARNING) << " type already registered."; LOG(WARNING) << " type already registered.";
} }
...@@ -304,7 +302,6 @@ void IrContext::RegisterOpInfo(Dialect *dialect, ...@@ -304,7 +302,6 @@ void IrContext::RegisterOpInfo(Dialect *dialect,
attributes_name, attributes_name,
verify); verify);
impl().RegisterOpInfo(name, info); impl().RegisterOpInfo(name, info);
VLOG(4) << name << " op registered into IrContext. --->";
} }
} }
......
...@@ -152,7 +152,7 @@ class ConstructInterfacesOrTraits { ...@@ -152,7 +152,7 @@ class ConstructInterfacesOrTraits {
static void PlacementConstrctInterface( static void PlacementConstrctInterface(
InterfaceValue *&p_interface) { // NOLINT InterfaceValue *&p_interface) { // NOLINT
p_interface->swap(InterfaceValue::get<ConcreteOp, T>()); p_interface->swap(InterfaceValue::get<ConcreteOp, T>());
VLOG(4) << "New a interface: id[" VLOG(6) << "New a interface: id["
<< (p_interface->type_id()).AsOpaquePointer() << "]."; << (p_interface->type_id()).AsOpaquePointer() << "].";
++p_interface; ++p_interface;
} }
...@@ -161,7 +161,7 @@ class ConstructInterfacesOrTraits { ...@@ -161,7 +161,7 @@ class ConstructInterfacesOrTraits {
template <typename T> template <typename T>
static void PlacementConstrctTrait(ir::TypeId *&p_trait) { // NOLINT static void PlacementConstrctTrait(ir::TypeId *&p_trait) { // NOLINT
*p_trait = TypeId::get<T>(); *p_trait = TypeId::get<T>();
VLOG(4) << "New a trait: id[" << p_trait->AsOpaquePointer() << "]."; VLOG(6) << "New a trait: id[" << p_trait->AsOpaquePointer() << "].";
++p_trait; ++p_trait;
} }
}; };
......
...@@ -27,12 +27,12 @@ OpInfo OpInfoImpl::Create(Dialect *dialect, ...@@ -27,12 +27,12 @@ OpInfo OpInfoImpl::Create(Dialect *dialect,
// (1) Malloc memory for interfaces, traits, opinfo_impl. // (1) Malloc memory for interfaces, traits, opinfo_impl.
size_t interfaces_num = interface_map.size(); size_t interfaces_num = interface_map.size();
size_t traits_num = trait_set.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."; << traits_num << " traits, " << attributes_num << " attributes.";
size_t base_size = sizeof(InterfaceValue) * interfaces_num + size_t base_size = sizeof(InterfaceValue) * interfaces_num +
sizeof(TypeId) * traits_num + sizeof(OpInfoImpl); sizeof(TypeId) * traits_num + sizeof(OpInfoImpl);
char *base_ptr = static_cast<char *>(::operator new(base_size)); char *base_ptr = static_cast<char *>(::operator new(base_size));
VLOG(4) << "Malloc " << base_size << " Bytes at " VLOG(6) << "Malloc " << base_size << " Bytes at "
<< static_cast<void *>(base_ptr); << static_cast<void *>(base_ptr);
if (interfaces_num > 0) { if (interfaces_num > 0) {
std::sort(interface_map.begin(), interface_map.end()); std::sort(interface_map.begin(), interface_map.end());
...@@ -49,7 +49,7 @@ OpInfo OpInfoImpl::Create(Dialect *dialect, ...@@ -49,7 +49,7 @@ OpInfo OpInfoImpl::Create(Dialect *dialect,
base_ptr += traits_num * sizeof(TypeId); base_ptr += traits_num * sizeof(TypeId);
} }
// Construct OpInfoImpl. // 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, OpInfo op_info = OpInfo(new (base_ptr) OpInfoImpl(dialect,
op_id, op_id,
op_name, op_name,
...@@ -120,7 +120,7 @@ void *OpInfoImpl::GetInterfaceImpl(TypeId interface_id) const { ...@@ -120,7 +120,7 @@ void *OpInfoImpl::GetInterfaceImpl(TypeId interface_id) const {
} }
void OpInfoImpl::Destroy() { void OpInfoImpl::Destroy() {
VLOG(4) << "Destroy op_info impl at " << this; VLOG(6) << "Destroy op_info impl at " << this;
// (1) free interfaces // (1) free interfaces
char *base_ptr = reinterpret_cast<char *>(this) - char *base_ptr = reinterpret_cast<char *>(this) -
sizeof(ir::TypeId) * num_traits_ - sizeof(ir::TypeId) * num_traits_ -
...@@ -133,7 +133,7 @@ void OpInfoImpl::Destroy() { ...@@ -133,7 +133,7 @@ void OpInfoImpl::Destroy() {
} }
} }
// (2) free memeory // (2) free memeory
VLOG(4) << "Free base_ptr " << base_ptr; VLOG(6) << "Free base_ptr " << reinterpret_cast<void *>(base_ptr);
free(base_ptr); free(base_ptr);
} }
......
...@@ -44,7 +44,7 @@ struct ParametricStorageManager { ...@@ -44,7 +44,7 @@ struct ParametricStorageManager {
auto pr = parametric_instances_.equal_range(hash_value); auto pr = parametric_instances_.equal_range(hash_value);
while (pr.first != pr.second) { while (pr.first != pr.second) {
if (equal_func(pr.first->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 << "]."; << hash_value << ", storage_ptr=" << pr.first->second << "].";
return pr.first->second; return pr.first->second;
} }
...@@ -53,7 +53,7 @@ struct ParametricStorageManager { ...@@ -53,7 +53,7 @@ struct ParametricStorageManager {
} }
StorageBase *storage = constructor(); StorageBase *storage = constructor();
parametric_instances_.emplace(hash_value, storage); 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=" "of: [param_hash="
<< hash_value << ", storage_ptr=" << storage << "]."; << hash_value << ", storage_ptr=" << storage << "].";
return storage; return storage;
...@@ -76,7 +76,7 @@ StorageManager::StorageBase *StorageManager::GetParametricStorageImpl( ...@@ -76,7 +76,7 @@ StorageManager::StorageBase *StorageManager::GetParametricStorageImpl(
std::function<bool(const StorageBase *)> equal_func, std::function<bool(const StorageBase *)> equal_func,
std::function<StorageBase *()> constructor) { std::function<StorageBase *()> constructor) {
std::lock_guard<ir::SpinLock> guard(parametric_instance_lock_); std::lock_guard<ir::SpinLock> 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<ir::TypeId>()(type_id) << ", param_hash=" << hash_value << std::hash<ir::TypeId>()(type_id) << ", param_hash=" << hash_value
<< "]."; << "].";
if (parametric_instance_.find(type_id) == parametric_instance_.end()) { if (parametric_instance_.find(type_id) == parametric_instance_.end()) {
...@@ -89,7 +89,7 @@ StorageManager::StorageBase *StorageManager::GetParametricStorageImpl( ...@@ -89,7 +89,7 @@ StorageManager::StorageBase *StorageManager::GetParametricStorageImpl(
StorageManager::StorageBase *StorageManager::GetParameterlessStorageImpl( StorageManager::StorageBase *StorageManager::GetParameterlessStorageImpl(
TypeId type_id) { TypeId type_id) {
std::lock_guard<ir::SpinLock> guard(parameterless_instance_lock_); std::lock_guard<ir::SpinLock> 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<ir::TypeId>()(type_id) << "]."; << std::hash<ir::TypeId>()(type_id) << "].";
if (parameterless_instance_.find(type_id) == parameterless_instance_.end()) if (parameterless_instance_.find(type_id) == parameterless_instance_.end())
IR_THROW("TypeId not found in IrContext."); IR_THROW("TypeId not found in IrContext.");
...@@ -100,7 +100,7 @@ StorageManager::StorageBase *StorageManager::GetParameterlessStorageImpl( ...@@ -100,7 +100,7 @@ StorageManager::StorageBase *StorageManager::GetParameterlessStorageImpl(
void StorageManager::RegisterParametricStorageImpl( void StorageManager::RegisterParametricStorageImpl(
TypeId type_id, std::function<void(StorageBase *)> destroy) { TypeId type_id, std::function<void(StorageBase *)> destroy) {
std::lock_guard<ir::SpinLock> guard(parametric_instance_lock_); std::lock_guard<ir::SpinLock> guard(parametric_instance_lock_);
VLOG(4) << "Register a parametric storage of: [TypeId_hash=" VLOG(6) << "Register a parametric storage of: [TypeId_hash="
<< std::hash<ir::TypeId>()(type_id) << "]."; << std::hash<ir::TypeId>()(type_id) << "].";
parametric_instance_.emplace( parametric_instance_.emplace(
type_id, std::make_unique<ParametricStorageManager>(destroy)); type_id, std::make_unique<ParametricStorageManager>(destroy));
...@@ -109,7 +109,7 @@ void StorageManager::RegisterParametricStorageImpl( ...@@ -109,7 +109,7 @@ void StorageManager::RegisterParametricStorageImpl(
void StorageManager::RegisterParameterlessStorageImpl( void StorageManager::RegisterParameterlessStorageImpl(
TypeId type_id, std::function<StorageBase *()> constructor) { TypeId type_id, std::function<StorageBase *()> constructor) {
std::lock_guard<ir::SpinLock> guard(parameterless_instance_lock_); std::lock_guard<ir::SpinLock> guard(parameterless_instance_lock_);
VLOG(4) << "Register a parameterless storage of: [TypeId_hash=" VLOG(6) << "Register a parameterless storage of: [TypeId_hash="
<< std::hash<ir::TypeId>()(type_id) << "]."; << std::hash<ir::TypeId>()(type_id) << "].";
if (parameterless_instance_.find(type_id) != parameterless_instance_.end()) if (parameterless_instance_.find(type_id) != parameterless_instance_.end())
IR_THROW("storage class already registered"); IR_THROW("storage class already registered");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册