Commit Graph

1597 Commits

Author SHA1 Message Date
MLIR Team 41d90a85bd Automated rollback of changelist 247778391.
PiperOrigin-RevId: 247778691
2019-05-20 13:37:20 -07:00
River Riddle 02e03b9bf4 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
2019-05-20 13:37:10 -07:00
River Riddle 360f8a209e Rename Op::isClassFor to Op::classof to match the LLVM isa/dyn_cast standard naming scheme.
--

PiperOrigin-RevId: 247771192
2019-05-20 13:36:59 -07:00
River Riddle e686a11523 Remove several heavy includes from Diagnostics.h by a moving a couple of fields/methods to the .cpp file.
--

PiperOrigin-RevId: 247768443
2019-05-20 13:36:48 -07:00
Chris Lattner 81e478adca 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
2019-05-20 13:36:38 -07:00
River Riddle fe7b23792d Remove some unnecessary or duplicated header includes from IR/.
--

PiperOrigin-RevId: 247762545
2019-05-20 13:36:28 -07:00
Chris Lattner 0134b5df3a Cleanups and simplifications to code, noticed by inspection. NFC.
--

PiperOrigin-RevId: 247758075
2019-05-20 13:36:17 -07:00
Mehdi Amini ecd4c7d67a 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
2019-05-10 21:26:30 -07:00
River Riddle 85bf79851e 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
2019-05-10 19:30:56 -07:00
Lei Zhang df5000fd31 [TableGen] Return base attribute's name for anonymous OptionalAttr/DefaultValuedAttr
--

PiperOrigin-RevId: 247693280
2019-05-10 19:30:48 -07:00
River Riddle 4a6264f5c5 Move the definitions for CallOp and IndirectCallOp to the Op Definition Generator.
--

PiperOrigin-RevId: 247686419
2019-05-10 19:30:40 -07:00
River Riddle 77c333ca62 Move the definitions of BranchOp, DimOp, and ExtractElementOp to Op Definition Generator.
--

PiperOrigin-RevId: 247686212
2019-05-10 19:30:31 -07:00
River Riddle 53a3483cc8 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
2019-05-10 19:30:23 -07:00
River Riddle aa99db1809 Add support to the SourceMgrDiagnosticHandlers to auto-load new source files seen in diagnostics.
--

PiperOrigin-RevId: 247681779
2019-05-10 19:30:15 -07:00
Mehdi Amini ff5d021c39 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
2019-05-10 19:30:06 -07:00
Mehdi Amini bd8ed0d215 Fix unused variable warning in the Toy tutorial (NFC)
--

PiperOrigin-RevId: 247672377
2019-05-10 19:29:58 -07:00
Mehdi Amini 32ae5dd16c Remove unused method `parseIntegerSetInline` and `parseAffineMapInline` in Parser (NFC)
Fix GCC warning.

--

PiperOrigin-RevId: 247672318
2019-05-10 19:29:50 -07:00
Mehdi Amini 8a34566515 Remove unused `signature()` from `OpMethod` class (private to mlir-tblgen) (NFC)
--

PiperOrigin-RevId: 247672280
2019-05-10 19:29:42 -07:00
Mehdi Amini e68a4caebe 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
2019-05-10 19:29:34 -07:00
Mehdi Amini 91f0781000 Remove extra `;` after function definition (NFC)
Fix a GCC warning

--

PiperOrigin-RevId: 247670176
2019-05-10 19:29:26 -07:00
Mehdi Amini a5ca314c4c Replace dyn_cast<> with isa<> when the returned value is unused (NFC)
Fix a gcc warning.

--

PiperOrigin-RevId: 247669360
2019-05-10 19:29:18 -07:00
River Riddle 9e363a1f3f Refactor the SourceMgrDiagnosticHandlers to support more locations than FileLineColLoc.
--

PiperOrigin-RevId: 247662828
2019-05-10 19:29:10 -07:00
Mehdi Amini 83cce46b96 Remove unused Vectorize constructor (NFC)
Fix gcc warning.

--

PiperOrigin-RevId: 247647114
2019-05-10 19:29:01 -07:00
Mehdi Amini c86dc1c127 Remove unused `hasSingleNonZeroAt` function (NFC)
Fix clang warning.

--

PiperOrigin-RevId: 247623306
2019-05-10 19:28:53 -07:00
Mehdi Amini 1d309e0082 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
2019-05-10 19:28:45 -07:00
River Riddle b42747eec2 Templatize the integer constructors for DiagnosticArgument to avoid ambiguous conversions.
--

PiperOrigin-RevId: 247621058
2019-05-10 19:28:37 -07:00
Jacques Pienaar fa97d3a2cf 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
2019-05-10 19:28:29 -07:00
Nicolas Vasilache 6bdd13f107 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
2019-05-10 19:28:21 -07:00
River Riddle 685f948481 Add support to SourceMgrDiagnosticHandler for handling the case where the llvm::SourceMgr has no main file.
--

PiperOrigin-RevId: 247605584
2019-05-10 19:28:13 -07:00
Thomas Joerg 43547ccfac 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
2019-05-10 19:28:04 -07:00
Thomas Joerg df0296742b Annotate outlined kernel functions with the attribute `gpu.kernel`.
--

PiperOrigin-RevId: 247589560
2019-05-10 19:27:56 -07:00
Thomas Joerg 29712d7ffa Add gpu.launch_func builder taking KernelDim3 arguments (NFC).
--

PiperOrigin-RevId: 247577649
2019-05-10 19:27:48 -07:00
Thomas Joerg 0a21ab70fa Pass for outlining gpu.launch operation bodies into kernel functions called by gpu.launch_func operations.
--

PiperOrigin-RevId: 247564213
2019-05-10 19:27:40 -07:00
Mehdi Amini 051925bd34 Remove unused PassID member from PassRegistry (NFC)
Fix clang warning

--

PiperOrigin-RevId: 247558931
2019-05-10 19:27:32 -07:00
Mehdi Amini e0949c9cdb Remove unused MLIRContext member from MutableAffineMap class (NFC)
Fix clang warning

--

PiperOrigin-RevId: 247558650
2019-05-10 19:27:24 -07:00
Mehdi Amini 52d0dbbd2a 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
2019-05-10 19:27:16 -07:00
Mehdi Amini 6459c821bf Fix class/struct mismatch between declaration/definition (NFC)
Fix clang warnings

--

PiperOrigin-RevId: 247557395
2019-05-10 19:27:07 -07:00
Mehdi Amini 211ceb9fd5 Add override keyword on overidden virtual method (NFC)
Fix clang warnings

--

PiperOrigin-RevId: 247556495
2019-05-10 19:26:59 -07:00
River Riddle 5fd4ec1b78 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
2019-05-10 19:26:51 -07:00
Lei Zhang b0be00c746 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
2019-05-10 19:26:43 -07:00
River Riddle 0e481bae68 Add support in the SourceMgrDiagnosticHandler for handling source managers with multiple buffers.
--

PiperOrigin-RevId: 247482733
2019-05-10 19:26:35 -07:00
Nicolas Vasilache b4c06416df Move edsc python tests to Filecheck
--

PiperOrigin-RevId: 247479507
2019-05-10 19:26:27 -07:00
Nicolas Vasilache 33449c3e6c 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
2019-05-10 19:26:18 -07:00
Nicolas Vasilache 07f777f6cd Fix OSS build (Linux)
--

PiperOrigin-RevId: 247472005
2019-05-10 19:26:10 -07:00
River Riddle a054f7af95 Update mlir::interleaveComma to work on ranges with types other than Container<T>.
--

PiperOrigin-RevId: 247468184
2019-05-10 19:26:01 -07:00
Andy Davis 0412bf6f09 Add memref dimension bounds as upper/lower bounds on MemRefRegion constraints, to guard against potential over-approximation from projection.
--

PiperOrigin-RevId: 247431201
2019-05-10 19:25:53 -07:00
Andy Davis 6254a42d58 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
2019-05-10 19:25:44 -07:00
Alex Zinenko dbb9608de8 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
2019-05-10 19:25:36 -07:00
Stephan Herhut 45c87e4d3b Fix builder for LLVM::Alloca operation.
--

PiperOrigin-RevId: 247402238
2019-05-10 19:25:28 -07:00
Thomas Joerg 530439075a Add gpu.launch_func builder.
--

PiperOrigin-RevId: 247364893
2019-05-10 19:25:19 -07:00