summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * Make VariableOp instructions be in the first block in the function.Hanhan Wang2019-11-123-21/+111
| | | | | | | | | | | | | | | | | | | | | | Since VariableOp is serialized during processBlock, we add two more fields, `functionHeader` and `functionBody`, to collect instructions for a function. After all the blocks have been processed, we append them to the `functions`. Also, fix a bug in processGlobalVariableOp. The global variables should be encoded into `typesGlobalValues`. PiperOrigin-RevId: 280105366
| * Add operations needed to support lowering of AffineExpr to SPIR-V.Mahesh Ravishankar2019-11-122-15/+116
| | | | | | | | | | | | | | | | Lowering of CmpIOp, DivISOp, RemISOp, SubIOp and SelectOp to SPIR-V dialect enables the lowering of operations generated by AffineExpr -> StandardOps conversion into the SPIR-V dialect. PiperOrigin-RevId: 280039204
| * NFC: Change DictionaryAttr::get(StringRef) to use binary search instead of a ↵River Riddle2019-11-121-5/+7
| | | | | | | | | | | | | | | | linear scan. The elements of a DictionaryAttr are guaranteed to be sorted by name, so we can use a more efficient lookup when searching for an attribute. PiperOrigin-RevId: 280035488
| * Make legality check in GPU->SPIR-V lowering of FuncOp kernel specific.Mahesh Ravishankar2019-11-121-2/+7
| | | | | | | | | | | | | | | | | | | | Existing check that sets FuncOp to be dynamically legal was just checking that the types of the argument are SPIR-V compatible. Since the current conversion from GPU to SPIR-V does not handle lowering non-kernel functions, change the legality check to verify that the FuncOp has the gpu.kernel attribute and has void(void) return type. PiperOrigin-RevId: 280032782
| * Add support for OpPhi in loop header blockLei Zhang2019-11-125-9/+102
| | | | | | | | | | | | | | | | | | | | | | | | During deserialization, the loop header block will be moved into the spv.loop's region. If the loop header block has block arguments, we need to make sure it is correctly carried over to the block where the new spv.loop resides. During serialization, we need to make sure block arguments from the spv.loop's entry block are not silently dropped. PiperOrigin-RevId: 280021777
| * Add an option to print an operation if a diagnostic is emitted on itRiver Riddle2019-11-124-11/+60
| | | | | | | | | | | | It is often helpful to inspect the operation that the error/warning/remark/etc. originated from, especially in the context of debugging or in the case of a verifier failure. This change adds an option 'mlir-print-op-on-diagnostic' that attaches the operation as a note to any diagnostic that is emitted on it via Operation::emit(Error|Warning|Remark). In the case of an error, the operation is printed in the generic form. PiperOrigin-RevId: 280021438
| * Expose an isSubclassOf() method on AttrConstraintLei Zhang2019-11-122-11/+17
| | | | | | | | PiperOrigin-RevId: 280021408
| * Add Conversion to lower loop::ForOp to spirv::LoopOp.Mahesh Ravishankar2019-11-122-1/+122
| | | | | | | | | | | | | | | | | | loop::ForOp can be lowered to the structured control flow represented by spirv::LoopOp by making the continue block of the spirv::LoopOp the loop latch and the merge block the exit block. The resulting spirv::LoopOp has a single back edge from the continue to header block, and a single exit from header to merge. PiperOrigin-RevId: 280015614
| * [spirv] Properly return when finding error in serializationLei Zhang2019-11-121-4/+3
| | | | | | | | PiperOrigin-RevId: 280001339
| * Add a printer flag to use local scope when printing IR.River Riddle2019-11-125-13/+38
| | | | | | | | | | | | This causes the AsmPrinter to use a local value numbering when printing the IR, allowing for the printer to be used safely in a local context, e.g. to ensure thread-safety when printing the IR. This means that the IR printing instrumentation can also be used during multi-threading when module-scope is disabled. Operation::dump and DiagnosticArgument(Operation*) are also updated to always print local scope, as this is the most common use case when debugging. PiperOrigin-RevId: 279988203
| * Update textmate syntax fileJacques Pienaar2019-11-121-3/+8
| | | | | | | | | | | | Allow comments in more places and fix function params. PiperOrigin-RevId: 279986797
| * Update outdated comment for NativeCodeCallLei Zhang2019-11-121-2/+2
| | | | | | | | PiperOrigin-RevId: 279986050
| * Add LLVM lowering of std.subviewNicolas Vasilache2019-11-122-0/+139
| | | | | | | | | | | | A followup CL will replace usage of linalg.subview by std.subview. PiperOrigin-RevId: 279961981
| * Adds affine.min operation which returns the minimum value from a ↵Andy Davis2019-11-126-1/+193
| | | | | | | | | | | | multi-result affine map. This operation is useful for things like computing the dynamic value of affine loop bounds, and is trivial to constant fold. PiperOrigin-RevId: 279959714
| * Add support for alignment attribute in std.alloc.Nicolas Vasilache2019-11-1215-338/+487
| | | | | | | | | | | | | | | | | | | | | | | | This CL adds an extra pointer to the memref descriptor to allow specifying alignment. In a previous implementation, we used 2 types: `linalg.buffer` and `view` where the buffer type was the unit of allocation/deallocation/alignment and `view` was the unit of indexing. After multiple discussions it was decided to use a single type, which conflates both, so the memref descriptor now needs to carry both pointers. This is consistent with the [RFC-Proposed Changes to MemRef and Tensor MLIR Types](https://groups.google.com/a/tensorflow.org/forum/#!searchin/mlir/std.view%7Csort:date/mlir/-wKHANzDNTg/4K6nUAp8AAAJ). PiperOrigin-RevId: 279959463
| * Restructure comment lexing to not recurse.River Riddle2019-11-112-100/+95
| | | | | | | | | | | | In some files that have large amounts of comments, this can lead to a stack overflow. PiperOrigin-RevId: 279867330
| * Add support for nested symbol references.River Riddle2019-11-1138-83/+286
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change allows for adding additional nested references to a SymbolRefAttr to allow for further resolving a symbol if that symbol also defines a SymbolTable. If a referenced symbol also defines a symbol table, a nested reference can be used to refer to a symbol within that table. Nested references are printed after the main reference in the following form: symbol-ref-attribute ::= symbol-ref-id (`::` symbol-ref-id)* Example: module @reference { func @nested_reference() } my_reference_op @reference::@nested_reference Given that SymbolRefAttr is now more general, the existing functionality centered around a single reference is moved to a derived class FlatSymbolRefAttr. Followup commits will add support to lookups, rauw, etc. for scoped references. PiperOrigin-RevId: 279860501
| * Adds std.subview operation which takes dynamic offsets, sizes and strides ↵Andy Davis2019-11-1110-53/+338
| | | | | | | | | | | | | | | | and returns a memref type which represents sub/reduced-size view of its memref argument. This operation is a companion operation to the std.view operation added as proposed in "Updates to the MLIR MemRefType" RFC. PiperOrigin-RevId: 279766410
| * Also consider index constants when folding integer arithmetics with constants.Stephan Herhut2019-11-112-1/+46
| | | | | | | | PiperOrigin-RevId: 279698088
| * Fix segfault (nullptr dereference) when passing a non-existent file to the ↵Mehdi Amini2019-11-096-0/+12
| | | | | | | | | | | | | | | | Toy tutorial compiler Fix tensorflow/mlir#229 PiperOrigin-RevId: 279557863
| * Add a short TableGen HowTo to tutorial chapter 2.Manuel Freiberger2019-11-091-1/+14
| | | | | | | | | | | | | | | | | | | | | | Add a note to chapter 2 of the Toy tutorial stating how to invoke mlir-tblgen to check the generated C++ code. IMHO this is incredibly useful when getting acquainted with TableGen/ODS. Closes tensorflow/mlir#228 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/228 from ombre5733:toy-ch2-howto-mlir-tblgen a051a3734ca8bbf4f12027fe737aca07c64ca59d PiperOrigin-RevId: 279518989
| * Look for SymbolRefAttr in KernelOutlining instead of hard-coding CallOpMLIR Team2019-11-083-19/+37
| | | | | | | | | | | | | | | | This code should be exercised using the existing kernel outlining unit test, but let me know if I should add a dedicated unit test using a fake call instruction as well. PiperOrigin-RevId: 279436321
| * Explicitly initialize isRecursivelyLegalJacques Pienaar2019-11-081-1/+1
| | | | | | | | | | | | | | | | | | This also previously triggered the warning: warning: missing field 'isRecursivelyLegal' initializer [-Wmissing-field-initializers] legalOperations[op] = {action}; ^ PiperOrigin-RevId: 279399175
| * [spirv] Add bit opsDenis Khalikov2019-11-085-12/+410
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL added op definitions for a few bit operations: * OpShiftLeftLogical * OpShiftRightArithmetic * OpShiftRightLogical * OpBitCount * OpBitReverse * OpNot Also moved the definition of spv.BitwiseAnd to follow the lexicographical order. Closes tensorflow/mlir#215 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/215 from denis0x0D:sandbox/bit_ops d9b0852b689ac6c4879a9740b1740a2357f44d24 PiperOrigin-RevId: 279350470
| * Move description from GenericOpBase to linalg.(indexed_)generic.Alexander Belyaev2019-11-071-89/+187
| | | | | | | | PiperOrigin-RevId: 279173284
| * mlir-translate: support -verify-diagnosticsAlex Zinenko2019-11-077-62/+112
| | | | | | | | | | | | | | | | | | | | | | MLIR translation tools can emit diagnostics and we want to be able to check if it is indeed the case in tests. Reuse the source manager error handlers provided for mlir-opt to support the verification in mlir-translate. This requires us to change the signature of the functions that are registered to translate sources to MLIR: it now takes a source manager instead of a memory buffer. PiperOrigin-RevId: 279132972
| * Fix asm printer for affine exprUday Bondhugula2019-11-072-1/+10
| | | | | | | | | | | | | | | | | | | | | | - fixes tensorflow/mlir#201 Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#204 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/204 from bondhugula:printfix 3f8a5b65391f45598258b2735fecaa409fbde848 PiperOrigin-RevId: 279115720
| * Swap operand order in std.view operation so that offset appears before ↵Andy Davis2019-11-076-81/+95
| | | | | | | | | | | | dynamic sizes in the operand list. PiperOrigin-RevId: 279114236
| * Add Ch-7 of the toy tutorial detailing how to define new types.River Riddle2019-11-0736-1/+5428
| | | | | | | | | | | | This chapter adds a new composite type to Toy, and shows the process of adding a new type to the IR, adding and updating operations to use it, and constant folding operations producing it. PiperOrigin-RevId: 279107885
| * Add canonicalizer for ViewOp which folds constants into the ViewOp memref ↵Andy Davis2019-11-073-1/+160
| | | | | | | | | | | | shape and layout map strides and offset. PiperOrigin-RevId: 279088023
| * Fix parameter name and document option in linalg::promoteSubViewsNicolas Vasilache2019-11-071-2/+3
| | | | | | | | PiperOrigin-RevId: 279086352
| * Add compatible query method to infer type interfaceJacques Pienaar2019-11-076-10/+59
| | | | | | | | | | | | | | | | A return type that differs from the inferred return type need not indicate that an operation is invalid (e.g., tensor<*xf32> vs tensor<10xf32>) but they should be compatible for the operation to be considered valid. Add method to query if inferred type is compatible with return type. Also add InferTypeOpIntefaceDefault trait that considers equality and compatibility as the same. Currently an op has to opt in to using it explicitly. PiperOrigin-RevId: 279085639
| * Update Linalg to use std.viewNicolas Vasilache2019-11-0717-853/+149
| | | | | | | | | | | | Now that a view op has graduated to the std dialect, we can update Linalg to use it and remove ops that have become obsolete. As a byproduct, the linalg buffer and associated ops can also disappear. PiperOrigin-RevId: 279073591
| * Add IndexedGenericOp to Linalg.Alexander Belyaev2019-11-065-33/+169
| | | | | | | | PiperOrigin-RevId: 279013404
| * NFC: Tidy up the implementation of operations in the Toy tutorialRiver Riddle2019-11-0611-208/+251
| | | | | | | | | | | | Use header blocks to separate operation implementations, and switch the build methods to be out-of-line when possible. PiperOrigin-RevId: 278982913
| * NFC: Uniformize parser naming scheme in Toy tutorial to camelCase and tidy a ↵River Riddle2019-11-0636-1306/+1225
| | | | | | | | | | | | bit of the implementation. PiperOrigin-RevId: 278982817
| * Replace some remnant uses of "inst" with "op".Sean Silva2019-11-069-59/+56
| | | | | | | | PiperOrigin-RevId: 278961676
| * Drop spurious test fileNicolas Vasilache2019-11-061-25/+0
| | | | | | | | PiperOrigin-RevId: 278959717
| * Add lowering of std.view to LLVMNicolas Vasilache2019-11-064-1/+257
| | | | | | | | | | | | | | | | | | | | | | | | | | This CL ports the lowering of linalg.view to the newly introduced std.view. Differences in implementation relate to std.view having slightly different semantics: 1. a static or dynamic offset can be specified. 2. the size of the (contiguous) shape is passed instead of a range. 3. static size and stride information is extracted from the memref type rather than the range. Besides these differences, lowering behaves the same. A future CL will update Linalg to use this unified infrastructure. PiperOrigin-RevId: 278948853
| * Add affine load/store/dma_start/dma_wait to dialect doc.Andy Davis2019-11-061-0/+136
| | | | | | | | PiperOrigin-RevId: 278941483
| * Adding an m_NonZero constant integer matcher.Ben Vanik2019-11-062-23/+30
| | | | | | | | | | | | This is useful for making matching cases where a non-zero value is required more readable, such as the results of a constant comparison that are expected to be equal. PiperOrigin-RevId: 278932874
| * Add ViewOp verification for dynamic strides, and address some comments from ↵Andy Davis2019-11-064-23/+57
| | | | | | | | | | | | previous change. PiperOrigin-RevId: 278903187
| * [DRR] List some limitations clearly in the docLei Zhang2019-11-061-2/+13
| | | | | | | | PiperOrigin-RevId: 278882517
| * Add ViewOp to the StandardOps dialect, which casts a 1D/i8 element type ↵Andy Davis2019-11-066-4/+228
| | | | | | | | | | | | | | | | | | | | | | memref type to an N-D memref type. Proposed in RFC: https://groups.google.com/a/tensorflow.org/forum/#!searchin/mlir/std.view%7Csort:date/mlir/-wKHANzDNTg/4K6nUAp8AAAJ Supports creating the N-D memref type with dynamic sizes and at a dynamic offset within the 1D base memref. This change contains op definition/parsing/printing and tests. Follow up changes will handle constant shape/layout map folding and llvm lowering. PiperOrigin-RevId: 278869990
| * Add support for the LLVM FNeg instructionEric Schweitz2019-11-063-0/+16
| | | | | | | | | | | | | | Closes tensorflow/mlir#216 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/216 from schweitzpgi:llvmir-fneg-op f9b5f185845d671b745ab6fc213d5d9aff044b34 PiperOrigin-RevId: 278795325
| * NFC: Remove an extra space when printing the 'attributes' prefix before a ↵River Riddle2019-11-051-1/+1
| | | | | | | | | | | | dictionary. PiperOrigin-RevId: 278795313
| * Add (parse|print)OptionalAttrDictWithKeyword hooks to simplify parsing ↵River Riddle2019-11-056-45/+51
| | | | | | | | | | | | | | | | attribute dictionaries with regions. Many operations with regions add an additional 'attributes' prefix when printing the attribute dictionary to differentiate it from the region body. This leads to duplicated logic for detecting when to actually print the attribute dictionary. PiperOrigin-RevId: 278747681
| * Fix typos in the Standard Dialect documentationRoberto Rosmaninho2019-11-051-2/+2
| | | | | | | | | | | | | | | | | | | | "sgt" and "ult" used twice the second "slt" should be "sge" for signed greater than or equal the second "ult" should be "ule" unsigned less than or equal Closes tensorflow/mlir#223 PiperOrigin-RevId: 278745410
| * [llvm] Allow GlobalOp to take a region for complex initializersJames Molloy2019-11-058-29/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows GlobalOp to either take a value attribute (for simple constants) or a region that can contain IR instructions (that must be constant-foldable) to create a ConstantExpr initializer. Example: // A complex initializer is constructed with an initializer region. llvm.mlir.global constant @int_gep() : !llvm<"i32*"> { %0 = llvm.mlir.addressof @g2 : !llvm<"i32*"> %1 = llvm.mlir.constant(2 : i32) : !llvm.i32 %2 = llvm.getelementptr %0[%1] : (!llvm<"i32*">, !llvm.i32) -> !llvm<"i32*"> llvm.return %2 : !llvm<"i32*"> } PiperOrigin-RevId: 278717836
| * [llvm] Add initial import of LLVM modules to mlir-translateJames Molloy2019-11-055-2/+754
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds an importer from LLVM IR or bitcode to the LLVM dialect. The importer is registered with mlir-translate. Known issues exposed by this patch but not yet fixed: * Globals' initializers are attributes, which makes it impossible to represent a ConstantExpr. This will be fixed in a followup. * icmp returns i32 rather than i1. * select and a couple of other instructions aren't implemented. * llvm.cond_br takes its successors in a weird order. The testing here is known to be non-exhaustive. I'd appreciate feedback on where this functionality should live. It looks like the translator *from MLIR to LLVM* lives in Target/, but the SPIR-V deserializer lives in Dialect/ which is why I've put this here too. PiperOrigin-RevId: 278711683
OpenPOWER on IntegriCloud