Commit Graph

1476 Commits

Author SHA1 Message Date
Jacques Pienaar 2d79bcb7cd Simplify build instructions.
--

PiperOrigin-RevId: 244120877
2019-04-18 11:50:03 -07:00
Nicolas Vasilache 5b0c2420f7 Use proper C++ casts in Types.h
This CL reduces the amount of warning spew when compiling with CMake on Linux.

--

PiperOrigin-RevId: 244070668
2019-04-18 11:49:55 -07:00
Nicolas Vasilache cfdffd90a0 Use proper C++ casts in Location.h
This CL reduces the amount of warning spew when compiling with CMake on Linux.

--

PiperOrigin-RevId: 244070052
2019-04-18 11:49:47 -07:00
Amit Sabne 4aa9235ae0 Fix LLVM_DEBUG instances
--

PiperOrigin-RevId: 244058051
2019-04-18 11:49:39 -07:00
Amit Sabne 7905da656e Loop invariant code motion.
--

PiperOrigin-RevId: 244043679
2019-04-18 11:49:31 -07:00
Feng Liu c9f21cf355 Move QuantTypes out of QuantOps to match the file structures of other dialects
This CL also moved the UniformSupport.cpp and FakeQuantSupport.cpp into utils because they are not really the core of the IR.

--

PiperOrigin-RevId: 244001666
2019-04-18 11:49:22 -07:00
Stella Laurenzo a2e08eb384 Bring naming of some quant ops in alignment with docs and introduce a few necessary additional ops (stats_ref, stats, coupled_ref).
--

PiperOrigin-RevId: 243919195
2019-04-18 11:49:14 -07:00
MLIR Team ee7bdddfb3 Add NewLine for Attribute dump()
--

PiperOrigin-RevId: 243904869
2019-04-18 11:49:06 -07:00
Yanan Cao e01260bf75 Add DebugStringHelper, which makes it easier to get a string from a dump method
--

PiperOrigin-RevId: 243899072
2019-04-18 11:48:58 -07:00
Nicolas Vasilache 0fe2f009f2 Fix SliceAnalysis comment
The description of the backward slice analysis behavior describes what would happen when creating a backward slice from node 9, not 8.

--

PiperOrigin-RevId: 243876599
2019-04-18 11:48:50 -07:00
Lei Zhang b8dc04a005 [TableGen] Fix builder for ops with one variadic input and SameValueType
For ops with the SameValueType trait, we generate a builder without requiring
    result type; we get the result type from the operand. However, if the operand
    is variadic, we need to index into the first value in the pack.

--

PiperOrigin-RevId: 243866647
2019-04-18 11:48:42 -07:00
Jacques Pienaar 5d783ab3bd Abort via report_fatal_error if dialect has been registered.
Fixes test in opt mode.

    Closes: tensorflow/mlir#17.

--

PiperOrigin-RevId: 243711043
2019-04-18 11:48:33 -07:00
Geoffrey Martin-Noble 6288503975 TypedTuple: Add support for tuples with type constraints on the elements.
--

PiperOrigin-RevId: 243685631
2019-04-18 11:48:25 -07:00
Lei Zhang 8bb8351710 [TableGen] Fix support for ops whose names have a leading underscore
TensorFlow ops have the convention to use leading underscore to denote
    internal ops.

--

PiperOrigin-RevId: 243627723
2019-04-18 11:48:17 -07:00
Chris Lattner 09c053bfd0 Expand the pretty dialect type system to support arbitrary punctuation and
other characters within the <>'s now that we can.  This will allow quantized
    types to use the pretty syntax (among others) after a few changes.

--

PiperOrigin-RevId: 243521268
2019-04-18 11:48:09 -07:00
Smit Hinsu 074cb4292f Fix CHECK-EMPTY directives without trailing colon
There are no empty lines in output for three of these directives so removed
them and replaced the remaining one with 'CHECK-NOT:' as otherwise it is
failing with the following error.

error: found 'CHECK-EMPTY' without previous 'CHECK: line

TESTED = n/a
PiperOrigin-RevId: 243288605
2019-04-18 11:48:01 -07:00
Smit Hinsu 0047ef9765 NFC: Simplify named attribute in TableGen generators
Now, op attribute names don't have '.' in their names so the special handling for it
    can be removed. Attributes for functions still have dialect prefix with '.' as separator but TableGen does not deal with functions.

    TESTED with existing unit tests

--

PiperOrigin-RevId: 243287462
2019-04-18 11:47:52 -07:00
Lei Zhang 2dc6d205ac [TableGen] Allocate `Operator` object on heap in `RecordOperatorMap`
Iterators for a `llvm::DenseMap` can be invalidated when an insertion occurs.
    In Pattern's `collectBoundArguments()`, we recursively handle all nested DAG
    nodes and grow the the `RecordOperatorMap`, while retaining a reference.
    This can cause the reference to be invalid and the program to behave randomly.
    Allocate each `Operator` object specifically to solve this issue.

    Also, `llvm::DenseMap` is a great way to map pointers to pointers, or map
    other small types to each other. This avoids placing the `Operator` object
    directly into the map.

--

PiperOrigin-RevId: 243281486
2019-04-18 11:47:43 -07:00
Lei Zhang 138c972d11 [TableGen] Use `tgfmt` to format various predicates and rewrite rules
This CL changes various predicates and rewrite rules to use $-placeholders and
    `tgfmt` as the driver for substitution. This will make the predicates and rewrite
    rules more consistent regarding their arguments and more readable.

--

PiperOrigin-RevId: 243250739
2019-04-18 11:47:35 -07:00
Lei Zhang 48a6aa6c51 [TableGen] Better support for predicate and rewrite rule specification
Currently predicates are written with positional placeholders `{N}` and rely on
    `formatv` as the engine to do substitution. The problem with this approach is that
    the definitions of those positional placeholders are not consistent; they are
    entirely up to the defining predicate of question. For example, `{0}` in various
    attribute constraints is used to mean the attribute, while it is used to main the
    builder for certain attribute transformations. This can become very confusing.

    This CL introduces `tgfmt` as a new mechanism to better support for predicate and
    rewrite rule specification. Instead of entirely relying on positional placeholders,
    `tgfmt` support both positional and special placeholders. The former is used for
    DAG operands. The latter, including $_builder, $_op, $_self, are used as special
    "hooks" to entities in the context. With this, the predicate and rewrite rules
    specification can be more consistent is more readable.

--

PiperOrigin-RevId: 243249671
2019-04-18 11:47:27 -07:00
Chris Lattner 4d243f138a Update the Rationale's description about signed/unsigned and int/fp types to be more specific about the fact that this only refers to std operations. Move these sections closer together.
--

PiperOrigin-RevId: 243204948
2019-04-18 11:47:18 -07:00
Mehdi Amini e552a63aa1 Update documentation for the DialectOpconversion class: overriding `match()` is optional
Recently a default implementation for `match()` was provided (cl/242285885), but the class documentation wasn't updated appropriately.

--

PiperOrigin-RevId: 243128738
2019-04-18 11:47:10 -07:00
Lei Zhang 0836f670f1 Add missing dependencies for EDSC and linalg libraries
This solves the missing "mlir/StandardOps/Ops.h.inc" issue when building
    a fresh checkout on macOS.

--

PiperOrigin-RevId: 243120388
2019-04-11 12:35:29 -07:00
Geoffrey Martin-Noble fe59ba19af Add support for statically shaped and typed tensors
--

PiperOrigin-RevId: 242972594
2019-04-11 10:53:09 -07:00
Stella Laurenzo d468eaccfc Update custom rewrite example, which seems to have drifted a bit from the implementation.
PiperOrigin-RevId: 242968685
2019-04-11 10:53:01 -07:00
Stella Laurenzo b0055ab5c3 Update the FxpMathOps to better reflect what is needed to legalize from XLA.
--

PiperOrigin-RevId: 242919924
2019-04-11 10:52:51 -07:00
Lei Zhang dfcc02b111 [TableGen] Support naming rewrite rules
--

PiperOrigin-RevId: 242909061
2019-04-11 10:52:43 -07:00
Lei Zhang bdd56eca49 Remove checks guaranteed to be true by the type
This addresses the compiler wraning of "comparison of unsigned expression
    >= 0 is always true [-Wtype-limits]".

--

PiperOrigin-RevId: 242868703
2019-04-11 10:52:33 -07:00
Lei Zhang 2e7895d5f1 Add parentheses in various asserts to group predicates
This addresses the "suggest parentheses around ‘&&’ within ‘||’
    [-Wparentheses]" compiler warnings.

--

PiperOrigin-RevId: 242868670
2019-04-11 10:52:21 -07:00
Lei Zhang 9ec5fcf1fa Use hexadecimal constants instead of binary constants
This addresses the "binary constants are a C++14 feature or GCC
    extension" compiler warnings.

--

PiperOrigin-RevId: 242868639
2019-04-11 10:52:12 -07:00
Stephan Herhut d6037276af Add conversion of StandardOps and, or and xor to LLVM dialect.
--

PiperOrigin-RevId: 242831203
2019-04-11 10:52:02 -07:00
Andy Davis 44f6dffbf8 Factor code to compute dependence components out of loop fusion pass, and into a reusable utility function (NFC).
--

PiperOrigin-RevId: 242716259
2019-04-11 10:51:53 -07:00
Amit Sabne 70a416de14 Fix typos in LoopFusion
--

PiperOrigin-RevId: 242679298
2019-04-11 10:51:43 -07:00
Nicolas Vasilache dfd98764f7 Start a Linalg doc
--

PiperOrigin-RevId: 242622278
2019-04-11 10:51:34 -07:00
Mehdi Amini 6c6ed466a6 Expose `setupTargetTriple` as a public static method on ExecutionEngine
This allows client to be able to reuse the same logic to setup a module
    for the ExecutionEngine without instanciating one. One use case is running
    the optimization pipeline but not JIT-ing.

--

PiperOrigin-RevId: 242614380
2019-04-11 10:51:24 -07:00
Mehdi Amini c4dee61c0e Fix Toy cmake build: add missing includes
--

PiperOrigin-RevId: 242609231
2019-04-08 23:27:02 -07:00
Mehdi Amini c39592b09c Toy tutorial Chapter 5: Lowering to Linalg and LLVM
--

PiperOrigin-RevId: 242606796
2019-04-08 23:26:54 -07:00
Mehdi Amini a43f216fd5 Automated rollback of changelist 242546977.
PiperOrigin-RevId: 242604949
2019-04-08 23:26:46 -07:00
Mehdi Amini 6b18e34de4 Use c++14 for building with CMake
This is getting rid of some warnings, and C++14 is supposed to be
    the default soon anyway.

--

PiperOrigin-RevId: 242587219
2019-04-08 23:26:38 -07:00
Lei Zhang 04b6d2f3c1 [TableGen] Make sure op in pattern has the same number of arguments as definition
When an op in the source pattern specifies more arguments than its definition, we
    will have out-of-bound query for op arguments from the definition. That will cause
    crashes. This change fixes it.

--

PiperOrigin-RevId: 242548415
2019-04-08 19:17:56 -07:00
Nicolas Vasilache 1ee07e7fde De-templatize TensorContractionBase (Linalg example/tutorial)
TensorContractionBase has become too unwieldy with all the CRTP manipulation once less trivial transformations are implemented.
    This CL drops CRTP for inheritance and uses the same name comparison trick to figure out what to cast into.
    As a byproduct, all the -inl.h files disappear.
    To maintain the separation between directories, a LINALG_STEP variable is introduced

--

PiperOrigin-RevId: 242546977
2019-04-08 19:17:56 -07:00
Ashwin Murthy 70546104ff Add TabelGen support to logically AND a list of attribute constraints.
This is the AllOf version for AttrConstraint and allows specifying the combined constraint during pattern match.

--

PiperOrigin-RevId: 242540243
2019-04-08 19:17:56 -07:00
Nicolas Vasilache 046a993967 Add CMakeLists rules for Linalg
--

PiperOrigin-RevId: 242454319
2019-04-08 19:17:56 -07:00
Stephan Herhut af016ba7a4 Add xor bitwise operation to StandardOps.
This adds parsing, printing and some folding/canonicalization.

    Also extends rewriting of subi %0, %0 to handle vectors and tensors.

--

PiperOrigin-RevId: 242448164
2019-04-08 19:17:56 -07:00
Nicolas Vasilache ca89e7167d Fix build for the Linalg example dialect with MacOS
--

PiperOrigin-RevId: 242443831
2019-04-08 19:17:56 -07:00
Alex Zinenko adb0ca0732 Example Linalg3: manually register the Linalg dialect
This dialect does not have a global constructor and has to be registered
    manually in `main`.  Also fix the way it is exercised in the test.

--

PiperOrigin-RevId: 242434886
2019-04-08 19:17:56 -07:00
Alex Zinenko 8e193e617c Change initialization syntax for ScopedContext in examples
For some reason, the OSS build on macOS was not happy with the initialization
    syntax and was attempting to call a copy constructor.  Hotfix it to use a
    different syntax pending further investigation.

--

PiperOrigin-RevId: 242432634
2019-04-08 19:17:56 -07:00
Stephan Herhut a8a5c06961 Add and and or bitwise operations to StandardOps.
This adds parsing, printing and some folding/canonicalization.

--

PiperOrigin-RevId: 242409840
2019-04-08 19:17:50 -07:00
Mehdi Amini 89d5d36964 Fix bug in Toy tutorial where IR emission stopped after any `print`
--

PiperOrigin-RevId: 242407970
2019-04-08 18:54:25 -07:00
Mehdi Amini 7286d43920 Introduce std.varargs attribute to mark variadic arguments functions
This is only teaching the LLVM converter to propagate the attribute onto
    the function type. MLIR will not recognize this arguments, so it would only
    be useful when calling for example `printf` with the same arguments across
    a module. Since varargs is part of the ABI lowering, this is not NFC.

--

PiperOrigin-RevId: 242382427
2019-04-07 18:22:56 -07:00