This avoids crashing when trying to dump an operation nested in a region that isn't yet attached to an operation, which is quite useful when debugging.
This alone won't be enough to print an unlink Operation, it'll display `<<UNLINKED INSTRUCTION>>`.
--
PiperOrigin-RevId: 249496388
EDSC builder test uses FileCheck to match the IR produced by EDSC in the
textual order. For mathematical operations, EDSC relies on overloaded
operators. Since they are essentially function calls, the order of evaluation
of their operands is unspecified and differs between compilers. Do not rely on
a specific order of operands and just check they are all emitted before the
last operation. Give names to matched SSA values in order to make sure the
right operands are used in relevant places.
--
PiperOrigin-RevId: 249494995
The passed element type description is usually unnecessary, and it's just as valid to want to pass a description for the entire container. In either case there's an alternative (Separate element type def or a TypeAlias) and we don't need to pollute the main API.
To allow for this, I cleaned up the TF op definitions and added some additional utilities.
--
PiperOrigin-RevId: 249340979
Establish the following convention:
1. Container class types end in "Of" (e.g. TensorOf) and take a list of allowed types.
2. An X container where only a single type is allowed is called TypeX (e.g. I32Tensor).
3. An X container where any type is allowed is called AnyX (e.g. AnyTensor).
--
PiperOrigin-RevId: 249281018
Otherwise, GCC < 7 does not link in the dialect registration, fails to look up
the dialect in the context and cannot construct SDBM objects.
--
PiperOrigin-RevId: 249259758
MLIRContext does not have to be aware of the SDBM unique data structures
directly. Move the SDBM storage uniquer from MLIRContext to the SDBM dialect
instance. Expressions that previously required a context to be constructed now
require an instance of the dialect in order to access the uniquer. While they
could look up the dialect in the context, it would have introduced a rather
expensive lookup into each construction. Instead, the caller is expected to
obtain the dialect instance and cache it.
--
PiperOrigin-RevId: 249245199
We now have sufficient extensibility in dialects to move attribute components
such as SDBM out of the core IR into a dedicated dialect and make them
optional. Introduce an SDBM dialect and move the code. This is a mostly
non-functional change.
--
PiperOrigin-RevId: 249244802
SDBM expressions are designed as components of an attribute, similarly to
affine expressions. As such, they need to be unique'd in the MLIRContext.
When SDBM expressions were implemented, uniqu'ing objects in a context required
to modify MLIRContext implementation. This is no longer the case as generic
StorageUniquer has been introduced. Port the SDBMExpr uniqu'ing to use a newly
introduced uniquer and remove SDBM construction from MLIRContext.cpp.
--
PiperOrigin-RevId: 249244739
A couple of warnings was produced when compiling this test due to comaprisons
with a signed literal. Used unsigned literals instead.
--
PiperOrigin-RevId: 249242970
The Op Definition Generator will automatically insert the VariadicOperands
trait if an op has variadic operands or results. It already derives from
MultiOperandTraitBase.
--
PiperOrigin-RevId: 249227268
* Use `cast` rather than `dyn_cast` to get an assertion failure rather than a segfault in case of a type mismatch.
* Use stream operators to `emitOpError`s.
--
PiperOrigin-RevId: 249208135
Affine expressions are designed as components of an attribute and are unique'd
in the MLIRContext. When affine expressions were implemented, uniqu'ing
objects in a context required to modify MLIRContext implementation. This is no
longer the case as generic StorageUniquer has been introduced. Port the
AffineExpr construction to use the new infrastructure by introducing an
affineUniquer into the MLIRContext.
--
PiperOrigin-RevId: 249207539
Similarly to other value-type wrappers, the default constructor of AffineExpr
constructs a null object and removes the need for an explicit ::Null
constructor. Drop it and remove the only user which can trivially rely on the
default constructor.
--
PiperOrigin-RevId: 249207502
This adds the basic passes needed and ties them into mlir-opt. Also adds two specific unit tests that exercise them.
Next step is a standalone quantizer tool and additional cleanup.
Tested:
ninja check-mlir
--
PiperOrigin-RevId: 249167690
Using ArrayRef introduces issues with the order of evaluation between a constructor and
the arguments of the subsequent calls to the `operator()`.
As a consequence the order of captures is not well-defined can go wrong with certain compilers (e.g. gcc-6.4).
This CL fixes the issue by using lambdas in lieu of ArrayRef.
--
PiperOrigin-RevId: 249114775
Unfortunately, this now gives a segfault if you pass it an empty list, similar to stringify. Given how fiddly this is, we should probably have a string join helper. I'll fix both of these using better tablegen helpers in a follow-up.
--
PiperOrigin-RevId: 249076849
This reduces conflict between these and other type names, where we're moving towards "Of" indicating a container type containing certain types. It also better matches the "Neg" predicate modifier and generally is pretty understandable/readable for predicates.
--
PiperOrigin-RevId: 249076508
These don't have any behavior and just delegate to Type. The only references are in OpBase.td Since the tablegen type hierarchy is not realized in the generated C++ these also aren't providing value for examining the type hierarchy
--
PiperOrigin-RevId: 249073939
Previously we force the C++ namespaces to be `NS` if `SomeOp` is defined as
`NS_SomeOp`. This is too rigid as it does not support nested namespaces
well. This CL adds a "namespace" field into the Dialect class to allow
flexible namespaces.
--
PiperOrigin-RevId: 249064981
This CL adds a pass to lower out of dot,matvec,matmul etc and into a combination of affine.for, linalg.load and linalg.store operations.
Such operations can then later lowered to LLVM.
This CL essentially performs op expansion using EDSCs and factors out a few common utils from Tiling.cpp.
--
PiperOrigin-RevId: 249049518
SDBM has an output format representing the unterlying matrix and stripe
expressions. Move the SDBM tests from unit testing framework to
FileCheck-based tests, printing them to the standard output and using FileCheck
to test the output. Tests that check the API proper (e.g. that SDBM
expressions have a specific subtype) and that rely on non-syntatic properties
(equality of the set of constraints) are not ported.
--
PiperOrigin-RevId: 249006055
Originally, ExecutionEngine was created before MLIR had a proper pass
management infrastructure or an LLVM IR dialect (using the LLVM target
directly). It has been running a bunch of lowering passes to convert the input
IR from Standard+Affine dialects to LLVM IR and, later, to the LLVM IR dialect.
This is no longer necessary and is even undesirable for compilation flows that
perform their own conversion to the LLVM IR dialect. Drop this integration and
make ExecutionEngine accept only the LLVM IR dialect. Users of the
ExecutionEngine can call the relevant passes themselves.
--
PiperOrigin-RevId: 249004676
The converter now works by inserting fake producer operations when replacing the results of an existing operation with values of a different, now legal, type. These fake operations are guaranteed to never escape the converter.
--
PiperOrigin-RevId: 248969130
The current implementation makes some assumptions about what can be a shaped type, which aren't really necessary. It also has strange behavior for types that aren't in the limited set it handles (e.g. dialect-defined types)
Updated the comment to match the implementation.
This is partially motivated by the desire to make MemRef a subclass of ShapedType
--
PiperOrigin-RevId: 248859674
There was a weird mix of names, styles, and inheritance here. I think this makes it cleaner and more consistent. We can also have a more principled and far-reaching refactor of some of this naming, but this seems like a good improvement regardless
--
PiperOrigin-RevId: 248827005