summaryrefslogtreecommitdiffstats
path: root/mlir/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Autogenerate (de)serialization for Extended Instruction SetsMahesh Ravishankar2019-09-166-72/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-163-6/+206
| | | | | | | | | 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-161-10/+46
| | | | | | 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-164-4/+15
| | | | | | | | | | | | | | | | | | | | 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-162-116/+197
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* 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-162-38/+19
| | | | | | | | | | 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-154-20/+72
| | | | | | | | | | | | | | | | | | 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 IRPrinter instrumentation to work on non function/module operations.River Riddle2019-09-142-23/+28
| | | | | | 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-143-10/+9
| | | | | | 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-141-3/+2
| | | | | | | | | | 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-141-0/+8
| | | | PiperOrigin-RevId: 269120226
* NFC - Move explicit copy/dma generation utility out of pass and into LoopUtilsUday Bondhugula2019-09-142-672/+688
| | | | | | | | | | | | | | | | - 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-141-10/+9
| | | | | | | | | | | | | | - 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-143-112/+71
| | | | | | | | | | | | | | | | | | | | | | | | - 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
* Add pattern to canonicalize for loop boundsUday Bondhugula2019-09-131-2/+35
| | | | | | | | | | | | | | - 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-131-0/+8
| | | | | | 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-131-0/+6
| | | | | | | | | | | | | | | - 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-131-27/+60
| | | | | | 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
* Update SPIR-V symbols and use GLSL450 instead of VulkanKHRLei Zhang2019-09-131-1/+1
| | | | | | | | | | | | | | 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-1343-50/+55
| | | | | | These directives were temporary during the generalization of FunctionPass/ModulePass to OpPass. PiperOrigin-RevId: 268970259
* Forward diagnostics from untracked threads in ParallelDiagnosticHandler.River Riddle2019-09-132-4/+26
| | | | | | This allows for the use of multiple ParallelDiagnosticHandlers without having them conflict with each other. PiperOrigin-RevId: 268967407
* Refactor pass pipeline command line parsing to support explicit pipeline ↵River Riddle2019-09-134-54/+338
| | | | | | | | | | | | | | | | 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
* 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-121-4/+4
| | | | PiperOrigin-RevId: 268783645
* [spirv] Add support for spv.loop (de)serializationLei Zhang2019-09-114-50/+704
| | | | | | | | 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-113-42/+39
| | | | | | | | | | | 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
* Don't leak TargetMachine in ExecutionEngine::setupTargetTripleMLIR Team2019-09-101-2/+2
| | | | PiperOrigin-RevId: 268361054
* Add folding rule for spv.CompositeExtractLei Zhang2019-09-101-1/+34
| | | | | | | | If the composite is a constant, we can fold it away. This only supports vector and array constants for now, given that struct constant is not supported in spv.constant yet. PiperOrigin-RevId: 268350340
* Remove the constraint that min / max should stride zeroFeng Liu2019-09-101-12/+13
| | | | | | | | | | | | Since we apply nudging for the zero point to make sure the nudged zerop points can be in the range of [qmin, qmax], the constraint that rmin / rmax should stride zero isn't necessary. This also matches the documentation of tensorflow's FakeQuantWithMinMaxArgs op, where min and max don't need to stride zero: https://www.tensorflow.org/api_docs/python/tf/quantization/fake_quant_with_min_max_args PiperOrigin-RevId: 268296285
* Convert ConstFakeQuantPerAxis to qcast and dcast pairFeng Liu2019-09-102-27/+70
| | | | | | This is also to add the test to the fakeQuantAttrsToType for per-channel fake quant. PiperOrigin-RevId: 268260032
* Remove unused variableJacques Pienaar2019-09-101-2/+1
| | | | PiperOrigin-RevId: 268173638
* Remove redundant qualificationJacques Pienaar2019-09-091-1/+1
| | | | | | Address GCC error: extra qualification not allowed [-fpermissive] PiperOrigin-RevId: 268133737
* Add pass generate per block in a function a GraphViz Dot graph with ops as nodesJacques Pienaar2019-09-093-0/+207
| | | | | | | | | | | * Add GraphTraits that treat a block as a graph, Operation* as node and use-relationship for edges; - Just basic graph output; * Add use iterator to iterate over all uses of an Operation; * Add testing pass to generate op graph; This does not support arbitrary operations other than function nor nested regions yet. PiperOrigin-RevId: 268121782
* [NFC] Rename ExpressedToUniformQuantizedType to ExpressedToQuantizedTypeFeng Liu2019-09-092-9/+8
| | | | PiperOrigin-RevId: 268090906
* Convert per channel fake quant attributes to typeFeng Liu2019-09-091-36/+102
| | | | | | | | For per channel fake quant attributes, the returned type should be UniformQuantizedPerAxisType. Currently, this method isn't under test because we haven't added the quant_ConstFakeQuantPerAxis op and the convert method. PiperOrigin-RevId: 268084017
* Explicitly declare the OpPassManager move constructor to avoid undefined errors.River Riddle2019-09-091-0/+1
| | | | | | Some compilers will try to auto-generate the destructor, instead of using the user provided destructor, when creating a default move constructor. PiperOrigin-RevId: 268067367
* Overload LLVM::TerminatorOp::build() for empty operands list.MLIR Team2019-09-091-8/+7
| | | | PiperOrigin-RevId: 268041584
* Add support for coalescing adjacent nested pass pipelines.River Riddle2019-09-093-91/+193
| | | | | | This allows for parallelizing across pipelines of multiple operation types. AdaptorPasses can now hold pass managers for multiple operation types and will dispatch based upon the operation being operated on. PiperOrigin-RevId: 268017344
* Addressing some late review comments on kernel inlining.Stephan Herhut2019-09-091-15/+15
| | | | | | Just formatting and better lit tests, no functional change. PiperOrigin-RevId: 267942907
* Add `parseGenericOperation()` to the OpAsmParserMehdi Amini2019-09-081-0/+17
| | | | | | | | | This method parses an operation in its generic form, from the current parser state. This is the symmetric of OpAsmPrinter::printGenericOp(). An immediate use case is illustrated in the test dialect, where an operation wraps another one in its region and makes use of a single-line pretty-print form. PiperOrigin-RevId: 267930869
* Refactor PassTiming to support nested pipelines.River Riddle2019-09-083-77/+187
| | | | | | This is done via a new set of instrumentation hooks runBeforePipeline/runAfterPipeline, that signal the lifetime of a pass pipeline on a specific operation type. These hooks also provide the parent thread of the pipeline, allowing for accurate merging of timers running on different threads. PiperOrigin-RevId: 267909193
* Refactor getUsedValuesDefinedAbove to expose a variant taking a callback (NFC)Mehdi Amini2019-09-071-8/+22
| | | | | | | This will allow clients to implement a different collection strategy on these values, including collecting each uses within the region for example. PiperOrigin-RevId: 267803978
* Set mlir-cpu-runner JIT codegen opt level correctlyUday Bondhugula2019-09-072-16/+41
| | | | | | | | | | | | - the JIT codegen was being run at the default -O0 level; instead, propagate the opt level from the cmd line. Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#123 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/123 from bondhugula:jit-runner 3b055e47f94c9a48bf487f6400787478738cda02 PiperOrigin-RevId: 267778586
* Wrap debug dump in LLVM_DEBUGMehdi Amini2019-09-071-4/+7
| | | | PiperOrigin-RevId: 267774506
* Restrict affine inlining to just Function operations.River Riddle2019-09-061-4/+6
| | | | | | The current restrictions on dim/symbols require a top-level symbol for the conservative case of a non-affine region. This should be relaxed in the future. PiperOrigin-RevId: 267641838
* Add custom builder for AffineIfOpNagy Mostafa2019-09-061-0/+11
| | | | | | | Closes tensorflow/mlir#109 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/109 from nmostafa:nmostafa/AffineIfOp 7dbf2115f0092ffab26381ea8704aa05a0253971 PiperOrigin-RevId: 267633077
* Simplify Linalg ABI integration with external function calls.Nicolas Vasilache2019-09-061-121/+123
| | | | | | | View descriptors are converted to *pointer to* LLVM struct to avoid ABI issues related to C struct packing. This creates unnecessary complexity and hampers unification with memrefs. Instead, this CL makes view descriptors convert to LLVM struct (as it was originally) and promotes all structs to pointers right before calling an external function. PiperOrigin-RevId: 267602693
OpenPOWER on IntegriCloud