History log of /llvm-project/mlir/tools/mlir-tblgen/RewriterGen.cpp (Results 176 – 200 of 200)
Revision Date Author Comments
# 0f9436e5 29-Jan-2019 Nicolas Vasilache <ntv@google.com>

Move google-mlir to google_mlir

Python modules cannot be defined under a directory that has a `-` character in its name inside of Google code.
Rename to `google_mlir` which circumvents this limitati

Move google-mlir to google_mlir

Python modules cannot be defined under a directory that has a `-` character in its name inside of Google code.
Rename to `google_mlir` which circumvents this limitation.

PiperOrigin-RevId: 231329321

show more ...


# ad637f3c 29-Jan-2019 Jacques Pienaar <jpienaar@google.com>

Enable using constant attribute as matchers.

Update to allow constant attribute values to be used to match or as result in rewrite rule. Define variable ctx in the matcher to allow matchers to refer

Enable using constant attribute as matchers.

Update to allow constant attribute values to be used to match or as result in rewrite rule. Define variable ctx in the matcher to allow matchers to refer to the context of the operation being matched.

PiperOrigin-RevId: 231322019

show more ...


# eb753f4a 28-Jan-2019 Lei Zhang <antiagainst@google.com>

Add tblgen::Pattern to model Patterns defined in TableGen

Similar to other tblgen:: abstractions, tblgen::Pattern hides the native TableGen
API and provides a nicer API that is more coherent with th

Add tblgen::Pattern to model Patterns defined in TableGen

Similar to other tblgen:: abstractions, tblgen::Pattern hides the native TableGen
API and provides a nicer API that is more coherent with the TableGen definitions.

PiperOrigin-RevId: 231285143

show more ...


# 0fbf4ff2 28-Jan-2019 Jacques Pienaar <jpienaar@google.com>

Define mAttr in terms of AttrConstraint.

* Matching an attribute and specifying a attribute constraint is the same thing executionally, so represent it such.
* Extract AttrConstraint helper to match

Define mAttr in terms of AttrConstraint.

* Matching an attribute and specifying a attribute constraint is the same thing executionally, so represent it such.
* Extract AttrConstraint helper to match TypeConstraint and use that where mAttr was previously used in RewriterGen.

PiperOrigin-RevId: 231213580

show more ...


# ba1715f4 25-Jan-2019 Lei Zhang <antiagainst@google.com>

Pull TableGen op argument definitions into their own files

PiperOrigin-RevId: 230923050


# 2de5e9fd 25-Jan-2019 Lei Zhang <antiagainst@google.com>

Support op removal patterns in TableGen

This CL adds a new marker, replaceWithValue, to indicate that no new result
op is generated by applying a pattern. Instead, the matched DAG is replaced
by an

Support op removal patterns in TableGen

This CL adds a new marker, replaceWithValue, to indicate that no new result
op is generated by applying a pattern. Instead, the matched DAG is replaced
by an existing SSA value.

Converted the tf.Identity converter to use the pattern.

PiperOrigin-RevId: 230922323

show more ...


# a280e399 22-Jan-2019 Jacques Pienaar <jpienaar@google.com>

Start doc generation pass.

Start doc generation pass that generates simple markdown output. The output is formatted simply[1] in markdown, but this allows seeing what info we have, where we can refi

Start doc generation pass.

Start doc generation pass that generates simple markdown output. The output is formatted simply[1] in markdown, but this allows seeing what info we have, where we can refine the op description (e.g., the inputs is probably redundant), what info is missing (e.g., the attributes could probably have a description).

The formatting of the description is still left up to whatever was in the op definition (which luckily, due to the uniformity in the .td file, turned out well but relying on the indentation there is fragile). The mechanism to autogenerate these post changes has not been added yet either. The output file could be run through a markdown formatter too to remove extra spaces.

[1]. This is not proposal for final style :) There could also be a discussion around single doc vs multiple (per dialect, per op), whether we want a TOC, whether operands/attributes should be headings or just formatted differently ...

PiperOrigin-RevId: 230354538

show more ...


# 05b02bb9 16-Jan-2019 Alex Zinenko <zinenko@google.com>

TableGen: implement predicate tree and basic simplification

A recent change in TableGen definitions allowed arbitrary AND/OR predicate
compositions at the cost of removing known-true predicate simpl

TableGen: implement predicate tree and basic simplification

A recent change in TableGen definitions allowed arbitrary AND/OR predicate
compositions at the cost of removing known-true predicate simplification.
Introduce a more advanced simplification mechanism instead.

In particular, instead of folding predicate C++ expressions directly in
TableGen, keep them as is and build a predicate tree in TableGen C++ library.
The predicate expression-substitution mechanism, necessary to implement complex
predicates for nested classes such as `ContainerType`, is replaced by a
dedicated predicate. This predicate appears in the predicate tree and can be
used for tree matching and separation. More specifically, subtrees defined
below such predicate may be subject to different transformations than those
that appear above. For example, a subtree known to be true above the
substitution predicate is not necessarily true below it.

Use the predicate tree structure to eliminate known-true and known-false
predicates before code emission, as well as to collapse AND and OR predicates
if their value can be deduced based on the value of one child.

PiperOrigin-RevId: 229605997

show more ...


# a5827fc9 16-Jan-2019 Jacques Pienaar <jpienaar@google.com>

Add attribute matching and transform to pattern rewrites.

Start simple with single predicate match & transform rules for attributes.
* Its unclear whether modelling Attr predicates will be needed so

Add attribute matching and transform to pattern rewrites.

Start simple with single predicate match & transform rules for attributes.
* Its unclear whether modelling Attr predicates will be needed so start with allowing matching attributes with a single predicate.
* The input and output attr type often differs and so add ability to specify a transform between the input and output format.

PiperOrigin-RevId: 229580879

show more ...


# bd161ae5 16-Jan-2019 Alex Zinenko <zinenko@google.com>

TableGen: untie Attr from Type

In TableGen definitions, the "Type" class has been used for types of things
that can be stored in Attributes, but not necessarily present in the MLIR type
system. As

TableGen: untie Attr from Type

In TableGen definitions, the "Type" class has been used for types of things
that can be stored in Attributes, but not necessarily present in the MLIR type
system. As a consequence, records like "String" or "DerviedAttrBody" were of
class "Type", which can be confusing. Furthermore, the "builderCall" field of
the "Type" class serves only for attribute construction. Some TableGen "Type"
subclasses that correspond to MLIR kinds of types do not have a canonical way
of construction only from the data available in TableGen, e.g. MemRefType would
require the list of affine maps. This leads to a conclusion that the entities
that describe types of objects appearing in Attributes should be independent of
"Type": they have some properties "Type"s don't and vice versa.

Do not parameterize Tablegen "Attr" class by an instance of "Type". Instead,
provide a "constBuilderCall" field that can be used to build an attribute from
a constant value stored in TableGen instead of indirectly going through
Attribute.Type.builderCall. Some attributes still don't have a
"constBuilderCall" because they used to depend on types without a
"builderCall".

Drop definitions of class "Type" that don't correspond to MLIR Types. Provide
infrastructure to define type-dependent attributes and string-backed attributes
for convenience.

PiperOrigin-RevId: 229570087

show more ...


# 44e9869f 15-Jan-2019 Alex Zinenko <zinenko@google.com>

TableGen: extract TypeConstraints from Type

MLIR has support for type-polymorphic instructions, i.e. instructions that may
take arguments of different types. For example, standard arithmetic operan

TableGen: extract TypeConstraints from Type

MLIR has support for type-polymorphic instructions, i.e. instructions that may
take arguments of different types. For example, standard arithmetic operands
take scalars, vectors or tensors. In order to express such instructions in
TableGen, we need to be able to verify that a type object satisfies certain
constraints, but we don't need to construct an instance of this type. The
existing TableGen definition of Type requires both. Extract out a
TypeConstraint TableGen class to define restrictions on types. Define the Type
TableGen class as a subclass of TypeConstraint for consistency. Accept records
of the TypeConstraint class instead of the Type class as values in the
Arguments class when defining operators.

Replace the predicate logic TableGen class based on conjunctive normal form
with the predicate logic classes allowing for abitrary combinations of
predicates using Boolean operators (AND/OR/NOT). The combination is
implemented using simple string rewriting of C++ expressions and, therefore,
respects the short-circuit evaluation order. No logic simplification is
performed at the TableGen level so all expressions must be valid C++.
Maintaining CNF using TableGen only would have been complicated when one needed
to introduce top-level disjunction. It is also unclear if it could lead to a
significantly simpler emitted C++ code. In the future, we may replace inplace
predicate string combination with a tree structure that can be simplified in
TableGen's C++ driver.

Combined, these changes allow one to express traits like ArgumentsAreFloatLike
directly in TableGen instead of relying on C++ trait classes.

PiperOrigin-RevId: 229398247

show more ...


# 4c0faef9 11-Jan-2019 Jacques Pienaar <jpienaar@google.com>

Avoid redundant predicate checking in type matching.

Expand type matcher template generator to consider a set of predicates that are known to
hold. This avoids inserting redundant checking for trivi

Avoid redundant predicate checking in type matching.

Expand type matcher template generator to consider a set of predicates that are known to
hold. This avoids inserting redundant checking for trivially true predicates
(for example predicate that hold according to the op definition). This only targets predicates that trivially holds and does not attempt any logic equivalence proof.

PiperOrigin-RevId: 228880468

show more ...


# 9b034f0b 09-Jan-2019 Lei Zhang <antiagainst@google.com>

Add tblgen::Attribute to wrap around TableGen Attr defs

This CL added a tblgen::Attribute class to wrap around raw TableGen
Record getValue*() calls on Attr defs, which will provide a nicer
API for

Add tblgen::Attribute to wrap around TableGen Attr defs

This CL added a tblgen::Attribute class to wrap around raw TableGen
Record getValue*() calls on Attr defs, which will provide a nicer
API for handling TableGen Record.

PiperOrigin-RevId: 228581107

show more ...


# 3e5ee82b 09-Jan-2019 Lei Zhang <antiagainst@google.com>

Put Operator and PredCNF into the tblgen namespace

PiperOrigin-RevId: 228429130


# b2cc2c34 09-Jan-2019 Lei Zhang <antiagainst@google.com>

Add tblgen::Type to wrap around TableGen Type defs

This CL added a tblgen::Type class to wrap around raw TableGen
Record getValue*() calls on Type defs, which will provide a
nicer API for handling T

Add tblgen::Type to wrap around TableGen Type defs

This CL added a tblgen::Type class to wrap around raw TableGen
Record getValue*() calls on Type defs, which will provide a
nicer API for handling TableGen Record.

The PredCNF class is also updated to work together with
tblgen::Type.
PiperOrigin-RevId: 228429090

show more ...


# aae85ddc 07-Jan-2019 Jacques Pienaar <jpienaar@google.com>

Match attributes in input pattern.

Bind attributes similar to operands. Use to rewrite leakyreulo and const rewrite pattern. The attribute type/attributes are not currently checked so should only be

Match attributes in input pattern.

Bind attributes similar to operands. Use to rewrite leakyreulo and const rewrite pattern. The attribute type/attributes are not currently checked so should only be used where the attributes match due to the construction of the op.

To support current attribute namespacing, convert __ in attribute name to "$" for matching purposes ('$' is not valid character in variable in TableGen).

Some simplification to make it simpler to specify indented ostream and avoid so many spaces. The goal is not to have perfectly formatted code generated but good enough so that its still easy to read for a user.

PiperOrigin-RevId: 228183639

show more ...


# 8f249438 05-Jan-2019 Jacques Pienaar <jpienaar@google.com>

Verify type of operands match those specifed in op registry.

Expand type to include matcher predicates. Use CNF form to allow specifying combinations of constraints for type. The matching call for t

Verify type of operands match those specifed in op registry.

Expand type to include matcher predicates. Use CNF form to allow specifying combinations of constraints for type. The matching call for the type is used to verify the construction of the operation as well as in rewrite pattern generation.

The matching initially includes redundant checks (e.g., even if the operand of the op is guaranteed to satisfy some requirement, it is still checked during matcher generation for now). As well as some of the traits specified now check what the generated code already checks. Some of the traits can be removed in future as the verify method will include the relevant checks based on the op definition already.

More work is needed for variadic operands.

CNF form is used so that in the follow up redundant checks in the rewrite patterns could be omitted (e.g., when matching a F32Tensor, one does not need to verify that op X's operand 0 is a Tensor if that is guaranteed by op X's definition). The alternative was to have single matcher function specified, but this would not allow for reasoning about what attributes already hold (at the level of PredAtoms).

Use this new operand type restrictions to rewrite BiasAdd with floating point operands as declarative pattern.

PiperOrigin-RevId: 227991412

show more ...


# ca88ea6f 04-Jan-2019 Lei Zhang <antiagainst@google.com>

Fix format for empty method definition

PiperOrigin-RevId: 227840511


# c396c044 03-Jan-2019 Jacques Pienaar <jpienaar@google.com>

Match the op via isa instead of string compare.

* Match using isa
- This limits the rewrite pattern to ops defined in op registry but that is probably better end state (esp. for additional verific

Match the op via isa instead of string compare.

* Match using isa
- This limits the rewrite pattern to ops defined in op registry but that is probably better end state (esp. for additional verification).

PiperOrigin-RevId: 227598946

show more ...


# 3633becf 02-Jan-2019 Jacques Pienaar <jpienaar@google.com>

Add builderCall to Type and add constant attr class.

With the builder to construct the type on the Type, the appropriate mlir::Type can be constructed where needed. Also add a constant attr class th

Add builderCall to Type and add constant attr class.

With the builder to construct the type on the Type, the appropriate mlir::Type can be constructed where needed. Also add a constant attr class that has the attribute and value as members.

PiperOrigin-RevId: 227564789

show more ...


# bbe3f4d9 29-Dec-2018 Jacques Pienaar <jpienaar@google.com>

Switch rewriters for relu, relu6, placeholder_input, softmax to patterns.

Add a constant F32 attribute for use with softmax legalization.

PiperOrigin-RevId: 227241643


# 554848d6 29-Dec-2018 Jacques Pienaar <jpienaar@google.com>

Match multiple pattern nodes as input to rewrite.

* Allow multi input node patterns in the rewrite;
* Use number of nodes matched as benefit;
* Rewrite relu(add(...)) matching using the new pattern;

Match multiple pattern nodes as input to rewrite.

* Allow multi input node patterns in the rewrite;
* Use number of nodes matched as benefit;
* Rewrite relu(add(...)) matching using the new pattern;

To allow for undefined ops, do string compare - will address soon!

PiperOrigin-RevId: 227225425

show more ...


# 2a463c36 28-Dec-2018 Jacques Pienaar <jpienaar@google.com>

Add convenience wrapper for operator in tblgen

Add convenience wrapper to make it easier to iterate over attributes and operands of operator defined in TableGen file. Use this class in RewriterGen (

Add convenience wrapper for operator in tblgen

Add convenience wrapper to make it easier to iterate over attributes and operands of operator defined in TableGen file. Use this class in RewriterGen (not used in the op generator yet, will do shortly). Change the RewriterGen to pass the bound arguments explicitly, this is in preparation for multi-op matching.

PiperOrigin-RevId: 227156748

show more ...


# 5187cfcf 28-Dec-2018 Chris Lattner <clattner@google.com>

Merge Operation into OperationInst and standardize nomenclature around
OperationInst. This is a big mechanical patch.

This is step 16/n towards merging instructions and statements, NFC.

PiperOrigi

Merge Operation into OperationInst and standardize nomenclature around
OperationInst. This is a big mechanical patch.

This is step 16/n towards merging instructions and statements, NFC.

PiperOrigin-RevId: 227093712

show more ...


# 150b1a85 27-Dec-2018 Jacques Pienaar <jpienaar@google.com>

Merge mlir-op-gen and mlir-rewriter-gen into mlir-tblgen.

Unify the two tools before factoring out helper classes.

PiperOrigin-RevId: 227015406


12345678