Commit Graph

1929 Commits

Author SHA1 Message Date
River Riddle bffba61d48 Add whole_archive_link support for MSVC.
This issue was discovered by @loic-joly-sonarsource with a proposed fix
    in https://github.com/tensorflow/mlir/pull/22.

--

PiperOrigin-RevId: 250558504
2019-06-01 20:08:32 -07:00
Geoffrey Martin-Noble 16ebc48c9d Change elements literal parsing to not rely on shaped type being a vector or tensor.
This is in preparation for making MemRef a ShapedType. In general, a shaped type should be anything with shape, rank, and element type properties, so use sites shouldn't assume more than that.

    I also pulled the trailing comma parsing out the parseElementsLiteralType (new name) method. It seems weird to have the method parse the type + a trailing comma, even if all call sites currently need that. It's surprising behavior without looking at the implementation.

--

PiperOrigin-RevId: 250558363
2019-06-01 20:08:22 -07:00
River Riddle 1ebbb135cc Disable the mlir-cpu-runner tests on win32. llvm orc does not support the COFF rtld.
--

PiperOrigin-RevId: 250556116
2019-06-01 20:08:12 -07:00
River Riddle 1fd1c7a8bb Replace the Function reference methods from the OpAsmParser/OpAsmPrinter with usages of FunctionAttr.
--

PiperOrigin-RevId: 250555680
2019-06-01 20:08:03 -07:00
River Riddle c455ecef22 Add an example of accessing the impl storage to the 'DefiningAttributesAndTypes' document.
--

PiperOrigin-RevId: 250553898
2019-06-01 20:07:51 -07:00
River Riddle 06b0db5311 Remove the Toy/* file path from the location check lines. This assumes a specific file path format that breaks on MSVC.
--

PiperOrigin-RevId: 250549223
2019-06-01 20:07:40 -07:00
River Riddle 661f062f6b NFC: Switch std::vector to SmallVector. This fixes a compiler error on MSVC as the StringMap key dereference method is non-const.
--

PiperOrigin-RevId: 250538085
2019-06-01 20:07:31 -07:00
Ben Vanik aa7ee31cbe [TableGen] Making printer support $cppClass substitution (similar to parser).
--

PiperOrigin-RevId: 250534216
2019-06-01 20:07:21 -07:00
Lei Zhang 22e3aa7594 [spirv] Add ModuleOp
This op defines a SPIR-V module using a MLIR region. The region contains
    one block. Module-level operations, including functions definitions,
    are all placed in this block.

    This CL extracts common definitions from SPIRVOps.td into SPIRVBase.td.
    The new op is placed in SPIRVStructureOps.td.

--

PiperOrigin-RevId: 250522320
2019-06-01 20:07:10 -07:00
Rasmus Munk Larsen e5a6904914 Get rid of redundant verifier, which is implied by the type traits.
--

PiperOrigin-RevId: 250511694
2019-06-01 20:07:01 -07:00
Rasmus Munk Larsen 861c55e150 Add a rank op to MLIR. Example:
%1 = rank %0 : index

--

PiperOrigin-RevId: 250505411
2019-06-01 20:06:51 -07:00
Nicolas Vasilache 0eac031fac Add lowering linalg.for to LLVM IR
This CL adds lowering of linalg.for to LLVM IR and adds an IR test.
    This also replaces the usage of affine.for with linalg.for and enables the LLVM IR path in the integration test.

--

PiperOrigin-RevId: 250503798
2019-06-01 20:06:40 -07:00
Alex Zinenko 33dc956647 EDSC: use llvm::function_ref instead of std::function
Region body constructors in EDSC now take a callback to the function that fills
    in the body.  This callback is called immediately and not stored, so it is
    sufficient to pass a reference to it and avoid a potentially expensive copy.

--

PiperOrigin-RevId: 250473793
2019-06-01 20:06:30 -07:00
Nicolas Vasilache 3ad0fa95d1 Add a linalg.for operation to support non-affine loop constructs
The affine.for operation has restrictions that make it suitable for dependence analysis. The Linalg dialect aims at being more general.
    This CL introduces linalg.for, and its associated terminator, along with a simple roundtripping test.
    A `linalg.for` only takes one value of index type for lower bound, upper bound and step.

    Example usage:
    ```
    linalg.for %iv = %lb to %ub step %step {
      ... // body
    }
    ```

--

PiperOrigin-RevId: 250369722
2019-06-01 20:06:21 -07:00
Lei Zhang e828c7e1e1 Remove unused IsSingleResult template
--

PiperOrigin-RevId: 250335025
2019-06-01 20:06:10 -07:00
River Riddle dce701ab86 NFC: Replace Function::args_iterator with Block::args_iterator.
--

PiperOrigin-RevId: 250311059
2019-06-01 20:06:01 -07:00
Jacques Pienaar 0281603f3c Fix mismatched-tags warning.
--

PiperOrigin-RevId: 250310618
2019-06-01 20:05:51 -07:00
River Riddle c3b8ef2e66 Tidy up a few parser functions in the ModuleParser. This also adds a missing error for attribute aliases that contain '.' characters.
--

PiperOrigin-RevId: 250291646
2019-06-01 20:05:42 -07:00
Lei Zhang d4c8c8de42 [ODS] Support numRegions in Op definition
--

PiperOrigin-RevId: 250282024
2019-06-01 20:05:31 -07:00
Alex Zinenko c2d105811a Do not assume Blocks belong to Functions
Fix Block::splitBlock and Block::eraseFromFunction that erronously assume
    blocks belong to functions.  They now belong to regions.  When splitting, new
    blocks should be created in the same region as the existing block.  When
    erasing a block, it should be removed from the region rather than from the
    function body that transitively contains the region.

    Also rename Block::eraseFromFunction to Block::erase for consistency with other
    IR containers.

--

PiperOrigin-RevId: 250278272
2019-06-01 20:05:21 -07:00
Stephan Herhut 8d703af2f8 Fix translation of NVVM special registers to intrinsics.
The original implementation did not map the return value of the intrinsics
    call to the result value of the special register op. Uses of the result
    value hence hit a nullpointer.

--

PiperOrigin-RevId: 250255436
2019-06-01 20:05:12 -07:00
Alex Zinenko d4c071cc69 Decouple affine->standard lowering from the pass
The lowering from the Affine dialect to the Standard dialect was originally
    implemented as a standalone pass.  However, it may be used by other passes
    willing to lower away some of the affine constructs as a part of their
    operation.  Decouple the transformation functions from the pass infrastructure
    and expose the entry point for the lowering.

    Also update the lowering functions to use `LogicalResult` instead of bool for
    return values.

--

PiperOrigin-RevId: 250229198
2019-06-01 20:05:01 -07:00
Jacques Pienaar ffc4cf7091 Fix correspondence between trait names in ODS and C++ class names.
Make the correspondence between the ODS and C++ side clearer.

--

PiperOrigin-RevId: 250211194
2019-06-01 20:04:52 -07:00
Jacques Pienaar f7ba70f8ea Change pattern test to use TestDialect instead.
Verify pattern specification, added benefit, named pattern and location recording using TestDialect. Naming is verified via explicitly adding named pattern to TestPatternDriver pass. Refactoring test to verify the desired functionality rather than generated code.

--

PiperOrigin-RevId: 250205618
2019-06-01 20:04:42 -07:00
Jacques Pienaar f0ee052d9e Use SourceMgrDiagnosticHandler in mlir-translate for translations from MLIR input.
Report errors using the file and line location using SourceMgr's diagnostic reporting. Reduce some horizontal white spacing too.

--

PiperOrigin-RevId: 250193646
2019-06-01 20:04:32 -07:00
River Riddle 46d657a277 Move the 'is_detected' utility out of StorageUniquer and into STLExtras to allow reuse throughout the codebase.
--

PiperOrigin-RevId: 250160508
2019-06-01 20:04:22 -07:00
Jacques Pienaar a945ec86e0 Avoid unused variable warning.
--

PiperOrigin-RevId: 250109802
2019-06-01 20:04:13 -07:00
River Riddle be9b20ff57 NFC: Add a missing include for std::isalnum and std::digit.
--

PiperOrigin-RevId: 250085298
2019-06-01 20:04:03 -07:00
River Riddle 4ed50a14b2 NFC: Cleanup a switch statement that only has a default case.
--

PiperOrigin-RevId: 250062529
2019-06-01 20:03:52 -07:00
River Riddle b33a7232a2 Add a 'getDialectNamespace' utility to a few dialects.
--

PiperOrigin-RevId: 250049416
2019-06-01 20:03:43 -07:00
Lei Zhang fba1d50b85 [spirv] Start the SPIR-V dialect
This CL sets up the basic structure for a SPIR-V dialect: operation
    definition specification, dialect registration, testing, etc.
    A single op, FMul, is defined and tested to showcase.

    The SPIR-V dialect aims to be a simple proxy for the SPIR-V binary format
    to enable straightforward and lightweight conversion from/to the binary
    format. Ops in this dialect should stay as the same semantic level and
    try to be a mechanical mapping to the corresponding SPIR-V instructions;
    but they can deviate representationally to allow using MLIR mechanisms.

--

PiperOrigin-RevId: 250040830
2019-06-01 20:03:33 -07:00
River Riddle 9e21ab8f52 Add a templated wrapper around RewritePattern that allows for defining match/rewrite methods with an instance of the source op instead of a raw Operation*.
--

PiperOrigin-RevId: 250003405
2019-06-01 20:03:22 -07:00
Jacques Pienaar 2f50b6c401 Use fused location for rewritten ops in generated rewrites.
This does tracks the location by recording all the ops in the source pattern and using the fused location for the transformed op. Track the locations via the rewrite state which is a bit heavy weight, in follow up to change to matchAndRewrite this will be addressed (and need for extra array go away).

--

PiperOrigin-RevId: 249986555
2019-06-01 20:03:12 -07:00
Jacques Pienaar b0a26768ec Make scope explicit to avoid misleading-indentation warnings.
--

PiperOrigin-RevId: 249986537
2019-06-01 20:03:02 -07:00
Jacques Pienaar 9edcd99feb Address some build warnings.
--

PiperOrigin-RevId: 249986120
2019-06-01 20:02:52 -07:00
River Riddle 647f8cabb9 Add support to RewritePattern for specifying the potential operations that can be generated during a rewrite. This will enable analyses to start understanding the possible effects of applying a rewrite pattern.
--

PiperOrigin-RevId: 249936309
2019-06-01 20:02:42 -07:00
Jacques Pienaar 09438a412f Fix incorrect result type inference for nested tuples & remove hacky const case.
Builders can be further refined but wanted to address bug where the result type was used beyond the first depth.

--

PiperOrigin-RevId: 249936004
2019-06-01 20:02:33 -07:00
River Riddle 9cb3ea8fe4 Update the type printer for Diagnostic to automatically wrap the type with ''.
--

PiperOrigin-RevId: 249935489
2019-06-01 20:02:22 -07:00
River Riddle 83f5669cee Update the m_Constant matcher to enable matching derived attribute types.
--

PiperOrigin-RevId: 249933184
2019-06-01 20:02:12 -07:00
River Riddle c2d069323b Rename DialectConversion to TypeConverter and split out pattern construction. This simplifies building the conversion pattern list from multiple sources.
--

PiperOrigin-RevId: 249930583
2019-06-01 20:02:03 -07:00
River Riddle 5a5cdb94fe Move the definitions of LoadOp and StoreOp to the ODG framework.
--

PiperOrigin-RevId: 249928980
2019-06-01 20:01:52 -07:00
River Riddle ca885b3c81 Move the definitions of CmpIOp, CmpFOp, and SelectOp to the ODG framework.
--

PiperOrigin-RevId: 249928953
2019-06-01 20:01:42 -07:00
Geoffrey Martin-Noble 15075d5a22 Replace checks for rank -1 with direct calls to hasRank
Also removed a redundant check for rank after already checking for static shape (which implies rank)

--

PiperOrigin-RevId: 249927636
2019-06-01 20:01:33 -07:00
Geoffrey Martin-Noble 58a766705b Limit the number of places where shaped type has to explicitly reference its base classes.
Introduces a hasRank() method to make checking for rank a bit easier.

    This is partially to make it easier to make MemRef subclass ShapedType

--

PiperOrigin-RevId: 249927442
2019-06-01 20:01:22 -07:00
Jacques Pienaar 8b4c214046 Use TestDialect to test traits instead of unittest.
--

PiperOrigin-RevId: 249916947
2019-06-01 20:01:12 -07:00
Geoffrey Martin-Noble 9f1f91e770 Add a type-constrained nested tuple type.
This is useful for dialects that use tuples but only support a subset of types.

--

PiperOrigin-RevId: 249910133
2019-06-01 20:01:03 -07:00
Lei Zhang ba104f871c Add TestLoopFusion.cpp to CMakeLists.txt
--

PiperOrigin-RevId: 249901490
2019-06-01 20:00:52 -07:00
River Riddle 06734badbc Add operand type iterators to Operation and cleanup usages of operand->getType. This also simplifies some lingering usages of result->getType.
--

PiperOrigin-RevId: 249889174
2019-06-01 20:00:43 -07:00
Andy Davis e53b7d2c02 Add LoopFusionUtils.cpp to CMakeLists.
--

PiperOrigin-RevId: 249887371
2019-06-01 20:00:33 -07:00
Andy Davis a560f2c646 Affine Loop Fusion Utility Module (1/n).
*) Adds LoopFusionUtils which will expose a set of loop fusion utilities (e.g. dependence checks, fusion cost/storage reduction, loop fusion transformation) for use by loop fusion algorithms. Support for checking block-level fusion-preventing dependences is added in this CL (additional loop fusion utilities will be added in subsequent CLs).
    *) Adds TestLoopFusion test pass for testing LoopFusionUtils at a fine granularity.
    *) Adds unit test for testing dependence check for block-level fusion-preventing dependences.

--

PiperOrigin-RevId: 249861071
2019-06-01 20:00:23 -07:00