making the IR dumps much nicer.
This is part 2/3 of the path to making dialect types more nice. Part 3/3 will
slightly generalize the set of characters allowed in pretty types and make it
more principled.
--
PiperOrigin-RevId: 242249955
restricted grammar. This will make certain common types much easier to read.
This is part tensorflow/mlir#1 of 2, which allows us to accept the new syntax. Part 2 will
change the asmprinter to automatically use it when appropriate, which will
require updating a bunch of tests.
This is motivated by the EuroLLVM tutorial and cleaning up the LLVM dialect aesthetics a bit more.
--
PiperOrigin-RevId: 242234821
Remove undesigned/unimplemented operations: reshape and view.
Add new LangRefDeletions.md file in /experimental to store things removed from public LangRef.md
PiperOrigin-RevId: 242230200
* dyn_cast_or_null
- This will first check if the operation is null before trying to 'dyn_cast':
Value *v = ...;
if (auto forOp = dyn_cast_or_null<AffineForOp>(v->getDefiningOp()))
...
* isa_nonnull
- This will first check if the pointer is null before trying to 'isa':
Value *v = ...;
if (isa_nonnull<AffineForOp>(v->getDefiningOp());
...
--
PiperOrigin-RevId: 242171343
Use MLIR's ExecutionEngine to demonstrate how one can implement a simple
JIT-compiler and executor after fully lowering the Linalg dialect to the LLVM
IR dialect, using the direct conversion (not going through standard
loads/stores).
--
PiperOrigin-RevId: 242127690
The existing implementation of the ExecutionEngine unconditionally runs a list
of "default" MLIR passes on the module upon creation. These passes include,
among others, dialect conversions from affine to standard and from standard to
LLVM IR dialects. In some cases, these conversions might have been performed
before ExecutionEngine is created. More advanced use cases may be performing
additional transformations that the "default" passes will conflict with.
Provide an overload for ExecutionEngine::create that takes a PassManager
configured with the passes to run on the module. If it is not provided, do not
run any passes. The engine will not be created if the input module, after the
pass manager, has any other dialect than the LLVM IR dialect.
--
PiperOrigin-RevId: 242127393
To support automatically constraint composition of ArrayAttr, a new
predicate combiner, Concat, is introduced. It prepends a prefix and
appends a postfix to a child predicate's final predicate string.
--
PiperOrigin-RevId: 242121186
This CL adds declarative tiling support in the linalg dialect by providing:
1. loop tiling on linalg ops by simply calling into mlir::tile
2. view tiling on linalg ops by:
a. computing the subview between for each tile dimension based on the loop tile size and the mapping of loops to operand ranges.
b. declaring that the tiled form of a tensorcontraction is the same tensorcontraction on subviews, which essentially gives us a recursive form.
Point 2.b is potentially subject to change in the future.
--
PiperOrigin-RevId: 242058658
This CL adds the last bit to convert from linalg.LoadOp and linalg.StoreOp to the affine dialect, as well as a unit test to exercise the conversion.
--
PiperOrigin-RevId: 242045826
As part of this cleanup, NOperands<0>::Impl and NOperands<1>::Impl are typedef'd to ZeroOperands and OneOperand respectively.
--
PiperOrigin-RevId: 242027189
Note: This now means that we cannot fold chains of operations, i.e. where constant foldable operations feed into each other. Given that this is a testing pass solely for constant folding, this isn't really something that we want anyways. Constant fold tests should be simple and direct, with more advanced folding/feeding being tested with the canonicalizer.
--
PiperOrigin-RevId: 242011744
There are two places containing constant folding logic right now: the ConstantFold
pass and the GreedyPatternRewriteDriver. The logic was not shared and started to
drift apart. We were testing constant folding logic using the ConstantFold pass,
but lagged behind the GreedyPatternRewriteDriver, where we really want the constant
folding to happen.
This CL pulled the logic into utility functions and classes for sharing between
these two places. A new ConstantFoldHelper class is created to help constant fold
and de-duplication.
Also, renamed the ConstantFold pass to TestConstantFold to make it clear that it is
intended for testing purpose.
--
PiperOrigin-RevId: 241971681
Previously, attribute constraints are basically unused: we set true for almost
anything. This CL refactors common attribute kinds and sets constraints on
them properly. And fixed verification failures found by this change.
A noticeable one is that certain TF ops' attributes are required to be 64-bit
integer, but the corresponding TFLite ops expect 32-bit integer attributes.
Added bitwidth converters to handle this difference.
--
PiperOrigin-RevId: 241944008
We can bind symbols to op arguments/results in source pattern and op results in
result pattern. Previously resolving these symbols is scattered across
RewriterGen.cpp. This CL aggregated them into a `PatternSymbolResolver` class.
While we are here, this CL also cleans up tests for patterns to make them more
focused. Specifically, one-op-one-result.td is superseded by pattern.td;
pattern-tAttr.td is simplified; pattern-bound-symbol.td is added for the change
in this CL.
--
PiperOrigin-RevId: 241913973
Previously we bundle the existence check and the MLIR attribute kind check
in one call. Further constraints (like element bitwidth) have to be split
into following checks. That is not a nice separation given that we have more
checks for constraints. Instead, this CL changes to generate a local variable
for every attribute, check its existence first, then check the constraints.
Creating a local variable for each attribute also avoids querying it multiple
times using the raw getAttr() API. This is a win for both performance the
readability of the generated code.
This CL also changed the error message to be more greppable by delimiting
the error message from constraints with boilerplate part with colon.
--
PiperOrigin-RevId: 241906132
Load and Store Linalg operations are converter to their LLVM IR counterparts
preceded by a sequence of operations that recover the effective address of the
accessed element. The address is computed given the subscripts and the view
descriptor as
base_pointer + base_offset + SUM_i subscript_i * stride_i.
Manual testing shows that the resulting LLVM IR for the matrix multiplication
example can be compiled and executed, producing correct results.
--
PiperOrigin-RevId: 241889003
Mainly a missing dependency caused the tests to pass if one already built
the repo, but not from a clean (or incremental) build.
--
PiperOrigin-RevId: 241852313
- Retains Quantization types and predicates.
- Retains utilities and example (testable) passes/ops.
- Retains unit tests for example passes/ops.
- Moves fixed point ops (and corresponding real ops) to FxpMathOps.
- Moves real -> fixed point pass to FxpMathOps.
- Sever the dependency on the TF dialect from Quantization. These dialects should now be open-sourcable.
--
PiperOrigin-RevId: 241825598