platform/upstream/llvm.git
5 years ago Unify the 'constantFold' and 'fold' hooks on an operation into just 'fold'. This...
River Riddle [Thu, 16 May 2019 19:51:45 +0000 (12:51 -0700)]
Unify the 'constantFold' and 'fold' hooks on an operation into just 'fold'. This new unified fold hook will take constant attributes as operands, and may return an existing 'Value *' or a constant 'Attribute' when folding. This removes the awkward situation where a simple canonicalization like "sub(x,x)->0" had to be written as a canonicalization pattern as opposed to a fold.

--

PiperOrigin-RevId: 248582024

5 years ago Add linalg.range_intersect conversion to LLVM.
Nicolas Vasilache [Thu, 16 May 2019 18:57:36 +0000 (11:57 -0700)]
Add linalg.range_intersect conversion to LLVM.

    This CL adds lowering for linalg.range_intersect into LLVM by computing:
      * new_min <- max (range1.min, range2.min)
      * new_max <- min (range1.max, range2.max)
      * new_step <- range1.step * range2.step

--

PiperOrigin-RevId: 248571810

5 years ago Add a linalg.range_intersect op.
Nicolas Vasilache [Thu, 16 May 2019 15:15:10 +0000 (08:15 -0700)]
Add a linalg.range_intersect op.

    This CL adds an operation whose purpose is to encode boundary conditions directly in the view type. In particular, full/partial tile distinction can
    occur at the level of metadata only.
    This CL also adopts a Linalg_Op pattern that is similar to Std_Op.

--

PiperOrigin-RevId: 248529469

5 years ago Rename VectorOrTensorType to ShapedType
Geoffrey Martin-Noble [Thu, 16 May 2019 07:12:45 +0000 (00:12 -0700)]
Rename VectorOrTensorType to ShapedType

    This is in preparation for making it also support/be a parent class of MemRefType. MemRefs have similar shape/rank/element semantics and it would be useful to be able to use these same utilities for them.

    This CL should not change any semantics and only change variables, types, string literals, and comments. In follow-up CLs I will prepare all callers to handle MemRef types or remove their dependence on ShapedType.

    Discussion/Rationale in https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/cHLoyfGu8y8

--

PiperOrigin-RevId: 248476449

5 years ago Store the child function analysis maps of a ModuleAnalysisManager by unique_ptr...
River Riddle [Thu, 16 May 2019 03:20:11 +0000 (20:20 -0700)]
Store the child function analysis maps of a ModuleAnalysisManager by unique_ptr instead of by-value.

--

PiperOrigin-RevId: 248456926

5 years ago Add a new tutorial document that details how to define Dialect Attributes and...
River Riddle [Wed, 15 May 2019 22:24:20 +0000 (15:24 -0700)]
Add a new tutorial document that details how to define Dialect Attributes and Types.

--

PiperOrigin-RevId: 248417063

5 years ago Upstreaming Quantizer tool (part 2).
Stella Laurenzo [Wed, 15 May 2019 22:04:20 +0000 (15:04 -0700)]
Upstreaming Quantizer tool (part 2).

    This adds some additional core types and utilities, notably the constraint analysis graph (CAG) structures, associated metadata and configuration policy object base class.

    The CAG is not particularly memory efficient as it stands now. I had started some work to turn it into a form that could be better managed by a bump pointer allocator but abandoned that for now in favor of having something that does semantically what I was going for as a starting point.

--

PiperOrigin-RevId: 248413133

5 years ago Fixed Attributes.h comment typo from vecctor to vector
Rob Suderman [Wed, 15 May 2019 18:18:18 +0000 (11:18 -0700)]
Fixed Attributes.h comment typo from vecctor to vector

--

PiperOrigin-RevId: 248369005

5 years ago Cleanup linalg integration test
Nicolas Vasilache [Wed, 15 May 2019 16:26:27 +0000 (09:26 -0700)]
Cleanup linalg integration test

    This CL performs post-commit cleanups.
    It adds the ability to specify which shared libraries to load dynamically in ExecutionEngine. The linalg integration test is updated to use a shared library.
    Additional minor cleanups related to LLVM lowering of Linalg are also included.

--

PiperOrigin-RevId: 248346589

5 years ago Add support for parsing/printing dialect defined attributes. This also adds suppo...
River Riddle [Wed, 15 May 2019 16:10:52 +0000 (09:10 -0700)]
Add support for parsing/printing dialect defined attributes. This also adds support for a pretty syntax for dialects attributes that is synonymous with the pretty syntax for dialect types. This cl also adds a new attribute 'OpaqueAttr' that allows for roundtripping attributes attached to unregistered dialects.

    Dialect attributes have the following syntax:
       dialect-attribute  ::= `#` dialect-namespace `<` `"` attr-data `"` `>`
       dialect-attribute  ::= `#` alias-name pretty-dialect-sym-body?

--

PiperOrigin-RevId: 248344416

5 years ago Remove some extraneous const qualifiers on Type, and 0b1 -> 1 in tblgen files...
Chris Lattner [Wed, 15 May 2019 14:54:28 +0000 (07:54 -0700)]
Remove some extraneous const qualifiers on Type, and 0b1 -> 1 in tblgen files. (NFC)

--

PiperOrigin-RevId: 248332674

5 years ago Make Linalg tiling a FunctionPass instead of a ModulePass - NFC
Nicolas Vasilache [Wed, 15 May 2019 07:53:01 +0000 (00:53 -0700)]
Make Linalg tiling a FunctionPass instead of a ModulePass - NFC

--

PiperOrigin-RevId: 248286354

5 years ago Add a new document detailing the diagnostics infrastructure.
River Riddle [Wed, 15 May 2019 06:01:35 +0000 (23:01 -0700)]
Add a new document detailing the diagnostics infrastructure.

--

PiperOrigin-RevId: 248275851

5 years ago Start to introduce the "Quantizer" tool, which is responsible for transforming...
Stella Laurenzo [Wed, 15 May 2019 02:50:24 +0000 (19:50 -0700)]
Start to introduce the "Quantizer" tool, which is responsible for transforming a computation expressed in floating point to one operating in terms of quantized types (where possible), either using quant-aware-training hints where available or post-training statistics.

    This is being integrated from an experimental side repository piece by piece over the course of several patches and will ultimately include full build support, documentation and e2e tests.

--

PiperOrigin-RevId: 248259895

5 years ago Add support for a Linalg base op class
Nicolas Vasilache [Wed, 15 May 2019 02:37:48 +0000 (19:37 -0700)]
Add support for a Linalg base op class

    This CL uses a pattern proposed by aminim@ to add a base Linalg op that further dispatches to the proper op implementation.
    This CL adds a LinalgOp which implements isclassof for only a subset of the linalg ops: the ops that behave like a library call for the purpose of transformations like tiling.
    This uses a static dispatch mechanism based on the LinalgLibraryOps.td ops declarations to avoid switch or visitor patterns. This may later be replaced by Tablegen'd dispatch when it is available.

    As a consequence, the list of library like operations in Linalg may now grow without having to modify any of the dispatch or transformation support.

    More details in the concept-based dispatch, as explained by aminim@
    ```
    This is inspired by Sean Parent's: https://sean-parent.stlab.cc/papers-and-presentations/#value-semantics-and-concept-based-polymorphism

    A key difference is that the set of classes erased is statically known, which avoids to use dynamic memory allocation.
    We use a zero-sized templated class to emit the virtual table and generate a singleton object for each instantiation of this class. We pay the cost of initialization once on construction (find which class to dispatch to) and then a virtual dispatch on every call.
    ```

--

PiperOrigin-RevId: 248258921

5 years ago Remove unnecessary C++ specifier in CPP files. NFC.
Jacques Pienaar [Tue, 14 May 2019 22:03:48 +0000 (15:03 -0700)]
Remove unnecessary C++ specifier in CPP files. NFC.

    These are only required in .h files to disambiguate between C and C++ header files.

--

PiperOrigin-RevId: 248219135

5 years ago Add an AffineExpr matcher
Nicolas Vasilache [Tue, 14 May 2019 19:21:42 +0000 (12:21 -0700)]
Add an AffineExpr matcher

    This CL gives a pattern-matching-y look and feel to AffineExpr.
    For now this uses a shared_ptr instead of unique'ing into a bumpPtrAllocator.
    SDBM gives a simple use case with more idiomatic syntax for matchers.

--

PiperOrigin-RevId: 248188075

5 years ago Move Quantization -> Dialect/QuantOps, FxpMathOps -> Dialect/FxpMathOps.
Stella Laurenzo [Tue, 14 May 2019 18:03:55 +0000 (11:03 -0700)]
Move Quantization -> Dialect/QuantOps, FxpMathOps -> Dialect/FxpMathOps.

    Adding the additional layer of directory was discussed offline and matches the Target/ tree. The names match the defacto convention we seem to be following where the C++ namespace is ^(.+)Ops/$ matched against the directory name.

    This is in preparation for patching the Quantizer into this tree, which would have been confusing without moving the Quantization dialect to its more proper home. It is left to others to move other dialects if desired.

    Tested:
      ninja check-mlir

--

PiperOrigin-RevId: 248171982

5 years ago When converting a location to an SMLoc, advance to the first non-whitespace if...
River Riddle [Tue, 14 May 2019 16:29:30 +0000 (09:29 -0700)]
When converting a location to an SMLoc, advance to the first non-whitespace if the column is unknown(zero). This also fixes a small bug with call stack printing.

    Example:
    /tmp/file_C.py:21:5: error: 'foo.bar' op attribute 'something'
        raise app.UsageError('Too many command-line arguments.')
        ^
    /tmp/file_D.py:20:3: note: called from
      if len(argv) > 1:
      ^
    /tmp/file_E.py:19:1: note: called from
    def main(argv):
    ^
    /tmp/file_F.py:24:3: note: called from
      app.run(main)
      ^

--

PiperOrigin-RevId: 248151212

5 years ago [ODS] Add definition for TypeAttr
Lei Zhang [Tue, 14 May 2019 16:08:41 +0000 (09:08 -0700)]
[ODS] Add definition for TypeAttr

--

PiperOrigin-RevId: 248147938

5 years ago Move specification of print, parse and verify to Std_Op base.
Jacques Pienaar [Tue, 14 May 2019 15:27:32 +0000 (08:27 -0700)]
Move specification of print, parse and verify to Std_Op base.

    Removes some boilerplate in ops, add support to refer to C++ class name from parser function specification in ODS.

--

PiperOrigin-RevId: 248140977

5 years ago Add initial support to the SourceMgrDiagnosticHandler for printing call stacks.
River Riddle [Tue, 14 May 2019 05:24:48 +0000 (22:24 -0700)]
Add initial support to the SourceMgrDiagnosticHandler for printing call stacks.

    Example:

    /tmp/file_C.py:17:1: error: 'foo.bar' op attribute 'something' ...
      app.run(main)
    ^
    /tmp/file_D.py:14:1: note: called from
        raise app.UsageError('Too many command-line arguments.')
    ^
    /tmp/file_E.py:12:1: note: called from
    def main(argv):
    ^
    /tmp/file_F.py:13:1: note: called from
      if len(argv) > 1:
    ^

--

PiperOrigin-RevId: 248074804

5 years ago Fix lingering sign compare warnings in exposed by "ninja check-mlir".
Stella Laurenzo [Tue, 14 May 2019 01:10:48 +0000 (18:10 -0700)]
Fix lingering sign compare warnings in exposed by "ninja check-mlir".

--

PiperOrigin-RevId: 248050178

5 years ago Add a linalg.dim
Nicolas Vasilache [Mon, 13 May 2019 21:59:55 +0000 (14:59 -0700)]
Add a linalg.dim

    A linalg.dim operation is used to extract size information from !linalg.view objects passed
    through function call boundaries.

--

PiperOrigin-RevId: 248017488

5 years ago Refactor NameLoc so that it also holds a child location. This removes the awkward...
River Riddle [Mon, 13 May 2019 21:45:48 +0000 (14:45 -0700)]
Refactor NameLoc so that it also holds a child location. This removes the awkward use of CallSiteLoc as a variable usage location.

--

PiperOrigin-RevId: 248014642

5 years ago Update "Table-driven Op Definition Specification" doc
Lei Zhang [Mon, 13 May 2019 21:39:27 +0000 (14:39 -0700)]
Update "Table-driven Op Definition Specification" doc

    This CL turns the previous "Op Definition" doc into a manual for table-driven
    op definition specification by fleshing out more details of existing mechanisms.

--

PiperOrigin-RevId: 248013274

5 years ago Fix -Wsign-compare in Toy LateLowering.
Jacques Pienaar [Mon, 13 May 2019 21:04:17 +0000 (14:04 -0700)]
Fix -Wsign-compare in Toy LateLowering.

--

PiperOrigin-RevId: 248005642

5 years ago Remove unused function and avoid unused variable warning. NFC.
Jacques Pienaar [Mon, 13 May 2019 19:49:40 +0000 (12:49 -0700)]
Remove unused function and avoid unused variable warning. NFC.

--

PiperOrigin-RevId: 247991231

5 years ago Add a utility method to MLIRContext get a registered dialect with the derived...
River Riddle [Mon, 13 May 2019 19:42:25 +0000 (12:42 -0700)]
Add a utility method to MLIRContext get a registered dialect with the derived type instead of the string name. The derived dialect type must provide a static 'getDialectNamespace' method.

    This means that we can now do something like:
      ctx->getRegisteredDialect<LLVMDialect>();

    as opposed to:
      static_cast<LLVMDialect *>(ctx->getRegisteredDialect("llvm");

--

PiperOrigin-RevId: 247989896

5 years ago Use the DialectSymbolRegistry to reserve space in the Attribute::Kind enum to...
River Riddle [Mon, 13 May 2019 19:34:42 +0000 (12:34 -0700)]
Use the DialectSymbolRegistry to reserve space in the Attribute::Kind enum to allow for dialects to define attribute kinds. The currently defined attributes kinds have now been moved to StandardAttributes.

--

PiperOrigin-RevId: 247988373

5 years ago Move MemRefCastOp and TensorCastOp to the Op Definition Generation framework.
River Riddle [Mon, 13 May 2019 18:56:21 +0000 (11:56 -0700)]
Move MemRefCastOp and TensorCastOp to the Op Definition Generation framework.

--

PiperOrigin-RevId: 247981385

5 years ago Move the definition of Return op to the Op Definition Generation framework.
River Riddle [Mon, 13 May 2019 18:53:14 +0000 (11:53 -0700)]
Move the definition of Return op to the Op Definition Generation framework.

--

PiperOrigin-RevId: 247980849

5 years ago NFC: Cleanup the definitions of the Location classes.
River Riddle [Mon, 13 May 2019 18:44:24 +0000 (11:44 -0700)]
NFC: Cleanup the definitions of the Location classes.

--

PiperOrigin-RevId: 247979132

5 years ago Change a few errors emitted by the parser to be notes instead.
River Riddle [Mon, 13 May 2019 18:43:17 +0000 (11:43 -0700)]
Change a few errors emitted by the parser to be notes instead.

--

PiperOrigin-RevId: 247978922

5 years ago Move Affine Expressions and Affine Structures documentation from LangRef to Affin...
Andy Davis [Mon, 13 May 2019 18:05:59 +0000 (11:05 -0700)]
Move Affine Expressions and Affine Structures documentation from LangRef to Affine Dialect doc.

--

PiperOrigin-RevId: 247971222

5 years ago Pipe Linalg to a cblas call via mlir-cpu-runner
Nicolas Vasilache [Mon, 13 May 2019 17:59:04 +0000 (10:59 -0700)]
Pipe Linalg to a cblas call via mlir-cpu-runner

    This CL extends the execution engine to allow the additional resolution of symbols names
    that have been registered explicitly. This allows linking static library symbols that have not been explicitly exported with the -rdynamic linking flag (which is deemed too intrusive).

--

PiperOrigin-RevId: 247969504

5 years ago Add test for affine-loop-tile pass with a loop of trip count 1
Tamas Berghammer [Mon, 13 May 2019 16:29:53 +0000 (09:29 -0700)]
Add test for affine-loop-tile pass with a loop of trip count 1

--

PiperOrigin-RevId: 247950156

5 years ago Update cmakelist to reflect renamed filename.
Jacques Pienaar [Mon, 13 May 2019 16:09:00 +0000 (09:09 -0700)]
Update cmakelist to reflect renamed filename.

--

PiperOrigin-RevId: 247946677

5 years ago Refactor the includes of Function.h now that the dependency on Operation has...
River Riddle [Mon, 13 May 2019 16:00:22 +0000 (09:00 -0700)]
Refactor the includes of Function.h now that the dependency on Operation has been removed. The dependency was on the op casting methods, which have now moved out of Operation, used by the walker.

--

PiperOrigin-RevId: 247944666

5 years ago Update region documentation
Alex Zinenko [Mon, 13 May 2019 15:51:34 +0000 (08:51 -0700)]
Update region documentation

    Restructure the Regions section in LangRef to avoid having a wall of text and
    reflect a recent evolution of the design.  Unspecify region types, that are put
    on hold until use cases arise.

    Update the Rationale doc with a list of design decisions related to regions.
    Separately list the design alternatives that were considered and discarded due
    to the lack of existing use cases.

--

PiperOrigin-RevId: 247943144

5 years ago Factor out loop interchange code from LoopFusion into LoopUtils (NFC).
Andy Davis [Mon, 13 May 2019 13:57:56 +0000 (06:57 -0700)]
Factor out loop interchange code from LoopFusion into LoopUtils (NFC).

--

PiperOrigin-RevId: 247926512

5 years ago Remove the explicit "friend Operation" statement from each of the derived operati...
River Riddle [Sun, 12 May 2019 02:51:16 +0000 (19:51 -0700)]
Remove the explicit "friend Operation" statement from each of the derived operations now that op casting is no longer inside of Operation.

--

PiperOrigin-RevId: 247791672

5 years ago Replace Operation::isa with llvm::isa.
River Riddle [Sun, 12 May 2019 01:59:54 +0000 (18:59 -0700)]
Replace Operation::isa with llvm::isa.

--

PiperOrigin-RevId: 247789235

5 years ago Replace Operation::cast with llvm::cast.
River Riddle [Sun, 12 May 2019 00:57:32 +0000 (17:57 -0700)]
Replace Operation::cast with llvm::cast.

--

PiperOrigin-RevId: 247785983

5 years ago Add support for using llvm::dyn_cast/cast/isa for operation casts and replace...
River Riddle [Sat, 11 May 2019 22:56:50 +0000 (15:56 -0700)]
Add support for using llvm::dyn_cast/cast/isa for operation casts and replace usages of Operation::dyn_cast with llvm::dyn_cast.

--

PiperOrigin-RevId: 247780086

5 years ago Automated rollback of changelist 247778391.
MLIR Team [Sat, 11 May 2019 22:24:47 +0000 (15:24 -0700)]
Automated rollback of changelist 247778391.

PiperOrigin-RevId: 247778691

5 years ago Add support for using llvm::dyn_cast/cast/isa for operation casts and replace...
River Riddle [Sat, 11 May 2019 22:17:28 +0000 (15:17 -0700)]
Add support for using llvm::dyn_cast/cast/isa for operation casts and replace usages of Operation::dyn_cast with llvm::dyn_cast.

--

PiperOrigin-RevId: 247778391

5 years ago Rename Op::isClassFor to Op::classof to match the LLVM isa/dyn_cast standard...
River Riddle [Sat, 11 May 2019 19:45:35 +0000 (12:45 -0700)]
Rename Op::isClassFor to Op::classof to match the LLVM isa/dyn_cast standard naming scheme.

--

PiperOrigin-RevId: 247771192

5 years ago Remove several heavy includes from Diagnostics.h by a moving a couple of fields...
River Riddle [Sat, 11 May 2019 18:59:01 +0000 (11:59 -0700)]
Remove several heavy includes from Diagnostics.h by a moving a couple of fields/methods to the .cpp file.

--

PiperOrigin-RevId: 247768443

5 years ago rename -memref-dependence-check to -test-memref-dependence-check since it
Chris Lattner [Sat, 11 May 2019 18:50:29 +0000 (11:50 -0700)]
rename -memref-dependence-check to -test-memref-dependence-check since it
    generates remarks for testing, it isn't itself a transformation.

    While there, upgrade its diagnostic emission to use the streaming interface.

    Prune some unnecessary #includes.

--

PiperOrigin-RevId: 247768062

5 years ago Remove some unnecessary or duplicated header includes from IR/.
River Riddle [Sat, 11 May 2019 16:53:26 +0000 (09:53 -0700)]
Remove some unnecessary or duplicated header includes from IR/.

--

PiperOrigin-RevId: 247762545

5 years ago Cleanups and simplifications to code, noticed by inspection. NFC.
Chris Lattner [Sat, 11 May 2019 15:28:15 +0000 (08:28 -0700)]
Cleanups and simplifications to code, noticed by inspection. NFC.

--

PiperOrigin-RevId: 247758075

5 years agoRevert "Pass for outlining gpu.launch operation bodies into kernel functions called...
Mehdi Amini [Sat, 11 May 2019 02:21:21 +0000 (19:21 -0700)]
Revert "Pass for outlining gpu.launch operation bodies into kernel functions called by gpu.launch_func operations"

OSS build was broken (missing CMakeLists.txt changes and compilation failures on Ubuntu)

Automated rollback of changelist 247564213.

PiperOrigin-RevId: 247713812

5 years ago Change the diagnostic handler to accept Diagnostic instead of location/message...
River Riddle [Sat, 11 May 2019 00:47:32 +0000 (17:47 -0700)]
Change the diagnostic handler to accept Diagnostic instead of location/message/kind. This opens the door for many more powerful use cases: fixits, colors, etc.

--

PiperOrigin-RevId: 247705673

5 years ago [TableGen] Return base attribute's name for anonymous OptionalAttr/DefaultValuedAttr
Lei Zhang [Fri, 10 May 2019 23:11:02 +0000 (16:11 -0700)]
[TableGen] Return base attribute's name for anonymous OptionalAttr/DefaultValuedAttr

--

PiperOrigin-RevId: 247693280

5 years ago Move the definitions for CallOp and IndirectCallOp to the Op Definition Generator.
River Riddle [Fri, 10 May 2019 22:27:34 +0000 (15:27 -0700)]
Move the definitions for CallOp and IndirectCallOp to the Op Definition Generator.

--

PiperOrigin-RevId: 247686419

5 years ago Move the definitions of BranchOp, DimOp, and ExtractElementOp to Op Definition...
River Riddle [Fri, 10 May 2019 22:26:23 +0000 (15:26 -0700)]
Move the definitions of BranchOp, DimOp, and ExtractElementOp to Op Definition Generator.

--

PiperOrigin-RevId: 247686212

5 years ago Ensure that all attributes are registered with a dialect. This is one of the...
River Riddle [Fri, 10 May 2019 22:14:13 +0000 (15:14 -0700)]
Ensure that all attributes are registered with a dialect. This is one of the final steps towards allowing dialects to define their own attributes, but there are still several things missing before this is fully supported(e.g. parsing/printing ).

--

PiperOrigin-RevId: 247684322

5 years ago Add support to the SourceMgrDiagnosticHandlers to auto-load new source files...
River Riddle [Fri, 10 May 2019 22:00:53 +0000 (15:00 -0700)]
Add support to the SourceMgrDiagnosticHandlers to auto-load new source files seen in diagnostics.

--

PiperOrigin-RevId: 247681779

5 years ago Add llvm_unreachable in unreachable path to silence GCC warning (NFC)
Mehdi Amini [Fri, 10 May 2019 21:06:10 +0000 (14:06 -0700)]
Add llvm_unreachable in unreachable path to silence GCC warning (NFC)

    The switch is supposed to be fully covered, but GCC warns that:
     "control reaches end of non-void function"

--

PiperOrigin-RevId: 247672430

5 years ago Fix unused variable warning in the Toy tutorial (NFC)
Mehdi Amini [Fri, 10 May 2019 21:05:53 +0000 (14:05 -0700)]
Fix unused variable warning in the Toy tutorial (NFC)

--

PiperOrigin-RevId: 247672377

5 years ago Remove unused method `parseIntegerSetInline` and `parseAffineMapInline` in Parser...
Mehdi Amini [Fri, 10 May 2019 21:05:34 +0000 (14:05 -0700)]
Remove unused method `parseIntegerSetInline` and `parseAffineMapInline` in Parser (NFC)

    Fix GCC warning.

--

PiperOrigin-RevId: 247672318

5 years ago Remove unused `signature()` from `OpMethod` class (private to mlir-tblgen) (NFC)
Mehdi Amini [Fri, 10 May 2019 21:05:17 +0000 (14:05 -0700)]
Remove unused `signature()` from `OpMethod` class (private to mlir-tblgen) (NFC)

--

PiperOrigin-RevId: 247672280

5 years ago Use `uint8_t` storage for enum class
Mehdi Amini [Fri, 10 May 2019 21:04:58 +0000 (14:04 -0700)]
Use `uint8_t` storage for enum class

    This is intended to fix a GCC warning:

    > mlir/lib/IR/LocationDetail.h:32:25: warning: ‘mlir::detail::LocationStorage::kind’ is too small to hold all values of ‘enum class mlir::Location::Kind’

--

PiperOrigin-RevId: 247672213

5 years ago Remove extra `;` after function definition (NFC)
Mehdi Amini [Fri, 10 May 2019 20:54:11 +0000 (13:54 -0700)]
Remove extra `;` after function definition (NFC)

    Fix a GCC warning

--

PiperOrigin-RevId: 247670176

5 years ago Replace dyn_cast<> with isa<> when the returned value is unused (NFC)
Mehdi Amini [Fri, 10 May 2019 20:49:22 +0000 (13:49 -0700)]
Replace dyn_cast<> with isa<> when the returned value is unused (NFC)

    Fix a gcc warning.

--

PiperOrigin-RevId: 247669360

5 years ago Refactor the SourceMgrDiagnosticHandlers to support more locations than FileLineC...
River Riddle [Fri, 10 May 2019 20:10:08 +0000 (13:10 -0700)]
Refactor the SourceMgrDiagnosticHandlers to support more locations than FileLineColLoc.

--

PiperOrigin-RevId: 247662828

5 years ago Remove unused Vectorize constructor (NFC)
Mehdi Amini [Fri, 10 May 2019 18:33:21 +0000 (11:33 -0700)]
Remove unused Vectorize constructor (NFC)

    Fix gcc warning.

--

PiperOrigin-RevId: 247647114

5 years ago Remove unused `hasSingleNonZeroAt` function (NFC)
Mehdi Amini [Fri, 10 May 2019 16:29:20 +0000 (09:29 -0700)]
Remove unused `hasSingleNonZeroAt` function (NFC)

    Fix clang warning.

--

PiperOrigin-RevId: 247623306

5 years ago Make header-defined function inline instead of static (NFC)
Mehdi Amini [Fri, 10 May 2019 16:21:37 +0000 (09:21 -0700)]
Make header-defined function inline instead of static (NFC)

    Fix warning for unused function when the header is included in
    an implementation file that does not use this function.

--

PiperOrigin-RevId: 247622232

5 years ago Templatize the integer constructors for DiagnosticArgument to avoid ambiguous...
River Riddle [Fri, 10 May 2019 16:12:44 +0000 (09:12 -0700)]
Templatize the integer constructors for DiagnosticArgument to avoid ambiguous conversions.

--

PiperOrigin-RevId: 247621058

5 years ago Emit cast instead of dyn_cast_or_null where attribute is required.
Jacques Pienaar [Fri, 10 May 2019 15:51:34 +0000 (08:51 -0700)]
Emit cast instead of dyn_cast_or_null where attribute is required.

    If the attribute needs to exist for the validity of the op, then no need to use
    dyn_cast_or_null as the op would be invalid in the cases where cast fails, so
    just use cast.

--

PiperOrigin-RevId: 247617696

5 years ago Reorder edsc python tests - NFC
Nicolas Vasilache [Fri, 10 May 2019 14:51:07 +0000 (07:51 -0700)]
Reorder edsc python tests - NFC

    This CL orders the python tests to:
    1. allow introspecting on the EdscTest class and avoid the error-prone process of having to add the test call by hand;
    2. account for differences in the order of `dir(edscTest)` between python2, <= python3.5 and >= python 3.6

--

PiperOrigin-RevId: 247609687

5 years ago Add support to SourceMgrDiagnosticHandler for handling the case where the llvm...
River Riddle [Fri, 10 May 2019 14:13:03 +0000 (07:13 -0700)]
Add support to SourceMgrDiagnosticHandler for handling the case where the llvm::SourceMgr has no main file.

--

PiperOrigin-RevId: 247605584

5 years ago Verify that kernel functions referenced by gpu.launch_func have a gpu.kernel...
Thomas Joerg [Fri, 10 May 2019 12:32:57 +0000 (05:32 -0700)]
Verify that kernel functions referenced by gpu.launch_func have a gpu.kernel attribute.

    Also extract gpu.launch_func's function attribute name into a constant.

--

PiperOrigin-RevId: 247595352

5 years ago Annotate outlined kernel functions with the attribute `gpu.kernel`.
Thomas Joerg [Fri, 10 May 2019 11:26:58 +0000 (04:26 -0700)]
Annotate outlined kernel functions with the attribute `gpu.kernel`.

--

PiperOrigin-RevId: 247589560

5 years ago Add gpu.launch_func builder taking KernelDim3 arguments (NFC).
Thomas Joerg [Fri, 10 May 2019 09:23:18 +0000 (02:23 -0700)]
Add gpu.launch_func builder taking KernelDim3 arguments (NFC).

--

PiperOrigin-RevId: 247577649

5 years ago Pass for outlining gpu.launch operation bodies into kernel functions called by...
Thomas Joerg [Fri, 10 May 2019 07:18:10 +0000 (00:18 -0700)]
Pass for outlining gpu.launch operation bodies into kernel functions called by gpu.launch_func operations.

--

PiperOrigin-RevId: 247564213

5 years ago Remove unused PassID member from PassRegistry (NFC)
Mehdi Amini [Fri, 10 May 2019 06:08:13 +0000 (23:08 -0700)]
Remove unused PassID member from PassRegistry (NFC)

    Fix clang warning

--

PiperOrigin-RevId: 247558931

5 years ago Remove unused MLIRContext member from MutableAffineMap class (NFC)
Mehdi Amini [Fri, 10 May 2019 06:04:46 +0000 (23:04 -0700)]
Remove unused MLIRContext member from MutableAffineMap class (NFC)

    Fix clang warning

--

PiperOrigin-RevId: 247558650

5 years ago Make header-defined method inline instead of static (NFC)
Mehdi Amini [Fri, 10 May 2019 06:00:59 +0000 (23:00 -0700)]
Make header-defined method inline instead of static (NFC)

    This is fixing a clang warning when this header is included in a file
    that does not use this function.

--

PiperOrigin-RevId: 247557803

5 years ago Fix class/struct mismatch between declaration/definition (NFC)
Mehdi Amini [Fri, 10 May 2019 05:56:02 +0000 (22:56 -0700)]
Fix class/struct mismatch between declaration/definition (NFC)

    Fix clang warnings

--

PiperOrigin-RevId: 247557395

5 years ago Add override keyword on overidden virtual method (NFC)
Mehdi Amini [Fri, 10 May 2019 05:45:38 +0000 (22:45 -0700)]
Add override keyword on overidden virtual method (NFC)

    Fix clang warnings

--

PiperOrigin-RevId: 247556495

5 years ago Move the diagnostic verification functionality out of mlir-opt and into a new...
River Riddle [Thu, 9 May 2019 23:08:51 +0000 (16:08 -0700)]
Move the diagnostic verification functionality out of mlir-opt and into a new llvm::SourceMgr diagnostic handler 'SourceMgrDiagnosticVerifierHandler'. This will allow for other tools to reuse the 'expected-*' functionality.

--

PiperOrigin-RevId: 247514684

5 years ago Only forbid mixing tensor and vector when considering broadcasting behavior
Lei Zhang [Thu, 9 May 2019 20:35:43 +0000 (13:35 -0700)]
Only forbid mixing tensor and vector when considering broadcasting behavior

    The previous approach is too restrictive; we end up forbidding all dialect-specific
    types as element types. Changed to not consider element types entirely.

--

PiperOrigin-RevId: 247486537

5 years ago Add support in the SourceMgrDiagnosticHandler for handling source managers with...
River Riddle [Thu, 9 May 2019 20:13:40 +0000 (13:13 -0700)]
Add support in the SourceMgrDiagnosticHandler for handling source managers with multiple buffers.

--

PiperOrigin-RevId: 247482733

5 years ago Move edsc python tests to Filecheck
Nicolas Vasilache [Thu, 9 May 2019 19:54:43 +0000 (12:54 -0700)]
Move edsc python tests to Filecheck

--

PiperOrigin-RevId: 247479507

5 years ago Pipe Linalg to LLVM via mlir-cpu-runner
Nicolas Vasilache [Thu, 9 May 2019 19:34:04 +0000 (12:34 -0700)]
Pipe Linalg to LLVM via mlir-cpu-runner

    This CL adds support for functions in the Linalg dialect to run with mlir-cpu-runner.
    For this purpose, this CL adds BufferAllocOp, BufferDeallocOp, LoadOp and StoreOp to the Linalg dialect as well as their lowering to LLVM. To avoid collisions with mlir::LoadOp/StoreOp (which should really become mlir::affine::LoadOp/StoreOp), the mlir::linalg namespace is added.

    The execution uses a dummy linalg_dot function that just returns for now. In the future a proper library call will be used.

--

PiperOrigin-RevId: 247476061

5 years ago Fix OSS build (Linux)
Nicolas Vasilache [Thu, 9 May 2019 19:08:13 +0000 (12:08 -0700)]
Fix OSS build (Linux)

--

PiperOrigin-RevId: 247472005

5 years ago Update mlir::interleaveComma to work on ranges with types other than Container<T>.
River Riddle [Thu, 9 May 2019 18:48:06 +0000 (11:48 -0700)]
Update mlir::interleaveComma to work on ranges with types other than Container<T>.

--

PiperOrigin-RevId: 247468184

5 years ago Add memref dimension bounds as upper/lower bounds on MemRefRegion constraints...
Andy Davis [Thu, 9 May 2019 15:36:02 +0000 (08:36 -0700)]
Add memref dimension bounds as upper/lower bounds on MemRefRegion constraints, to guard against potential over-approximation from projection.

--

PiperOrigin-RevId: 247431201

5 years ago Fix bug in DmaGenerate pass where MemRefRegion union was not propagated to read...
Andy Davis [Thu, 9 May 2019 14:02:32 +0000 (07:02 -0700)]
Fix bug in DmaGenerate pass where MemRefRegion union was not propagated to read region.
    Also cleaned up dma-generate.mlir a bit.

--

PiperOrigin-RevId: 247417358

5 years ago Conversion to LLVM Dialect: integrate TypeConverter into LLVMLowering
Alex Zinenko [Thu, 9 May 2019 12:40:54 +0000 (05:40 -0700)]
Conversion to LLVM Dialect: integrate TypeConverter into LLVMLowering

    Historically, the conversion from standard and built-in types to the LLVM IR
    dialect types was performed by a dedicated class, TypeConverter.  This class
    served to contain references to the LLVM IR dialect and to the LLVM IR Module
    to allow querying the data layout.  Recently, the LLVMLowering class was
    introduced to make the conversion to the LLVM IR dialect extensible to other
    source dialects.  This class also includes the references to the LLVM IR
    dialect and module.  TypeConverter was extended with basic support for
    dialect-specific type conversion through callbacks.  This is not sufficient in
    cases where dialect-specific types appear inside other types, such as function
    or container types.

    Integrate TypeConverter into LLVMLowering.  Whenever a subtype needs to be
    converted during standard type conversion (e.g. an argument or a result of a
    FunctionType), the conversion will call to the virtual function
    `LLVMLowering::convertType`, which can be extended to support dialect-specific
    types.

    Provide a new LLVMOpConversion class that serves as a base class for all
    conversions to the LLVM IR dialect and gives them access to LLVMLowering for
    the purpose of type conversion.  Update Linalg to LLVM IR lowering to use this
    class.

--

PiperOrigin-RevId: 247407314

5 years ago Fix builder for LLVM::Alloca operation.
Stephan Herhut [Thu, 9 May 2019 11:59:42 +0000 (04:59 -0700)]
Fix builder for LLVM::Alloca operation.

--

PiperOrigin-RevId: 247402238

5 years ago Add gpu.launch_func builder.
Thomas Joerg [Thu, 9 May 2019 06:37:57 +0000 (23:37 -0700)]
Add gpu.launch_func builder.

--

PiperOrigin-RevId: 247364893

5 years ago Simplify the emission of a few op parser diagnostics. This also adds the ability...
River Riddle [Thu, 9 May 2019 05:42:58 +0000 (22:42 -0700)]
Simplify the emission of a few op parser diagnostics. This also adds the ability to stream an attribute into a Diagnostic.

--

PiperOrigin-RevId: 247359911

5 years ago Move the definitions of AllocOp and DeallocOp to tablegen.
River Riddle [Thu, 9 May 2019 05:38:01 +0000 (22:38 -0700)]
Move the definitions of AllocOp and DeallocOp to tablegen.

--

PiperOrigin-RevId: 247359472

5 years ago Add a utility diagnostic handler class, SourceMgrDiagnosticHandler, to interface...
River Riddle [Thu, 9 May 2019 05:28:47 +0000 (22:28 -0700)]
Add a utility diagnostic handler class, SourceMgrDiagnosticHandler, to interface with llvm::SourceMgr. This lowers the barrier of entry for tools to get rich diagnostic handling when using llvm::SourceMgr.

--

PiperOrigin-RevId: 247358610

5 years ago Add an AttrBase class to simplify defining derived Attributes. This class serves...
River Riddle [Thu, 9 May 2019 05:25:15 +0000 (22:25 -0700)]
Add an AttrBase class to simplify defining derived Attributes. This class serves the same purpose as TypeBase, and thus the duplicated functionality has been split into a new support class 'StorageUserBase'.

--

PiperOrigin-RevId: 247358373

5 years ago Rename DialectTypeRegistry to DialectSymbolRegistry in preparation for dialect...
River Riddle [Thu, 9 May 2019 05:16:30 +0000 (22:16 -0700)]
Rename DialectTypeRegistry to DialectSymbolRegistry in preparation for dialect defined attributes.

--

PiperOrigin-RevId: 247357665