未验证 提交 e916e80c 编写于 作者: C co63oc 提交者: GitHub

Fix typos, test=document_fix (#53927)

上级 d8407c51
...@@ -22,7 +22,7 @@ namespace dialect { ...@@ -22,7 +22,7 @@ namespace dialect {
#define GET_PADDLE_TYPE_LIST paddle::dialect::DenseTensorType #define GET_PADDLE_TYPE_LIST paddle::dialect::DenseTensorType
/// ///
/// \brief Define built-in parameteric types. /// \brief Define built-in parametric types.
/// ///
class DenseTensorType : public ir::Type { class DenseTensorType : public ir::Type {
public: public:
......
...@@ -92,10 +92,10 @@ struct AttributeManager; ...@@ -92,10 +92,10 @@ struct AttributeManager;
/// \brief AttributeStorage is used to store all information of a Attribute. A /// \brief AttributeStorage is used to store all information of a Attribute. A
/// Attribute object contains a AttributeStorage. For non-parameter attribute, /// Attribute object contains a AttributeStorage. For non-parameter attribute,
/// the information includes: TypeId, so AttributeStorage only needs to include /// the information includes: TypeId, so AttributeStorage only needs to include
/// AbstractAttribute; For parameteric attribute, in addition to /// AbstractAttribute; For parametric attribute, in addition to
/// AbstractAttribute/TypeId, parameteric information needs to be included. So /// AbstractAttribute/TypeId, parametric information needs to be included. So
/// that, non-parameteric attribute can be constructed by AttributeStorage /// that, non-parametric attribute can be constructed by AttributeStorage
/// directly but parameteric attribute should be constructed by Derived /// directly but parametric attribute should be constructed by Derived
/// AttributeStorage. /// AttributeStorage.
/// ///
class AttributeStorage : public StorageManager::StorageBase { class AttributeStorage : public StorageManager::StorageBase {
...@@ -144,7 +144,7 @@ class AttributeStorage : public StorageManager::StorageBase { ...@@ -144,7 +144,7 @@ class AttributeStorage : public StorageManager::StorageBase {
struct AttributeManager { struct AttributeManager {
/// ///
/// \brief Get a unique instance of Attribute T from IrContext. Note: For a /// \brief Get a unique instance of Attribute T from IrContext. Note: For a
/// parameteric attribute, if not found in IrContext, it will try to create a /// parametric attribute, if not found in IrContext, it will try to create a
/// new instance and register it to IrContext; for a parameterless attribute, /// new instance and register it to IrContext; for a parameterless attribute,
/// only search. /// only search.
/// ///
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
namespace ir { namespace ir {
// This is a structure for creating, caching, and looking up Storage of // This is a structure for creating, caching, and looking up Storage of
// parameteric types. // parametric types.
struct ParametricStorageManager { struct ParametricStorageManager {
using StorageBase = StorageManager::StorageBase; using StorageBase = StorageManager::StorageBase;
...@@ -41,7 +41,7 @@ struct ParametricStorageManager { ...@@ -41,7 +41,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 parameteric storage of: [param_hash=" VLOG(4) << "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;
} }
...@@ -50,7 +50,7 @@ struct ParametricStorageManager { ...@@ -50,7 +50,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 parameteric storage " VLOG(4) << "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;
...@@ -94,7 +94,7 @@ StorageManager::StorageBase *StorageManager::GetParameterlessStorageImpl( ...@@ -94,7 +94,7 @@ StorageManager::StorageBase *StorageManager::GetParameterlessStorageImpl(
void StorageManager::RegisterParametricStorageImpl(TypeId type_id) { void StorageManager::RegisterParametricStorageImpl(TypeId type_id) {
std::lock_guard<ir::SpinLock> guard(parametric_instance_lock_); std::lock_guard<ir::SpinLock> guard(parametric_instance_lock_);
VLOG(4) << "Register a parameteric storage of: [TypeId_hash=" VLOG(4) << "Register a parametric storage of: [TypeId_hash="
<< std::hash<ir::TypeId>()(type_id) << "]."; << std::hash<ir::TypeId>()(type_id) << "].";
parametric_instance_.emplace(type_id, parametric_instance_.emplace(type_id,
std::make_unique<ParametricStorageManager>()); std::make_unique<ParametricStorageManager>());
......
...@@ -33,7 +33,7 @@ struct ParametricStorageManager; ...@@ -33,7 +33,7 @@ struct ParametricStorageManager;
/// Storage class must be a derived class of StorageManager::StorageBase. /// Storage class must be a derived class of StorageManager::StorageBase.
/// There are two types of Storage class: /// There are two types of Storage class:
/// One is a parameterless type, which can directly obtain an instance through /// One is a parameterless type, which can directly obtain an instance through
/// the get method; The other is a parameteric type, which needs to comply with /// the get method; The other is a parametric type, which needs to comply with
/// the following conditions: (1) Need to define a type alias called ParamKey, /// the following conditions: (1) Need to define a type alias called ParamKey,
/// it serves as the unique identifier for the Storage class; (2) Need to /// it serves as the unique identifier for the Storage class; (2) Need to
/// provide a hash method on the ParamKey for storage and access; (3) Need to /// provide a hash method on the ParamKey for storage and access; (3) Need to
...@@ -134,7 +134,7 @@ class StorageManager { ...@@ -134,7 +134,7 @@ class StorageManager {
void RegisterParameterlessStorageImpl( void RegisterParameterlessStorageImpl(
TypeId type_id, std::function<StorageBase *()> constructor); TypeId type_id, std::function<StorageBase *()> constructor);
// This map is a mapping between type id and parameteric type storage. // This map is a mapping between type id and parametric type storage.
std::unordered_map<TypeId, std::unique_ptr<ParametricStorageManager>> std::unordered_map<TypeId, std::unique_ptr<ParametricStorageManager>>
parametric_instance_; parametric_instance_;
......
...@@ -24,7 +24,7 @@ class Dialect; ...@@ -24,7 +24,7 @@ class Dialect;
/// ///
/// \brief Abstract the properties and behaviors common to all Type classes into /// \brief Abstract the properties and behaviors common to all Type classes into
/// an AbstractType class. There are two types in Type system: /// an AbstractType class. There are two types in Type system:
/// non-parameter/parameterless type and parameteric-type. The common attributes /// non-parameter/parameterless type and parametric-type. The common attributes
/// of all types is TypeId (and possibly others). Therefore, construct a class /// of all types is TypeId (and possibly others). Therefore, construct a class
/// with TypeId as its member. /// with TypeId as its member.
/// ///
...@@ -95,10 +95,10 @@ struct TypeManager; ...@@ -95,10 +95,10 @@ struct TypeManager;
/// ///
/// \brief TypeStorage is used to store all information of a Type. A Type object /// \brief TypeStorage is used to store all information of a Type. A Type object
/// contains a TypeStorage. For non-parameter type, the information includes: /// contains a TypeStorage. For non-parameter type, the information includes:
/// TypeId, so TypeStorage only needs to include AbstractType; For parameteric /// TypeId, so TypeStorage only needs to include AbstractType; For parametric
/// type, in addition to AbstractType/TypeId, parameteric information needs to /// type, in addition to AbstractType/TypeId, parametric information needs to
/// be included. So that, non-parameteric type can be constructed by TypeStorage /// be included. So that, non-parametric type can be constructed by TypeStorage
/// directly but parameteric type should be constructed by Derived TypeStorage. /// directly but parametric type should be constructed by Derived TypeStorage.
/// ///
class TypeStorage : public StorageManager::StorageBase { class TypeStorage : public StorageManager::StorageBase {
friend StorageManager; friend StorageManager;
...@@ -144,7 +144,7 @@ class TypeStorage : public StorageManager::StorageBase { ...@@ -144,7 +144,7 @@ class TypeStorage : public StorageManager::StorageBase {
struct TypeManager { struct TypeManager {
/// ///
/// \brief Get a unique instance of Type T from IrContext. Note: For a /// \brief Get a unique instance of Type T from IrContext. Note: For a
/// parameteric_type, if not found in IrContext, it will try to create a new /// parametric_type, if not found in IrContext, it will try to create a new
/// instance and register it to IrContext; for a parameterless type, only /// instance and register it to IrContext; for a parameterless type, only
/// search. /// search.
/// ///
......
...@@ -45,7 +45,7 @@ TEST(attribute_test, attribute_base) { ...@@ -45,7 +45,7 @@ TEST(attribute_test, attribute_base) {
TEST(attribute_test, built_in_attribute) { TEST(attribute_test, built_in_attribute) {
ir::IrContext *ctx = ir::IrContext::Instance(); ir::IrContext *ctx = ir::IrContext::Instance();
// Test 1: Test the parameteric built-in attribute of IrContext. // Test 1: Test the parametric built-in attribute of IrContext.
std::string str_tmp = "string_a"; std::string str_tmp = "string_a";
ir::Attribute string_attr_1 = ir::StrAttribute::get(ctx, str_tmp); ir::Attribute string_attr_1 = ir::StrAttribute::get(ctx, str_tmp);
ir::Attribute string_attr_2 = ir::StrAttribute::get(ctx, str_tmp); ir::Attribute string_attr_2 = ir::StrAttribute::get(ctx, str_tmp);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册