summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * Register a -test-spirv-roundtrip hook to mlir-translateLei Zhang2019-09-1725-155/+179
| | | | | | | | | | | | | | | | | | | | This CL registers a new mlir-translate hook, -test-spirv-roundtrip, for testing SPIR-V serialization and deserialization round-trip. This CL also moves the existing -serialize-spirv and -deserialize-spirv hooks to one source file. PiperOrigin-RevId: 269659528
| * Add a preprocess pass to remove sequences that are problematic with FileCheckRiver Riddle2019-09-171-0/+19
| | | | | | | | | | | | Add a preprocess phase to rewrite parts of the input line that may be problematic with filecheck. This change adds preprocessing to escape '[[' bracket sequences, as these are used by FileCheck for variables. PiperOrigin-RevId: 269648490
| * Support file-to-file translation in mlir-translateLei Zhang2019-09-173-3/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | Existing translations are either from MLIR or to MLIR. To support cases like round-tripping some external format via MLIR, one must chain two mlir-translate invocations together using pipes. This can be problematic to support -split-input-file in mlir-translate given that it won't work across pipes. Motivated by the above, this CL adds another translation category that allows file to file. This gives users more freedom. PiperOrigin-RevId: 269636438
| * Change MLIR translation functions signatureLei Zhang2019-09-178-91/+86
| | | | | | | | | | | | | | | | | | | | This CL changes translation functions to take MemoryBuffer as input and raw_ostream as output. It is generally better to avoid handling files directly in a library (unless the library is specifically for file manipulation) and we can unify all file handling to the mlir-translate binary itself. PiperOrigin-RevId: 269625911
| * Add rewrite pattern to compose maps into affine load/storesUday Bondhugula2019-09-178-51/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - add canonicalization pattern to compose maps into affine loads/stores; templatize the pattern and reuse it for affine.apply as well - rename getIndices -> getMapOperands() (getIndices is confusing since these are no longer the indices themselves but operands to the map whose results are the indices). This also makes the accessor uniform across affine.apply/load/store. Change arg names on the affine load/store builder to avoid confusion. Drop an unused confusing build method on AffineStoreOp. - update incomplete doc comment for canonicalizeMapAndOperands (this was missed from a previous update). Addresses issue tensorflow/mlir#121 Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#122 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/122 from bondhugula:compose-load-store e71de1771e56a85c4282c10cb43f30cef0701c4f PiperOrigin-RevId: 269619540
| * Add missing CMake dependency from libAnalysis to the Vector dialectMehdi Amini2019-09-171-2/+2
| | | | | | | | | | | | Fixes tensorflow/mlir#138 PiperOrigin-RevId: 269509668
| * Autogenerate (de)serialization for Extended Instruction SetsMahesh Ravishankar2019-09-1616-354/+647
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A generic mechanism for (de)serialization of extended instruction sets is added with this CL. To facilitate this, a new class "SPV_ExtendedInstSetOp" is added which is a base class for all operations corresponding to extended instruction sets. The methods to (de)serialization such ops as well as its dispatch is generated automatically. The behavior controlled by autogenSerialization and hasOpcode is also slightly modified to enable this. They are now decoupled. 1) Setting hasOpcode=1 means the operation has a corresponding opcode in SPIR-V binary format, and its dispatch for (de)serialization is automatically generated. 2) Setting autogenSerialization=1 generates the function for (de)serialization automatically. So now it is possible to have hasOpcode=0 and autogenSerialization=1 (for example SPV_ExtendedInstSetOp). Since the dispatch functions is also auto-generated, the input file needs to contain all operations. To this effect, SPIRVGLSLOps.td is included into SPIRVOps.td. This makes the previously added SPIRVGLSLOps.h and SPIRVGLSLOps.cpp unnecessary, and are deleted. The SPIRVUtilsGen.cpp is also changed to make better use of formatv,making the code more readable. PiperOrigin-RevId: 269456263
| * [spirv] Add support for function calls.Denis Khalikov2019-09-167-14/+419
| | | | | | | | | | | | | | | | | | Add spv.FunctionCall operation and (de)serialization. Closes tensorflow/mlir#137 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/137 from denis0x0D:sandbox/function_call_op e2e6f07d21e7f23e8b44c7df8a8ab784f3356ce4 PiperOrigin-RevId: 269437167
| * Add support for multi-level value mapping to DialectConversion.River Riddle2019-09-165-14/+148
| | | | | | | | | | | | When performing A->B->C conversion, an operation may still refer to an operand of A. This makes it necessary to unmap through multiple levels of replacement for a specific value. PiperOrigin-RevId: 269367859
| * [spirv] Add support for BitEnumAttrLei Zhang2019-09-1614-54/+444
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Certain enum classes in SPIR-V, like function/loop control and memory access, are bitmasks. This CL introduces a BitEnumAttr to properly model this and drive auto-generation of verification code and utility functions. We still store the attribute using an 32-bit IntegerAttr for minimal memory footprint and easy (de)serialization. But utility conversion functions are adjusted to inspect each bit and generate "|"-concatenated strings for the bits; vice versa. Each such enum class has a "None" case that means no bit is set. We need special handling for "None". Because of this, the logic is not general anymore. So right now the definition is placed in the SPIR-V dialect. If later this turns out to be useful for other dialects, then we can see how to properly adjust it and move to OpBase.td. Added tests for SPV_MemoryAccess to check and demonstrate. PiperOrigin-RevId: 269350620
| * Overhaul the SDBM expression kind hierarchyAlex Zinenko2019-09-165-139/+304
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Swap the allowed nesting of sum and diff expressions: now a diff expression can contain a sum expression, but only on the left hand side. A difference of two expressions sum must be canonicalized by grouping their constant terms in a single expression. This change of sturcture became possible thanks to the introduction of the "direct" super-kind. It is necessary to enable support of sum expressions on the left hand side of the stripe expression. SDBM expressions are now grouped into the following structure - expression - varying - direct - sum <- (term, constant) - term - symbol - dimension - stripe <- (term, constant) - negation <- (direct) - difference <- (direct, term) - constant The notation <- (...) denotes the types of subexpressions a compound expression can combine. PiperOrigin-RevId: 269337222
| * Introduce SDBMDirect expression into the SDBM expression hierarchyAlex Zinenko2019-09-162-11/+39
| | | | | | | | | | | | | | | | | | | | Direct expressions are those that do not negate any of the variables they involve. They include input expressions (dimensions and symbols), stripe and sum expressions, and combinations of those. Reifying direct expressions as a class is a precondition for enabling additions on the LHS of a stripe expression. PiperOrigin-RevId: 269336031
| * Unify how errors are emitted in LaunchFuncOp verification.MLIR Team2019-09-161-3/+3
| | | | | | | | PiperOrigin-RevId: 269331869
| * Error out when kernel function is not found while translating GPU calls.MLIR Team2019-09-161-0/+4
| | | | | | | | PiperOrigin-RevId: 269327909
| * Drop makePositionAttr and the like in favor of Builder::getI64ArrayAttrAlex Zinenko2019-09-164-67/+28
| | | | | | | | | | | | | | | | | | | | The helper functions makePositionAttr() and positionAttr() were originally introduced in the lowering-to-LLVM-dialect pass to construct integer array attributes that are used for static positions in extract/insertelement. Constructing an integer array attribute being fairly common, a utility function Builder::getI64ArrayAttr was later introduced into the Builder API. Drop makePositionAttr and similar homegrown functions and use that API instead. PiperOrigin-RevId: 269295836
| * Add mechanism to specify extended instruction sets in SPIR-V.Mahesh Ravishankar2019-09-1510-22/+302
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for specifying extended instructions sets. The operations in SPIR-V dialect are named as 'spv.<extension-name>.<op-name>'. Use this mechanism to define a 'Exp' operation from GLSL(450) instructions. Later CLs will add support for (de)serialization of these operations, and update the dialect generation scripts to auto-generate the specification using the spec directly. Additional changes: Add a Type Constraint to OpBase.td to check for vector of specified lengths. This is used to check that the vector type used in SPIR-V dialect are of lengths 2, 3 or 4. Update SPIRVBase.td to use this Type constraints for vectors. PiperOrigin-RevId: 269234377
| * Update the pass registration section and add a sub-section on the textual ↵River Riddle2019-09-151-15/+57
| | | | | | | | | | | | | | | | pipeline specification. Now that the pass manager is generalized, and nested/arbritrary pipelines are possible, it is important to document how to specify these types of pipelines from the command line. PiperOrigin-RevId: 269207681
| * Fix typo in test/AffineOps/ops.mlirUday Bondhugula2019-09-151-1/+1
| | | | | | | | | | | | | | Closes tensorflow/mlir#135 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/135 from bondhugula:patch-1 539a7f1b43d09ef539b2fd15875f8ac765600263 PiperOrigin-RevId: 269187507
| * NFC: Update the PassInstrumentation section.River Riddle2019-09-141-3/+10
| | | | | | | | | | | | This section has grown stale as the pass infrastructure has been generalized. PiperOrigin-RevId: 269140863
| * NFC: Update the expected outputs of pass-timing.River Riddle2019-09-141-27/+26
| | | | | | | | | | | | The output of the pass timing instrumentation has been changed now that the pass hierarchy has been generalized. PiperOrigin-RevId: 269140277
| * Update the IRPrinter instrumentation to work on non function/module operations.River Riddle2019-09-144-28/+34
| | | | | | | | | | | | This is necessary now that the pass manager may work on different types of operations. PiperOrigin-RevId: 269139669
| * NFC: Pass PassInstrumentations by unique_ptr instead of raw pointer.River Riddle2019-09-146-17/+15
| | | | | | | | | | | | This makes the ownership model explicit, and removes potential user errors. PiperOrigin-RevId: 269122834
| * NFC: Merge OpPass with OperationPass into just OperationPass.River Riddle2019-09-143-27/+19
| | | | | | | | | | | | | | | | | | | | OperationPass' are defined exactly the same way as they are now: class DerivedPass : public OperationPass<DerivedPass>; OpPass' are now defined as OperationPass, but with an additional template parameter for the operation type: class DerivedPass : public OperationPass<DerivedPass, FuncOp>; PiperOrigin-RevId: 269122410
| * Add convenience methods to create i8 and i16 attributes in Builder.Jing Pu2019-09-142-0/+10
| | | | | | | | PiperOrigin-RevId: 269120226
| * NFC - Move explicit copy/dma generation utility out of pass and into LoopUtilsUday Bondhugula2019-09-143-673/+717
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - turn copy/dma generation method into a utility in LoopUtils, allowing it to be reused elsewhere. - no functional/logic change to the pass/utility - trim down header includes in files affected Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#124 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/124 from bondhugula:datacopy 9f346e62e5bd9dd1986720a30a35f302eb4d3252 PiperOrigin-RevId: 269106088
| * update normalizeMemRef utility; handle missing failure check + add more testsUday Bondhugula2019-09-143-10/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - take care of symbolic operands with alloc - add missing check for compose map failure and a test case - add test cases on strides - drop incorrect check for one-to-one'ness Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#132 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/132 from bondhugula:normalize-memrefs 8aebf285fb0d7c19269d85255aed644657e327b7 PiperOrigin-RevId: 269105947
| * Clean up build trip count analysis method - avoid mutating IRUday Bondhugula2019-09-146-117/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - NFC - on any pass/utility logic/output. - Resolve TODO; the method building loop trip count maps was creating and deleting affine.apply ops (transforming IR from under analysis!, strictly speaking). Introduce AffineValueMap::difference to do this correctly (without the need to create any IR). - Move AffineApplyNormalizer out so that its methods are reusable from AffineStructures.cpp; add a helper method 'normalize' to it. Fix AffineApplyNormalize::renumberOneDim (Issue tensorflow/mlir#89). - Trim includes on files touched. - add test case on a scenario previously not covered Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#133 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/133 from bondhugula:trip-count-build 7fc34d857f7788f98b641792cafad6f5bd50e47b PiperOrigin-RevId: 269101118
| * NFC: Fix stray character in error message: 1 -> 'River Riddle2019-09-141-1/+1
| | | | | | | | PiperOrigin-RevId: 269091468
| * Update QuickstartRewrites.md regarding op definition and rewritesLei Zhang2019-09-141-24/+36
| | | | | | | | | | | | | | This CL updates the doc with recent changes. It also adds a section on registering and using the auto-generated patterns. PiperOrigin-RevId: 269086830
| * Add pattern to canonicalize for loop boundsUday Bondhugula2019-09-134-22/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - add pattern to canonicalize affine.for loop bounds (using canonicalizeMapAndOperands) - rename AffineForLoopBoundFolder -> AffineForLoopBoundFolder for consistency Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#111 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/111 from bondhugula:bound-canonicalize ee8fb7f43a7ffd45f6df3f53c95098d8b7e494c7 PiperOrigin-RevId: 269041220
| * Verify that ModuleOps only contain dialect specific attributes.River Riddle2019-09-132-0/+15
| | | | | | | | | | | | ModuleOp has no expected operations, so only dialect-specific attributes are valid. PiperOrigin-RevId: 269020062
| * add missing memref cast fold pattern for dim opUday Bondhugula2019-09-133-6/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - add missing canonicalization pattern to fold memref_cast + dim to dim (needed to propagate constant when folding a dynamic shape to a static one) - also fix an outdated/inconsistent comment in StandardOps/Ops.td Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#126 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/126 from bondhugula:quickfix 4566e75e49685c532faffff91d64c5d83d4da524 PiperOrigin-RevId: 269020058
| * Publicly expose the functionality to parse a textual pass pipeline.River Riddle2019-09-134-27/+85
| | | | | | | | | | | | This allows for users other than those on the command line to apply a textual description of a pipeline to a given pass manager. PiperOrigin-RevId: 269017028
| * Add type constraints for shaped types with same rank and element countGeoffrey Martin-Noble2019-09-133-0/+85
| | | | | | | | PiperOrigin-RevId: 269000237
| * Update SPIR-V symbols and use GLSL450 instead of VulkanKHRLei Zhang2019-09-1322-262/+265
| | | | | | | | | | | | | | | | | | | | | | | | | | | | SPIR-V recently publishes v1.5, which brings a bunch of symbols into core. So the suffix "KHR"/"EXT"/etc. is removed from the symbols. We use a script to pull information from the spec directly. Also changed conversion and tests to use GLSL450 instead of VulkanKHR memory model. GLSL450 is still the main memory model supported by Vulkan shaders and it does not require extra capability to enable. PiperOrigin-RevId: 268992661
| * NFC: Finish replacing FunctionPassBase/ModulePassBase with OpPassBase.River Riddle2019-09-1369-133/+119
| | | | | | | | | | | | These directives were temporary during the generalization of FunctionPass/ModulePass to OpPass. PiperOrigin-RevId: 268970259
| * Add tablegen class for memrefs with rank constraintsGeoffrey Martin-Noble2019-09-133-9/+45
| | | | | | | | PiperOrigin-RevId: 268968004
| * Forward diagnostics from untracked threads in ParallelDiagnosticHandler.River Riddle2019-09-134-4/+34
| | | | | | | | | | | | This allows for the use of multiple ParallelDiagnosticHandlers without having them conflict with each other. PiperOrigin-RevId: 268967407
| * Improve verifier error reporting on type mismatch (NFC)MLIR Team2019-09-131-1/+1
| | | | | | | | | | | | | | Before this change, it only reports expected type but not exact type, so it's hard to troubleshoot. PiperOrigin-RevId: 268961078
| * Refactor pass pipeline command line parsing to support explicit pipeline ↵River Riddle2019-09-1310-100/+428
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | strings. This allows for explicitly specifying the pipeline to add to the pass manager. This includes the nesting structure, as well as the passes/pipelines to run. A textual pipeline string is defined as a series of names, each of which may in itself recursively contain a nested pipeline description. A name is either the name of a registered pass, or pass pipeline, (e.g. "cse") or the name of an operation type (e.g. "func"). For example, the following pipeline: $ mlir-opt foo.mlir -cse -canonicalize -lower-to-llvm Could now be specified as: $ mlir-opt foo.mlir -pass-pipeline='func(cse, canonicalize), lower-to-llvm' This will allow for running pipelines on nested operations, like say spirv modules. This does not remove any of the current functionality, and in fact can be used in unison. The new option is available via 'pass-pipeline'. PiperOrigin-RevId: 268954279
| * NFC: Update comments about rank constraintsGeoffrey Martin-Noble2019-09-131-2/+2
| | | | | | | | | | | | These refer to ranked tensors, but are actually applicable to any shaped type PiperOrigin-RevId: 268931789
| * Fixing typo in documentation.MLIR Team2019-09-131-1/+1
| | | | | | | | PiperOrigin-RevId: 268877189
| * Log name of the generated illegal operation name in DialectConversion debug modeSmit Hinsu2019-09-131-2/+4
| | | | | | | | PiperOrigin-RevId: 268859399
| * Cmpf constant folding for nan and infGeoffrey Martin-Noble2019-09-122-12/+80
| | | | | | | | PiperOrigin-RevId: 268783645
| * NFC: Clean up constant fold testsGeoffrey Martin-Noble2019-09-121-85/+86
| | | | | | | | | | | | | | | | Use variable captures to make constant folding tests less sensitive to printer/parser implementation details. See guidelines at https://github.com/tensorflow/mlir/blob/master/g3doc/TestingGuide.md PiperOrigin-RevId: 268780812
| * [spirv] Add support for spv.loop (de)serializationLei Zhang2019-09-117-53/+799
| | | | | | | | | | | | | | | | This CL adds support for serializing and deserializing spv.loop ops. This adds support for spv.Branch and spv.BranchConditional op (de)serialization, too, because they are needed for spv.loop. PiperOrigin-RevId: 268536962
| * Rename SDBMPositiveExpr to SDBMTermExprAlex Zinenko2019-09-116-85/+80
| | | | | | | | | | | | | | | | | | | | | | This better reflects how this kind of expressions is used and avoids the potential confusion since the expression can take negative values. Term expressions comprise dimensions, symbols and stripe expressions. In an SDBM domain, a stripe expression always corresponds to a variable, input or temporary. This expression can appear anywhere an input variable can, including on the LHS of other stripe expressions. PiperOrigin-RevId: 268486066
| * Fix typos in SDBMTest.cppAlex Zinenko2019-09-111-2/+2
| | | | | | | | PiperOrigin-RevId: 268443146
| * Add logical groups to NVVM op definitions.MLIR Team2019-09-111-0/+24
| | | | | | | | PiperOrigin-RevId: 268436116
| * Fix a typo in comments. The Inequality and Equality explanations were ↵MLIR Team2019-09-101-2/+2
| | | | | | | | | | | | apparently reversed. PiperOrigin-RevId: 268395163
OpenPOWER on IntegriCloud