summaryrefslogtreecommitdiffstats
path: root/mlir/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Change the return type of createPrintCFGGraphPass to match other passes.Jing Pu2019-09-251-4/+4
| | | | PiperOrigin-RevId: 271252404
* [spirv] Add SPV_UnaryOp and spv.FNegateLei Zhang2019-09-251-57/+56
| | | | | | | This CL also moves common parsers and printers to the same section in SPIRVOps.cpp. PiperOrigin-RevId: 271233546
* Miscellaneous fixes to SPIR-V Deserializer (details below).Mahesh Ravishankar2019-09-241-4/+17
| | | | | | | | | | | | | | | 1) Process and ignore the following debug instructions: OpSource, OpSourceContinued, OpSourceExtension, OpString, OpModuleProcessed. 2) While processing OpTypeInt instruction, ignore the signedness specification. Currently MLIR doesnt make a distinction between signed and unsigned integer types. 3) Process and ignore BufferBlock decoration (similar to Buffer decoration). StructType needs to be enhanced to track this attribute since its needed for proper validation checks. 4) Report better error for unhandled instruction during deserialization. PiperOrigin-RevId: 271057060
* [spirv] Replace bitwiseCast with llvm::bit_castLei Zhang2019-09-241-11/+3
| | | | PiperOrigin-RevId: 271035618
* Introduce splat op + provide its LLVM loweringUday Bondhugula2019-09-242-25/+96
| | | | | | | | | | | | | | | - introduce splat op in standard dialect (currently for int/float/index input type, output type can be vector or statically shaped tensor) - implement LLVM lowering (when result type is 1-d vector) - add constant folding hook for it - while on Ops.cpp, fix some stale names Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#141 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/141 from bondhugula:splat 48976a6aa0a75be6d91187db6418de989e03eb51 PiperOrigin-RevId: 270965304
* Normalize lowering of MemRef typesNicolas Vasilache2019-09-241-127/+58
| | | | | | | | | | | | | | | | The RFC for unifying Linalg and Affine compilation passes into an end-to-end flow with a predictable ABI and linkage to external function calls raised the question of why we have variable sized descriptors for memrefs depending on whether they have static or dynamic dimensions (https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/MaL8m2nXuio). This CL standardizes the ABI on the rank of the memrefs. The LLVM struct for a memref becomes equivalent to: ``` template <typename Elem, size_t Rank> struct { Elem *ptr; int64_t sizes[Rank]; }; ``` PiperOrigin-RevId: 270947276
* Clone called functions into nested GPU module.Christian Sigg2019-09-241-7/+31
| | | | PiperOrigin-RevId: 270891190
* Allow null Attribute for value when building GlobalOp.Christian Sigg2019-09-241-1/+2
| | | | PiperOrigin-RevId: 270853596
* Make spirv::RuntimeArrayType part of spirv::CompositeType.Mahesh Ravishankar2019-09-231-0/+17
| | | | | | | According to SPIR-V spec, spirv::CompositeType includes spirv::RuntimeArrayType. This allows using objects of spirv::RuntimeArrayType with spirv::AccessChainOp. PiperOrigin-RevId: 270809492
* Let mlir-translate support -split-input-fileLei Zhang2019-09-233-38/+71
| | | | | | | | Similar to mlir-opt, having a -split-input-file mode is quite useful in mlir-translate. It allows to put logically related tests in the same test file for better organization. PiperOrigin-RevId: 270805467
* Handle OpMemberName instruction in SPIR-V deserializer.Mahesh Ravishankar2019-09-233-28/+52
| | | | | | | | | | Sdd support in deserializer for OpMemberName instruction. For now the name is just processed and not associated with the spirv::StructType being built. That needs an enhancement to spirv::StructTypes itself. Add tests to check for errors reported during deserialization with some refactoring to common out some utility functions. PiperOrigin-RevId: 270794524
* Use constant's location for reporting errors in parsing of hex constantJacques Pienaar2019-09-231-12/+19
| | | | | | Before this the line following the error would be reported in some cases. PiperOrigin-RevId: 270778722
* Simplify the way spirv::StructTypes are parsed.Mahesh Ravishankar2019-09-234-132/+94
| | | | | | | | | | | | | The existing logic to parse spirv::StructTypes is very brittle. This change simplifies the parsing logic a lot. The simplification also allows for memberdecorations to be separated by commas instead of spaces (which was an artifact of the existing parsing logic). The change also needs a modification to mlir::parseType to return the number of chars parsed. Adding a new parseType method to do so. Also allow specification of spirv::StructType with no members. PiperOrigin-RevId: 270739672
* Add convenience methods to set an OpBuilder insertion point after an ↵Mehdi Amini2019-09-232-4/+2
| | | | | | Operation (NFC) PiperOrigin-RevId: 270727180
* Add initial callgraph support.River Riddle2019-09-232-0/+242
| | | | | | | | | | | | | | Using the two call interfaces, CallOpInterface and CallableOpInterface, this change adds support for an initial multi-level CallGraph. This call graph builds a set of nodes for each callable region, and connects them via edges. An edge may be any of the following types: * Abstract - An edge not produced by a call operation, used for connecting to internal nodes from external nodes. * Call - A call edge is an edge defined via a call-like operation. * Child - This is an artificial edge connecting nested callgraph nodes. This callgraph will be used, and improved upon, to begin supporting more interesting interprocedural analyses and transformation. In a followup, this callgraph will be used to support more complex inlining support. PiperOrigin-RevId: 270724968
* Add interfaces for call-like/callable operations.River Riddle2019-09-235-4/+46
| | | | | | | | | | | These two operation interfaces will be used in a followup to support building a callgraph: * CallOpInterface - Operations providing this interface are call-like, and have a "call" target. A call target may be a symbol reference, via SymbolRefAttr, or a SSA value. * CallableOpInterface - Operations providing this interfaces define destinations to call-like operations, e.g. FuncOp. These operations may define any number of callable regions. PiperOrigin-RevId: 270723300
* Refactor DiagnosticEngine to support multiple registered diagnostic handlers.River Riddle2019-09-231-67/+69
| | | | | | | | | | | | This fixes a problem with current save-restore pattern of diagnostics handlers, as there may be a thread race between when the previous handler is destroyed. For example, this occurs when using multiple ParallelDiagnosticHandlers asynchronously: Handler A Handler B | - LifeTime - | Restore A here. Handler C | --- LifeTime ---| Restore B after it has been destroyed. The new design allows for multiple handlers to be registered in a stack like fashion. Handlers can return success() to signal that they have fully processed a diagnostic, or failure to propagate otherwise. PiperOrigin-RevId: 270720625
* NFC: Fix warning for uninitialized field.River Riddle2019-09-231-1/+3
| | | | PiperOrigin-RevId: 270704572
* Add variants of interleave that take separatorJacques Pienaar2019-09-231-3/+1
| | | | | | Make the common case of string separator easier to specify. PiperOrigin-RevId: 270697581
* Outline GPU kernel function into a nested module.Christian Sigg2019-09-234-81/+112
| | | | | | | | Roll forward of commit 5684a12. When outlining GPU kernels, put the kernel function inside a nested module. Then use a nested pipeline to generate the cubins, independently per kernel. In a final pass, move the cubins back to the parent module. PiperOrigin-RevId: 270639748
* Fix a number of Clang-Tidy warnings.Christian Sigg2019-09-2320-35/+33
| | | | PiperOrigin-RevId: 270632324
* Fix undefined reference to mlir::getElementTypeOrSelf(mlir::Type)Denis Khalikov2019-09-221-2/+2
| | | | | | | | | | | Fix undefined reference: mlir/lib/Dialect/StandardOps/Ops.cpp:2029: undefined reference to `mlir::getElementTypeOrSelf(mlir::Type)' Closes tensorflow/mlir#144 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/144 from denis0x0D:sandbox/fix_undef 494d4f7fa2e98ba21954d2b2f7ec1776b9397e08 PiperOrigin-RevId: 270545190
* Add integer sign- and zero-extension and truncation to standard.Manuel Freiberger2019-09-212-2/+85
| | | | | | | | | | | | This adds sign- and zero-extension and truncation of integer types to the standard dialects. This allows to perform integer type conversions without having to go to the LLVM dialect and introduce custom type casts (between standard and LLVM integer types). Closes tensorflow/mlir#134 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/134 from ombre5733:sext-zext-trunc-in-std c7657bc84c0ca66b304e53ec03797e09152e4d31 PiperOrigin-RevId: 270479722
* [spirv] Add OpControlBarrier and OpMemoryBarrier.Denis Khalikov2019-09-213-11/+186
| | | | | | | | | Add OpControlBarrier and OpMemoryBarrier (de)serialization. Closes tensorflow/mlir#130 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/130 from denis0x0D:sandbox/memory_barrier 2e3fff16bca44904dc1039592cb9a65d526faea8 PiperOrigin-RevId: 270457478
* Upgrade/fix/simplify store to load forwardingUday Bondhugula2019-09-214-121/+72
| | | | | | | | | | | | | | | | - fix store to load forwarding for a certain set of cases (where forwarding shouldn't have happened); use AffineValueMap difference based MemRefAccess equality checking; utility logic is also greatly simplified - add missing equality/inequality operators for AffineExpr ==/!= ints - add == != operators on MemRefAccess Closes tensorflow/mlir#136 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/136 from bondhugula:store-load-forwarding d79fd1add8bcfbd9fa71d841a6a9905340dcd792 PiperOrigin-RevId: 270457011
* Make GlobalOp's value attribute optional.Christian Sigg2019-09-212-13/+23
| | | | | | Make GlobalOp's value attribute an OptionalAttr. Change code that uses the value to handle 'nullopt'. Translate an unitialized value attribute to llvm::UndefValue. PiperOrigin-RevId: 270423646
* NFC: Pass OpAsmPrinter by reference instead of by pointer.River Riddle2019-09-2014-629/+627
| | | | | | MLIR follows the LLVM style of pass-by-reference. PiperOrigin-RevId: 270401378
* NFC: Pass OperationState by reference instead of by pointer.River Riddle2019-09-2015-649/+647
| | | | | | MLIR follows the LLVM convention of passing by reference instead of by pointer. PiperOrigin-RevId: 270396945
* Avoid iterator invalidation when recursively computing pattern depth.River Riddle2019-09-201-6/+9
| | | | | | computeDepth calls itself recursively, which may insert into minPatternDepth. minPatternDepth is a DenseMap, which invalidates iterators on insertion, so this may lead to asan failures. PiperOrigin-RevId: 270374203
* NFC: Pass OpAsmParser by reference instead of by pointer.River Riddle2019-09-2014-968/+955
| | | | | | MLIR follows the LLVM style of pass-by-reference. PiperOrigin-RevId: 270315612
* Use SmallVectorImpl in getStridesNicolas Vasilache2019-09-201-1/+1
| | | | | | No need to force a particular size on the user of the API. PiperOrigin-RevId: 270310570
* Add utility to extract strides from layout map in MemRefType.Nicolas Vasilache2019-09-201-0/+147
| | | | | | | | | | The RFC for unifying Linalg and Affine compilation passes into an end-to-end flow discusses the notion of a strided MemRef (https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/MaL8m2nXuio). This CL adds helper functions to extract strides from the layout map which in turn will allow converting between a strided form of the type and a layout map. For now strides are only computed on a single affine map with a single result (i.e. the closed subset of linearization maps that are compatible with striding semantics). This restriction will be reevaluated / lifted in the future based on concrete use cases. PiperOrigin-RevId: 270284686
* Allow specification of decorators on SPIR-V StructType members.Mahesh Ravishankar2019-09-194-107/+226
| | | | | | | | | | Allow specification of decorators on SPIR-V StructType members. If the struct has layout information, these decorations are to be specified after the offset specification of the member. These decorations are emitted as OpMemberDecorate instructions on the struct <id>. Update (de)serialization to handle these decorations. PiperOrigin-RevId: 270130136
* Automated rollback of commit 5684a12434f923d03b6870f2aa16226bfb0b38b6George Karpenkov2019-09-194-112/+81
| | | | PiperOrigin-RevId: 270126672
* Quantize attribute values by per axis quantization parametersFeng Liu2019-09-192-8/+55
| | | | | | | | | | | A new converter with per axis quantization parameters is added to quantize a dense elements attribute. For each slice along the quantization axis, it creates an uniform quantized value converter, with different scale and zero point, and quantizes the values in the slice. The current implementation doesn't handle sparse elements attributes. PiperOrigin-RevId: 270121986
* Add address space attribute to LLVMIR's GlobalOp.MLIR Team2019-09-191-3/+6
| | | | PiperOrigin-RevId: 270012505
* Outline GPU kernel function into a nested module.MLIR Team2019-09-194-81/+112
| | | | | | When outlining GPU kernels, put the kernel function inside a nested module. Then use a nested pipeline to generate the cubins, independently per kernel. In a final pass, move the cubins back to the parent module. PiperOrigin-RevId: 269987720
* NFC: Remove stray logging from ~Block().River Riddle2019-09-181-5/+0
| | | | PiperOrigin-RevId: 269941815
* Fix nested dominance relationship between parent results and child operations.River Riddle2019-09-182-1/+16
| | | | | | This modifies DominanceInfo::properlyDominates(Value *value, Operation *op) to return false if the value is defined by a parent operation of 'op'. This prevents using values defined by the parent operation from within any child regions. PiperOrigin-RevId: 269934920
* Support symbolic operands for memref replacement; fix memrefNormalizeUday Bondhugula2019-09-184-9/+25
| | | | | | | | | | | | | - allow symbols in index remapping provided for memref replacement - fix memref normalize crash on cases with layout maps with symbols Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Reported by: Alex Zinenko Closes tensorflow/mlir#139 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/139 from bondhugula:memref-rep-symbols 2f48c1fdb5d4c58915bbddbd9f07b18541819233 PiperOrigin-RevId: 269851182
* Unify error messages to start with lower-case.MLIR Team2019-09-186-10/+10
| | | | PiperOrigin-RevId: 269803466
* SDBM: support sum expressions on the LHS of stripe expressionsAlex Zinenko2019-09-182-13/+17
| | | | | | | | | Introduce support for applying the stripe operator to sum expressions, as in (x + A) # B = x + A - (x + A) mod B. This is required to represent a combination of tiling and padding in the SDBM framework, and is a valid SDBM construct that was not originally supported. PiperOrigin-RevId: 269758807
* Simplify SDBM expressions more aggressively in operators and conversionsAlex Zinenko2019-09-181-32/+52
| | | | | | | | | | | | Extend SDBM simplification patterns to support more cases where the addition of two expressions each involving one or two variables would result in a sum expression that only contains one variable and thus remains in the SDBM domain. This is made possible by the new canonical structure of SDBM where the constant term appears once. This simplification will be necessary to support round-tripping of stripe expressions containing constant terms on the LHS through affine expressions. PiperOrigin-RevId: 269757732
* Add support to OpAsmParser for parsing unknown keywords.River Riddle2019-09-173-18/+29
| | | | | | This is useful in several cases, for example a user may want to sugar the syntax of a string(as we do with custom operation syntax), or avoid many nested ifs for parsing a set of known keywords. PiperOrigin-RevId: 269695451
* Add (de)serialization support for OpRuntimeArray.Mahesh Ravishankar2019-09-172-0/+31
| | | | | | Update the SPIR-V (de)serialization to handle RuntimeArrayType. PiperOrigin-RevId: 269667196
* Register a -test-spirv-roundtrip hook to mlir-translateLei Zhang2019-09-174-134/+158
| | | | | | | | | | 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
* Support file-to-file translation in mlir-translateLei Zhang2019-09-172-1/+29
| | | | | | | | | | | | | 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-175-77/+41
| | | | | | | | | | 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-175-39/+84
| | | | | | | | | | | | | | | | | | | | | | | | - 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
OpenPOWER on IntegriCloud