platform/upstream/llvm.git
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

5 years ago Simplify the parser/printer of ConstantOp now that all attributes have types...
River Riddle [Wed, 8 May 2019 21:46:39 +0000 (14:46 -0700)]
Simplify the parser/printer of ConstantOp now that all attributes have types. This has the added benefit of removing type redundancy from the pretty form. As a consequence, IntegerAttr/FloatAttr will now always print the type even if it is i64/f64.

--

PiperOrigin-RevId: 247295828

5 years ago Add utility to accept any tensor type.
MLIR Team [Wed, 8 May 2019 19:18:19 +0000 (12:18 -0700)]
Add utility to accept any tensor type.

--

PiperOrigin-RevId: 247264423

5 years ago Verify that attribute type and constant op return type matches.
Jacques Pienaar [Wed, 8 May 2019 19:11:10 +0000 (12:11 -0700)]
Verify that attribute type and constant op return type matches.

--

PiperOrigin-RevId: 247263129

5 years ago Add support for using the new diagnostics infrastructure in the parser. This...
River Riddle [Wed, 8 May 2019 17:29:50 +0000 (10:29 -0700)]
Add support for using the new diagnostics infrastructure in the parser. This also adds support for streaming in ranges(e.g. ArrayRef) into a diagnostic with an optional element delimiter.

--

PiperOrigin-RevId: 247239436

5 years ago Add a new ClassID utility class that allows for generating unique identifiers...
River Riddle [Wed, 8 May 2019 17:23:10 +0000 (10:23 -0700)]
Add a new ClassID utility class that allows for generating unique identifiers for class types. This replaces the duplicated functionality of AnalysisID/PassID/etc.

--

PiperOrigin-RevId: 247237835

5 years ago Inline a string used in lambda function to fix capture error
Lei Zhang [Tue, 7 May 2019 21:03:15 +0000 (14:03 -0700)]
Inline a string used in lambda function to fix capture error

    The string was referenced but not captured in the lambda, which causes
    a failure when compiling with MSVC.

    This issue was discovered by @loic-joly-sonarsource with a proposed fix
    in https://github.com/tensorflow/mlir/pull/22.

--

PiperOrigin-RevId: 247085897

5 years ago Fix a few typos in the Toy tutorial documentation
Thomas Joerg [Tue, 7 May 2019 17:37:59 +0000 (10:37 -0700)]
Fix a few typos in the Toy tutorial documentation

--

PiperOrigin-RevId: 247047009

5 years ago Add operations to produce block/index ids and dimensions to the gpu dialect.
Thomas Joerg [Tue, 7 May 2019 08:27:54 +0000 (01:27 -0700)]
Add operations to produce block/index ids and dimensions to the gpu dialect.

--

PiperOrigin-RevId: 246976227

5 years ago NFC: Make ParseResult public and update the OpAsmParser(and thus all of the custo...
River Riddle [Tue, 7 May 2019 05:01:31 +0000 (22:01 -0700)]
NFC: Make ParseResult public and update the OpAsmParser(and thus all of the custom operation parsers) to use it instead of bool.

--

PiperOrigin-RevId: 246955523

5 years ago NFC: Convert the ParseResult enum into a simple struct wrapper around LogicalResu...
River Riddle [Tue, 7 May 2019 05:00:08 +0000 (22:00 -0700)]
NFC: Convert the ParseResult enum into a simple struct wrapper around LogicalResult. This allows for using the existing infrastructure for LogicalResult while retaining the ability to easily chain together parse rules. This will also simplify the transition of the parser to use the new diagnostics infrastructure.

--

PiperOrigin-RevId: 246955372

5 years ago Simplify the emission of various diagnostics created in Analysis/ and Transforms...
River Riddle [Tue, 7 May 2019 04:59:40 +0000 (21:59 -0700)]
Simplify the emission of various diagnostics created in Analysis/ and Transforms/ by using the new diagnostic infrastructure.

--

PiperOrigin-RevId: 246955332

5 years ago CmpFOp. Add float comparison op
Geoffrey Martin-Noble [Tue, 7 May 2019 00:51:08 +0000 (17:51 -0700)]
CmpFOp. Add float comparison op

    This closely mirrors the llvm fcmp instruction, defining 16 different predicates

    Constant folding is unsupported for NaN and Inf because there's no way to represent those as constants at the moment

--

PiperOrigin-RevId: 246932358

5 years ago Add split-input-file to constant fold test
Geoffrey Martin-Noble [Mon, 6 May 2019 21:43:45 +0000 (14:43 -0700)]
Add split-input-file to constant fold test

    Better to keep tests as separate as possible

--

PiperOrigin-RevId: 246900564

5 years ago Simplify several usages of attributes now that they always have a type and, trans...
River Riddle [Mon, 6 May 2019 19:40:43 +0000 (12:40 -0700)]
Simplify several usages of attributes now that they always have a type and, transitively, access to the context.

    This also fixes a bug where FunctionAttrs were not being remapped for function and function argument attributes.

--

PiperOrigin-RevId: 246876924

5 years ago Refactor the support for AffineMap and IntegerSet aliases in the parser into...
River Riddle [Mon, 6 May 2019 17:36:32 +0000 (10:36 -0700)]
Refactor the support for AffineMap and IntegerSet aliases in the parser into more general support for attribute aliases.

      `#` alias `=` attribute-value

    This also allows for dialects to define aliases for attributes in the AsmPrinter. The printer supports two types of attribute aliases, 'direct' and 'kind'.

    * Direct aliases are synonymous with the current support for type aliases, i.e. this maps an alias to a specific instance of an attribute.

    // A direct alias ("foo_str") for the string attribute "foo".
    #foo_str = "foo"

    * Kind aliases generates unique names for all instances of a given attribute kind. The generated aliases are of the form: `alias[0-9]+`.

    // A kind alias ("strattr") for all string attributes could generate.
    #strattr0 = "foo"
    #strattr1 = "bar"
    ...
    #strattrN = "baz"

--

PiperOrigin-RevId: 246851916

5 years ago Simplify the emission of various diagnostics emitted by the different dialects...
River Riddle [Mon, 6 May 2019 16:46:11 +0000 (09:46 -0700)]
Simplify the emission of various diagnostics emitted by the different dialects (Affine/Standard/etc.) by using the new stream interface instead of Twine.

--

PiperOrigin-RevId: 246842016

5 years ago Fix MacOS build: static constexpr must be defined
Mehdi Amini [Mon, 6 May 2019 15:05:09 +0000 (08:05 -0700)]
Fix MacOS build: static constexpr must be defined

    This can be removed in C++17.

--

PiperOrigin-RevId: 246827022

5 years ago Fix the indentation of CHECKs in test/GPU/ops.mlir.
MLIR Team [Mon, 6 May 2019 12:29:10 +0000 (05:29 -0700)]
Fix the indentation of CHECKs in test/GPU/ops.mlir.

--

PiperOrigin-RevId: 246809906

5 years ago Add the "gpu.launch_func" op to the GPU dialect.
MLIR Team [Mon, 6 May 2019 12:01:12 +0000 (05:01 -0700)]
Add the "gpu.launch_func" op to the GPU dialect.

    The idea is to lower `gpu.launch` operations into `gpu.launch_func` operations by outlining the kernel body into a function, which is closer to the NVVM model.

--

PiperOrigin-RevId: 246806890

5 years ago GPU dialect: introduce custom syntax for gpu.launch
Alex Zinenko [Mon, 6 May 2019 09:30:50 +0000 (02:30 -0700)]
GPU dialect: introduce custom syntax for gpu.launch

    This syntax removes boilerplate and verbose list of region arguments in the
    header of the entry block.  It groups operands into segments related to GPU
    blocks, GPU threads as well as the operands that are forwarded to the kernel.
    The two former segments are also used to give names to the region arguments
    that are used for GPU blocks and threads inside the kernel body region.

--

PiperOrigin-RevId: 246792329

5 years ago Change syntax of regions in the generic form of operations
Alex Zinenko [Mon, 6 May 2019 08:40:13 +0000 (01:40 -0700)]
Change syntax of regions in the generic form of operations

    The generic form of operations currently supports optional regions to be
    located after the operation type.  As we are going to add a type to each
    region in a leading position in the region syntax, similarly to functions, it
    becomes ambiguous to have regions immediately after the operation type.  Put
    regions between operands the optional list of successors in the generic
    operation syntax and wrap them in parentheses.  The effect on the exisitng IR
    syntax is minimal since only three operations (`affine.for`, `affine.if` and
    `gpu.kernel`) currently use regions.

--

PiperOrigin-RevId: 246787087

5 years ago Specify Regions in LangRef
Mehdi Amini [Mon, 6 May 2019 04:43:02 +0000 (21:43 -0700)]
Specify Regions in LangRef

    Region is the generalization of a function body (a list of blocks forming a CFG) to be allowed to be enclosed inside any operation. This nesting of IR is already leveraged in the affine dialect to support `affine.for`, `affine.if`, and `gpu.launch` operations.

--

PiperOrigin-RevId: 246766830

5 years ago Add a static utility to FloatAttr for converting an APFloat to double.
River Riddle [Sat, 4 May 2019 22:00:27 +0000 (15:00 -0700)]
Add a static utility to FloatAttr for converting an APFloat to double.

--

PiperOrigin-RevId: 246671765

5 years ago Remove redundant ;
Jacques Pienaar [Sat, 4 May 2019 19:22:30 +0000 (12:22 -0700)]
Remove redundant ;

--

PiperOrigin-RevId: 246664861

5 years ago Namespaceify a few explicit template specializations to appease errors caused...
River Riddle [Sat, 4 May 2019 19:13:41 +0000 (12:13 -0700)]
Namespaceify a few explicit template specializations to appease errors caused by a bug in gcc versions < 7.0.

    (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480)

--

PiperOrigin-RevId: 246664463

5 years ago Add SameOperandsAndResultElementType trait.
Jacques Pienaar [Sat, 4 May 2019 18:14:40 +0000 (11:14 -0700)]
Add SameOperandsAndResultElementType trait.

    This trait only works for tensor and vector types at the moment, verifying that the element type of an op with only tensor and vector types match. Added a unit test for it as there is no op currently in core that uses this trait.

--

PiperOrigin-RevId: 246661697

5 years ago Add explicit friendship with Operation to each derived op class to ensure access...
River Riddle [Sat, 4 May 2019 18:14:23 +0000 (11:14 -0700)]
Add explicit friendship with Operation to each derived op class to ensure access to the inherited protected constructor of `Op`. Some compiler versions have different rules for the visibility of inherited constructors.

--

PiperOrigin-RevId: 246661686

5 years ago [TableGen] Couple of small updates to OpBase
Ashwin Murthy [Sat, 4 May 2019 08:00:25 +0000 (01:00 -0700)]
[TableGen] Couple of small updates to OpBase

    Added a definition for the newly added None type.
    Fix TCopVTEtAreSameAt to be a Predicate rather than a PredOpTrait. This makes it more of a primitive and allows flexible composition.

--

PiperOrigin-RevId: 246631975

5 years ago Minor fixes (formatting/typos) to the DeveloperGuide
Mehdi Amini [Sat, 4 May 2019 04:38:39 +0000 (21:38 -0700)]
Minor fixes (formatting/typos) to the DeveloperGuide

--

PiperOrigin-RevId: 246621047

5 years ago Fix up some mixed sign warnings.
Jacques Pienaar [Sat, 4 May 2019 02:48:57 +0000 (19:48 -0700)]
Fix up some mixed sign warnings.

--

PiperOrigin-RevId: 246614498

5 years ago Automated rollback of changelist 246610168.
Mehdi Amini [Sat, 4 May 2019 01:46:24 +0000 (18:46 -0700)]
Automated rollback of changelist 246610168.

PiperOrigin-RevId: 246610394

5 years ago Add a section in the DeveloperGuide about avoiding unsigned integer
Mehdi Amini [Sat, 4 May 2019 01:43:55 +0000 (18:43 -0700)]
Add a section in the DeveloperGuide about avoiding unsigned integer

--

PiperOrigin-RevId: 246610168

5 years ago Add a section in the DeveloperGuide for the naming convention of command line...
Mehdi Amini [Sat, 4 May 2019 01:43:22 +0000 (18:43 -0700)]
Add a section in the DeveloperGuide for the naming convention of command line options

--

PiperOrigin-RevId: 246610123

5 years ago Remove erroneous cast.
Jacques Pienaar [Sat, 4 May 2019 00:07:02 +0000 (17:07 -0700)]
Remove erroneous cast.

--

PiperOrigin-RevId: 246600166

5 years ago Remove the ability to directly print affine structures from the OpAsmPrinter...
River Riddle [Fri, 3 May 2019 22:59:42 +0000 (15:59 -0700)]
Remove the ability to directly print affine structures from the OpAsmPrinter. These should go through attributes like most everything else.

--

PiperOrigin-RevId: 246589682

5 years ago Fix -Wmismatched-tags warning.
Jacques Pienaar [Fri, 3 May 2019 21:41:55 +0000 (14:41 -0700)]
Fix -Wmismatched-tags warning.

--

PiperOrigin-RevId: 246576348

5 years ago Make the Twine parameter of the current diagnostic emit functions optional. This...
River Riddle [Fri, 3 May 2019 18:40:57 +0000 (11:40 -0700)]
Make the Twine parameter of the current diagnostic emit functions optional. This allows for the ability to exclusively use the new diagnostic interface without breaking all of the existing usages. Several diagnostics emitted in lib/IR have been updated to make use of this functionality.

--

PiperOrigin-RevId: 246546044

5 years ago Add an MLIRContext::emitWarning utility method.
River Riddle [Fri, 3 May 2019 18:40:42 +0000 (11:40 -0700)]
Add an MLIRContext::emitWarning utility method.

--

PiperOrigin-RevId: 246546015

5 years ago Add the ability to attach notes to Diagnostic/InFlightDiagnostic.
River Riddle [Fri, 3 May 2019 18:40:22 +0000 (11:40 -0700)]
Add the ability to attach notes to Diagnostic/InFlightDiagnostic.

    Notes are a way to add additional context to a diagnostic, but don't really make sense as standalone diagnostics. Moving forward, notes will no longer be able to be constructed directly and must be attached to a parent Diagnostic.

    Notes can be attached via `attachNote`:

      auto diag = ...;
      diag.attachNote() << "This is a note";

--

PiperOrigin-RevId: 246545971

5 years ago Prepend an "affine-" prefix to Affine pass option names - NFC
Nicolas Vasilache [Fri, 3 May 2019 18:07:37 +0000 (11:07 -0700)]
Prepend an "affine-" prefix to Affine pass option names - NFC

    Trying to activate both LLVM and MLIR passes in mlir-cpu-runner showed name collisions when registering pass names.
    One possible way of disambiguating that should also work across dialects is to prepend the dialect name to the passes that specifically operate on that dialect.

    With this CL, mlir-cpu-runner tests still run when both LLVM and MLIR passes are registered

--

PiperOrigin-RevId: 246539917

5 years ago Introduce a new API for emitting diagnostics with Diagnostic and InFlightDiagnostic.
River Riddle [Fri, 3 May 2019 17:01:01 +0000 (10:01 -0700)]
Introduce a new API for emitting diagnostics with Diagnostic and InFlightDiagnostic.

    The Diagnostic class contains all of the information necessary to report a diagnostic to the DiagnosticEngine. It should generally not be constructed directly, and instead used transitively via InFlightDiagnostic. A diagnostic is currently comprised of several different elements:
    * A severity level.
    * A source Location.
    * A list of DiagnosticArguments that help compose and comprise the output message.
      * A DiagnosticArgument represents any value that may be part of the diagnostic, e.g. string, integer, Type, Attribute, etc.
      * Arguments can be added to the diagnostic via the stream(<<) operator.
    * (In a future cl) A list of attached notes.
      * These are in the form of other diagnostics that provide supplemental information to the main diagnostic, but do not have context on their own.

    The InFlightDiagnostic class represents an RAII wrapper around a Diagnostic that is set to be reported with the diagnostic engine. This allows for the user to modify a diagnostic that is inflight. The internally wrapped diagnostic can be reported directly or automatically upon destruction.

    These classes allow for more natural composition of diagnostics by removing the restriction that the message of a diagnostic is comprised of a single Twine. They should also allow for nice incremental improvements to the diagnostics experience in the future, e.g. formatv style diagnostics.

    Simple Example:

    emitError(loc, "integer bitwidth is limited to " + Twine(IntegerType::kMaxWidth) + " bits");
    emitError(loc) << "integer bitwidth is limited to " << IntegerType::kMaxWidth << " bits";

--

PiperOrigin-RevId: 246526439

5 years ago Accept additional conversions in the LLVM lowering
Alex Zinenko [Fri, 3 May 2019 12:31:55 +0000 (05:31 -0700)]
Accept additional conversions in the LLVM lowering

    Extend the LLVM lowering class following the original idea of the "bag of
    conversions".  LLVMLowering class is now exposed as and can be derived from.
    It provides hooks for derived classes to inject operation conversions and to
    convert custom types.  It is under responsibility of the caller to make sure
    patterns don't overlap.

    Update the lowering from the Linalg dialect to the LLVM IR dialect to use this
    new approach.

--

PiperOrigin-RevId: 246492919

5 years ago Fix bug in LoopTiling where a loop with trip count of 1 caused a division by...
MLIR Team [Fri, 3 May 2019 10:08:56 +0000 (03:08 -0700)]
Fix bug in LoopTiling where a loop with trip count of 1 caused a division by zero

--

PiperOrigin-RevId: 246480710

5 years ago Start developer guide doc.
Jacques Pienaar [Fri, 3 May 2019 01:58:47 +0000 (18:58 -0700)]
Start developer guide doc.

    This is just a bare skeleton to start populating developer policies and
    guidelines. LLVM side this would be multiple separate documents (coding
    standard & programmer's manual) but starting with one and we can break it out
    into multiple if the content so dictates.

--

PiperOrigin-RevId: 246433346

5 years ago Add missing SameValueType trait to a couple of quantization ops.
Stella Laurenzo [Fri, 3 May 2019 00:26:00 +0000 (17:26 -0700)]
Add missing SameValueType trait to a couple of quantization ops.

--

PiperOrigin-RevId: 246422412

5 years ago Be consistent w.r.t. struct/class in forward declaration
Lei Zhang [Thu, 2 May 2019 21:08:18 +0000 (14:08 -0700)]
Be consistent w.r.t. struct/class in forward declaration

    This addresses compiler warnings.

--

PiperOrigin-RevId: 246386939

5 years ago NFC: Move AttributeStorage and AttributeUniquer into a new header AttributeSuppor...
River Riddle [Thu, 2 May 2019 21:02:57 +0000 (14:02 -0700)]
NFC: Move AttributeStorage and AttributeUniquer into a new header AttributeSupport.h in preparation for them to be used by dialect defined attributes.

--

PiperOrigin-RevId: 246385860

5 years ago Add FxpMathOps real_matmul and real_matmul_bias.
Stella Laurenzo [Thu, 2 May 2019 19:41:34 +0000 (12:41 -0700)]
Add FxpMathOps real_matmul and real_matmul_bias.

    Also:
      - cleans up some operand names for consistency
      - remove the broadcast_dims attribute as it isn't used
      - adds an IsNullAttr predicate which is needed to match optional clamp attributes on these kind of ops (needed to simplify some out of tree transforms on the new matmul op)

--

PiperOrigin-RevId: 246370576

5 years ago [TableGen] Add the `TCopVTEtAreSameAt` PredOpTrait
Lei Zhang [Thu, 2 May 2019 19:08:17 +0000 (12:08 -0700)]
[TableGen] Add the `TCopVTEtAreSameAt` PredOpTrait

    This trait is used for specifying operands at the indices from a given
    list are with the same element type.

--

PiperOrigin-RevId: 246364735

5 years ago [ODS] Define ConstantOp.
Jacques Pienaar [Thu, 2 May 2019 18:52:33 +0000 (11:52 -0700)]
[ODS] Define ConstantOp.

    Add ConstantOp's Op Definition Spec. Currently we don't use convertFromStorage in the generated patterns and so needed to add a few casts to support patterns restricted to ElementsAttrs and to compensate for old rules where we defined ConstantOp to have a ElementsAttr to simplify writing the pattern.

--

PiperOrigin-RevId: 246361555

5 years ago Add a primitive linalg-lower-to-llvm-dialect pass
Nicolas Vasilache [Thu, 2 May 2019 18:36:52 +0000 (11:36 -0700)]
Add a primitive linalg-lower-to-llvm-dialect pass

    This CL builds upon ftynse@'s Linalg dialect conversion (in examples/Linalg/Linalg1) and updates it to support buffers and the fully composed form of view and slice operations.
    A new BufferSizeOp is introduced for the purpose of extracting the size information from a buffer.
    This will be useful in a followup CL for an end-to-end LLVM execution path where mlir-cpu-runner will allocate a buffer.

--

PiperOrigin-RevId: 246358593

5 years ago Simplify TypeUniquer/AttributeUniquer to not require multiple overloads when...
River Riddle [Thu, 2 May 2019 18:27:58 +0000 (11:27 -0700)]
Simplify TypeUniquer/AttributeUniquer to not require multiple overloads when constructing a new storage.

--

PiperOrigin-RevId: 246356767

5 years ago Update to address missing cmake target & qualify make_pair.
Jacques Pienaar [Thu, 2 May 2019 18:21:00 +0000 (11:21 -0700)]
Update to address missing cmake target & qualify make_pair.

--

PiperOrigin-RevId: 246355137

5 years ago Fix a minor formatting issue.
MLIR Team [Thu, 2 May 2019 13:33:58 +0000 (06:33 -0700)]
Fix a minor formatting issue.

--

PiperOrigin-RevId: 246307329

5 years ago Fix a typo.
MLIR Team [Thu, 2 May 2019 13:05:01 +0000 (06:05 -0700)]
Fix a typo.

--

PiperOrigin-RevId: 246304098

5 years ago Substitute getI64IntegerAttr for the more verbose code it replaces.
Geoffrey Martin-Noble [Thu, 2 May 2019 00:03:32 +0000 (17:03 -0700)]
Substitute getI64IntegerAttr for the more verbose code it replaces.

--

PiperOrigin-RevId: 246227344

5 years ago Add support for basic remark diagnostics. This is the minimal functionality neede...
River Riddle [Wed, 1 May 2019 19:13:44 +0000 (12:13 -0700)]
Add support for basic remark diagnostics. This is the minimal functionality needed to separate notes from remarks. It also provides a starting point to start building out better remark infrastructure.

--

PiperOrigin-RevId: 246175216

5 years ago Start sketching out a new diagnostics infrastructure. Create a new class 'Diagnos...
River Riddle [Wed, 1 May 2019 18:14:15 +0000 (11:14 -0700)]
Start sketching out a new diagnostics infrastructure. Create a new class 'DiagnosticEngine' and move the diagnostic handler support and final diagnostic emission from the MLIRContext to it.

--

PiperOrigin-RevId: 246163897

5 years ago [Linalg] Add a primitive tiling pass
Nicolas Vasilache [Wed, 1 May 2019 13:47:32 +0000 (06:47 -0700)]
[Linalg] Add a primitive tiling pass

    This CL adds a primitive tiling pass for Linalg.
    The tiling pass uses the loopToOperandRangesMaps property which should be ideally Tablegen'd and in-class.

    The tiling specification uses 0 as a convention to skip loops that should not be tiled.

    Tiling proceeds in 3 steps, for each op:
    1. Pad tile sizes with 0 to match the number of loops, this simplifies the implementation and avoids affine map manipulations to align dimensions.
    2. Create loop ranges that represent the min/max/step by which to iterate. This should be later complemented by a range intersection to avoid the out-of-bounds case.
    3. Map the loop ranges to view ranges in order to create subviews on which the op can be called.

    Relevant utility and helper functions are added separately that support writing the transformation in a declarative fashion.
    Simplifying assumptions are made for now on the views and the ranges that are constructed
    in the function and are not passed as function arguments. This restriction will be lifted
    in the future.

--

PiperOrigin-RevId: 246124419

5 years ago Remove NumericAttr. Now that all attributes contain a type, this subclass is...
River Riddle [Wed, 1 May 2019 01:15:48 +0000 (18:15 -0700)]
Remove NumericAttr. Now that all attributes contain a type, this subclass is no longer necessary.

--

PiperOrigin-RevId: 246061024

5 years ago Fix namespaces on a few pass factory functions.
Stella Laurenzo [Tue, 30 Apr 2019 22:32:55 +0000 (15:32 -0700)]
Fix namespaces on a few pass factory functions.

--

PiperOrigin-RevId: 246035278

5 years ago Ensure that every Attribute contains a Type. If an Attribute does not provide...
River Riddle [Tue, 30 Apr 2019 21:26:04 +0000 (14:26 -0700)]
Ensure that every Attribute contains a Type. If an Attribute does not provide a type explicitly, the type is defaulted to NoneType.

--

PiperOrigin-RevId: 246021088

5 years ago Reserve the required capacity to avoid pointer invalidations for translation...
Smit Hinsu [Tue, 30 Apr 2019 18:53:00 +0000 (11:53 -0700)]
Reserve the required capacity to avoid pointer invalidations for translation functions

--

PiperOrigin-RevId: 245992152

5 years ago Refactor Attribute uniquing to use StorageUniquer instead of being hard coded...
River Riddle [Tue, 30 Apr 2019 17:31:29 +0000 (10:31 -0700)]
Refactor Attribute uniquing to use StorageUniquer instead of being hard coded in the MLIRContext. This allows for attributes to be uniqued similarly to types. This is the second step towards allowing dialects to define attributes.

--

PiperOrigin-RevId: 245974705

5 years ago ExtractElementsOp asserts for >1 operator however it actually expects
Rob Suderman [Tue, 30 Apr 2019 16:52:38 +0000 (09:52 -0700)]
ExtractElementsOp asserts for >1 operator however it actually expects
    >0 operators.

--

PiperOrigin-RevId: 245966586

5 years ago Add transformation of the NVVM dialect to an LLVM module. Only handles
Stephan Herhut [Tue, 30 Apr 2019 13:08:21 +0000 (06:08 -0700)]
Add transformation of the NVVM dialect to an LLVM module. Only handles
    the generation of intrinsics out of NVVM index ops for now.

--

PiperOrigin-RevId: 245933152

5 years ago Add extraClassDeclaration field for ops.
Jacques Pienaar [Tue, 30 Apr 2019 06:12:40 +0000 (23:12 -0700)]
Add extraClassDeclaration field for ops.

    Simple mechanism to allow specifying arbitrary function declarations. The modelling will not cover all cases so allow a means for users to declare a method function that they will define in their C++ files. The goal is to allow full C++ flexibility as the goal is to cover cases not modelled.

--

PiperOrigin-RevId: 245889819

5 years ago Add an "any" quantized type, which contains the underlying type correlation but...
Stella Laurenzo [Tue, 30 Apr 2019 00:05:05 +0000 (17:05 -0700)]
Add an "any" quantized type, which contains the underlying type correlation but does not specify any mapping.

    Also fixes some comments that were stale after the last syntax upgrade.

--

PiperOrigin-RevId: 245853462

5 years ago Fix opt build failure.
Jacques Pienaar [Mon, 29 Apr 2019 23:12:15 +0000 (16:12 -0700)]
Fix opt build failure.

--

PiperOrigin-RevId: 245844236

5 years ago Fixup MLIRGPU to mlir-opt in cmake.
Jacques Pienaar [Mon, 29 Apr 2019 21:10:08 +0000 (14:10 -0700)]
Fixup MLIRGPU to mlir-opt in cmake.

--

PiperOrigin-RevId: 245820077

5 years ago Parsing support for Range, View and Slice operations
Nicolas Vasilache [Mon, 29 Apr 2019 19:11:58 +0000 (12:11 -0700)]
Parsing support for Range, View and Slice operations

    This CL implements the previously unsupported parsing for Range, View and Slice operations.
    A pass is introduced to lower to the LLVM.
    Tests are moved out of C++ land and into mlir/test/Examples.
    This allows better fitting within standard developer workflows.

--

PiperOrigin-RevId: 245796600

5 years ago Link MLIRSupport to IR in OSS
Nicolas Vasilache [Mon, 29 Apr 2019 17:30:57 +0000 (10:30 -0700)]
Link MLIRSupport to IR in OSS

    The missing dependency breaks linking on Linux.

--

PiperOrigin-RevId: 245773637

5 years ago Add Dialect in op definition to capture prefix and documentation.
Jacques Pienaar [Mon, 29 Apr 2019 16:24:09 +0000 (09:24 -0700)]
Add Dialect in op definition to capture prefix and documentation.

    Enables specifying the documentation for dialect along with defining the ops of the dialect. The doc generator will be expanded in follow up to emit the documentation in the autogenerated files. This is precursor to allowing common base for all ops in a dialect.

    All the dialect documentation is super sparse and just added as placeholder.

    I was tempted (and started) to move ConstantOp to be generated too, but this will be easier post adding extra_methods, so deferring until then.

--

PiperOrigin-RevId: 245759984

5 years ago Start GPU Dialect
Alex Zinenko [Mon, 29 Apr 2019 10:00:25 +0000 (03:00 -0700)]
Start GPU Dialect

    Define a new dialect related to GPU kernels.  Currently, it only contains a
    single operation for launching a kernel on a three-dimensional grid of thread
    blocks, following a model similar to that of CUDA.  In particular, the body of
    the kernel contains operations executed by each thread and uses region
    arguments to accept thread and block identifiers (similar to how the loop body
    region accepts the induction value).

--

PiperOrigin-RevId: 245713728