summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * Update UndefOp (de)serialization to generate OpUndef at module level.Mahesh Ravishankar2019-10-075-18/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | The SPIR-V spec recommends all OpUndef instructions be generated at module level. For the SPIR-V dialect its better for UndefOp to produce an SSA value for use with other instructions. If UndefOp is to be used at module level, it cannot produce an SSA value (use of this SSA value within FuncOp would need implicit capture). To satisfy needs of the SPIR-V spec while making it simpler to represent UndefOp in the SPIR-V dialect, the serialization is updated to create OpUndef instruction at module scope. PiperOrigin-RevId: 273355526
| * [spirv] Fix function entry block erase after moving to spv.selectionLei Zhang2019-10-074-39/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The structured selection/loop's entry block does not have arguments. If the function's header block is also part of the structured control flow, we cannot just simply erase it because it may contain arguments matching the function signature and used by the cloned blocks. Instead, turn it into a block only containing a spv.Branch op. Also, we can directly emit instructions for the spv.selection header block to the block containing the spv.selection op. This eliminates unnecessary branches in the SPIR-V blob. Added a test for nested spv.loop. PiperOrigin-RevId: 273351424
| * fix simplify-affine-structures bugUday Bondhugula2019-10-072-9/+20
| | | | | | | | | | | | | | | | | | Signed-off-by: Uday Bondhugula <uday@polymagelabs.com> Closes tensorflow/mlir#157 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/157 from bondhugula:quickfix bd1fcd79825fc0bd5b4a3e688153fa0993ab703d PiperOrigin-RevId: 273316498
| * Change Block::getParent() to be a const function. This is only necessary ↵Christian Sigg2019-10-073-4/+10
| | | | | | | | | | | | because ilist_node_with_parent specifically requires a 'getParent() const' method. If/When ilist_node removes this constraint we should drop the const to fit the rest of the MLIR const model. PiperOrigin-RevId: 273316153
| * Fix a comment in the OperationInterface example.Stephan Herhut2019-10-071-1/+1
| | | | | | | | PiperOrigin-RevId: 273308494
| * Start a minimal mlir_utils runtime library for testing debugging purposesNicolas Vasilache2019-10-077-40/+309
| | | | | | | | | | | | | | | | | | | | | | Now that MLIR has a standardized StridedMemRef descriptor, it becomes very easy to interact with external library functions and build utilities directly in C++. This CL introduces basic printing support in a libmlir_utils.so. Unit tests are rewritten using this feature and also to improve coverage. For now, C mandates that we have a unique function for each MemRef element type and rank. In a future a simple unranked descriptor can be introduced to only require uniqu'ing by element type. PiperOrigin-RevId: 273304741
| * Support AllocOp terminal in Linalg::AliasAnalysis.Nicolas Vasilache2019-10-073-0/+49
| | | | | | | | | | | | | | | | Now that linalg.view and strided memrefs are unified, there is no reason to disallow AllocOp in alias analysis. This CLs adds support for AllocOp which allows writing shorter tests that do not require explicitly creating a view for each operation. PiperOrigin-RevId: 273303060
| * Add DialectType and generate docs for dialect typesJacques Pienaar2019-10-076-20/+74
| | | | | | | | | | | | Add new `typeDescription` (description was already used by base constraint class) field to type to allow writing longer descriptions about a type being defined. This allows for providing additional information/rationale for a defined type. This currently uses `description` as the heading/name for the type in the generated documentation. PiperOrigin-RevId: 273299332
| * Fix CMake build after adding TestOpaqueLoc.cppNicolas Vasilache2019-10-071-0/+1
| | | | | | | | PiperOrigin-RevId: 273296399
| * Add OpaqueLoc to MLIR locations.MLIR Team2019-10-079-7/+272
| | | | | | | | | | | | | | | | | | See RFC: https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/xE2IzfhE3Wg. Opaque location stores two pointers, one of them points to some data structure that is external to MLIR, and the other one is unique for each type and represents type id of that data structure. OpaqueLoc also stores an optional location that can be used if the first one is not suitable. OpaqueLoc is managed similar to FileLineColLoc. It is passed around by MLIR transformations and can be used in compound locations like CallSiteLoc. PiperOrigin-RevId: 273266510
| * Support reduction of partial warps.Christian Sigg2019-10-072-91/+162
| | | | | | | | | | | | gpu.all_reduce now supports block sizes that are not multiple of 32. PiperOrigin-RevId: 273255204
| * Enable emitting dialect summary & description during op generationJacques Pienaar2019-10-054-14/+82
| | | | | | | | | | | | Sort ops per dialect and emit summary & description (if provided) of each dialect before emitting the ops of the dialect. PiperOrigin-RevId: 273077138
| * Allow element type traits to operate on scalarsGeoffrey Martin-Noble2019-10-055-32/+40
| | | | | | | | | | | | | | | | This allows confirming that a scalar argument has the same element type as a shaped one. It's easy to validate a type is shaped on its own if that's desirable, so this shouldn't make that use case harder. This matches the behavior of other traits that operate on element type (e.g. AllElementTypesMatch). Also this makes the code simpler because now we just use getElementTypeOrSelf. Verified that all uses in core already check the type is shaped in another way. PiperOrigin-RevId: 273068507
| * NFC: Cleanup test ops and traits testsGeoffrey Martin-Noble2019-10-052-92/+99
| | | | | | | | | | | | | | | | | | 1. Rename a few ops to make it clear they operate on *element* types. 2. Remove unused and generic operand and result ODS names (e.g. $res, $arg, $input). These are just clutter and don't make the op definitions any clearer. 3. Give test cases with duplicate names clearer names. 4. Add missing test case for no operands in SameOperandAndResultElementType. PiperOrigin-RevId: 273067933
| * [spirv] Allow return ops to be in control flow opsLei Zhang2019-10-042-2/+68
| | | | | | | | | | | | | | Use `getParentOfType<FunctionOp>()` instead of `cast<FuncOp>(getParentOp())` to avoid crash when return ops are used inside spv.selection/spv.loop. PiperOrigin-RevId: 273006041
| * Add missing dependency on the TypeInferOpInterface from the Test dialectMehdi Amini2019-10-041-0/+1
| | | | | | | | | | | | | | | | | | This is fixing a build failure, usually non-deterministic because of parallelism in the build, but could be reliably reproduced: ninja projects/mlir/test/lib/TestDialect/CMakeFiles/MLIRTestDialect.dir/TestPatterns.cpp.o PiperOrigin-RevId: 272998436
| * Add spv.Undef op to support OpUndef instruction in SPIR-V.Mahesh Ravishankar2019-10-046-4/+101
| | | | | | | | | | | | | | | | Adding support for OpUndef instruction. Updating the dialect generation script to fix a few bugs in the instruction spec generation. PiperOrigin-RevId: 272975685
| * Add some utility builder functions for SPIR-V operations.Mahesh Ravishankar2019-10-045-12/+73
| | | | | | | | | | | | | | | | | | | | | | Add builder functions for spv._address_of, spv.EntryPoint, spv.ExecutionMode and spv.Load to make it easier to create these operations. Fix a minor bug in printing of spv.EntryPoint Add a utility function to get the attribute name associated with a decoration. PiperOrigin-RevId: 272952846
| * Replace constexpr MemRefType::kDynamicStrideOrOffset by a ↵Nicolas Vasilache2019-10-045-21/+22
| | | | | | | | | | | | | | | | | | | | MemRefType:;getDynamicStrideOrOffset() method - NFC This fixes global ODR-use issues, some of which manifest in Parser.cpp. Fixes tensorflow/mlir#167. PiperOrigin-RevId: 272886347
| * Add missing Linalg lowerings to allow roundtrip.mlir to lower to LLVMNicolas Vasilache2019-10-044-27/+59
| | | | | | | | | | | | | | | | | | | | | | | | Certain lowering patterns were reported as [missing](https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/dkdmHa77sSQ). This CL adds them and allows Linalg/roundtrip.mlir and Linalg/loops.mlir to lower to LLVM directly. Those 2 tests are updated to additionally check that the direct lowering to LLVM does not crash. The following points, left as TODOs still need to be addressed for correct end-to-end execution: 1. the lowering for ConvOp needs to pass attributes such as strides and dilations; the external library call needs to support it. 2. the lowering for GenericOp needs to support lowering to loops as a DialectConversion pattern. This is blocked on the DialectConversion infrastructure accepting an OperationFolder. PiperOrigin-RevId: 272878131
| * Moving the GPUIndexIntrinsicOpLowering template to a common locationDeven Desai2019-10-043-139/+96
| | | | | | | | | | | | | | | | | | | | The GPUIndexIntrinsicOpLowering template is currently used by the code in both the GPUToNVVM and GPUToROCDL dirs. Moving it to a common location to remove code duplication. Closes tensorflow/mlir#163 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/163 from deven-amd:deven-refactor-gpu-index-ops-lowering b8dc2a5f5353df196039b6ff2ad42106028693ed PiperOrigin-RevId: 272863297
| * Fix typos, NFC.Christian Sigg2019-10-0444-75/+75
| | | | | | | | PiperOrigin-RevId: 272851237
| * Add support for inlining calls with different arg/result types from the ↵River Riddle2019-10-038-57/+228
| | | | | | | | | | | | | | | | callable. Some dialects have implicit conversions inherent in their modeling, meaning that a call may have a different type that the type that the callable expects. To support this, a hook is added to the dialect interface that allows for materializing conversion operations during inlining when there is a mismatch. A hook is also added to the callable interface to allow for introspecting the expected result types. PiperOrigin-RevId: 272814379
| * Update the Inliner pass to work on SCCs of the CallGraph.River Riddle2019-10-036-27/+214
| | | | | | | | | | | | This allows for the inliner to work on arbitrary call operations. The updated inliner will also work bottom-up through the callgraph enabling support for multiple levels of inlining. PiperOrigin-RevId: 272813876
| * Add `axis` attribute to the quant.stats opFeng Liu2019-10-035-15/+43
| | | | | | | | | | | | | | The first dim length of the axisStats attribute should equals to the slice size of the input argument when splitted by the axis dimension. PiperOrigin-RevId: 272798042
| * Add fpext and fptrunc to the Standard dialect and includes conversion to LLVMMLIR Team2019-10-036-6/+167
| | | | | | | | PiperOrigin-RevId: 272768027
| * Generalize parse/printBinaryOp to parse/printOneResultOp.Christian Sigg2019-10-037-21/+23
| | | | | | | | PiperOrigin-RevId: 272722539
| * Add syntactic sugar for strided memref parsing.Nicolas Vasilache2019-10-0314-255/+408
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL implements the last remaining bit of the [strided memref proposal](https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/MaL8m2nXuio). The syntax is a bit more explicit than what was originally proposed and resembles: `memref<?x?xf32, offset: 0 strides: [?, 1]>` Nonnegative strides and offsets are currently supported. Future extensions will include negative strides. This also gives a concrete example of syntactic sugar for the ([RFC] Proposed Changes to MemRef and Tensor MLIR Types)[https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/-wKHANzDNTg]. The underlying implementation still uses AffineMap layout. PiperOrigin-RevId: 272717437
| * Make Module::getName return Optional<StringRef>Alex Zinenko2019-10-033-19/+18
| | | | | | | | | | | | | | | | Module names are optional so it makes more sense to take and return an optional any time the name is involved. Also update the language reference to reflect the module names. PiperOrigin-RevId: 272684698
| * Give modules a nameAlex Zinenko2019-10-033-10/+50
| | | | | | | | | | | | | | | | | | | | Modules are now Ops and, as such, can be nested. They do not produce an SSA value so there is no possibility to refer to them in the IR. Introduce support for symbol names attached to the module Op so that it can be referred to using SymbolRefAttrs. The name is optional, for example the implicit top-level module does not have a name. PiperOrigin-RevId: 272671600
| * Add parentheses around boolean operators in assertAlex Zinenko2019-10-031-2/+3
| | | | | | | | | | | | This removes a warning and is generally a good practice. PiperOrigin-RevId: 272613597
| * NFC: rename Conversion/ControlFlowToCFG to Conversion/LoopToStandardAlex Zinenko2019-10-0314-30/+31
| | | | | | | | | | | | | | | | This makes the name of the conversion pass more consistent with the naming scheme, since it actually converts from the Loop dialect to the Standard dialect rather than working with arbitrary control flow operations. PiperOrigin-RevId: 272612112
| * Disallow index types in memrefs.Alex Zinenko2019-10-033-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As specified in the MLIR language reference and rationale documents, `memref` types should not be allowed to have `index` as element types. As observed in https://groups.google.com/a/tensorflow.org/forum/#!msg/mlir/P49hVWqTMNc/nW89a4i_AgAJ this restriction was lifted when canonicalization unit tests for affine operations were introduced, without sufficient motivation to lift the restriction itself. The test in question can be trivially rewritten (return the value from a function instead of storing it to prevent DCE from removing the producer operation) and the restriction put back in place. If `memref<...x index>` is relevant for some use cases, the relaxation of the type system can be implemented separately with appropriate modifications to the documentation. PiperOrigin-RevId: 272607043
| * Extract MemRefType::getStridesAndOffset as a free function and fix dynamic ↵Nicolas Vasilache2019-10-026-42/+50
| | | | | | | | | | | | | | | | offset determination. This also adds coverage with a missing test, which uncovered a bug in the conditional for testing whether an offset is dynamic or not. PiperOrigin-RevId: 272505798
| * [spirv] Add support for spv.selectionLei Zhang2019-10-028-93/+604
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to spv.loop, spv.selection is another op for modelling SPIR-V structured control flow. It covers both OpBranchConditional and OpSwitch with OpSelectionMerge. Instead of having a `spv.SelectionMerge` op to directly model selection merge instruction for indicating the merge target, we use regions to delimit the boundary of the selection: the merge target is the next op following the `spv.selection` op. This way it's easier to discover all blocks belonging to the selection and it plays nicer with the MLIR system. PiperOrigin-RevId: 272475006
| * Fix example in OpInterfaces documentationAlex Zinenko2019-10-021-16/+19
| | | | | | | | | | | | | | | | | | The concept-based polymorphism structure was missing an inheritance link between the concept and the model. The interface class did not re-export the base class constructor, which made it unusable with llvm::isa calls. Fix these and reformat the code around. PiperOrigin-RevId: 272452062
| * Replace spurious `long` stride type by int64_t - NFCNicolas Vasilache2019-10-021-1/+1
| | | | | | | | PiperOrigin-RevId: 272425434
| * [ROCm] Adding pass to lower GPU Dialect to ROCDL Dialect.Deven Desai2019-10-026-0/+229
| | | | | | | | | | | | | | | | | | This is a follow-up to the PRtensorflow/mlir#146 which introduced the ROCDL Dialect. This PR introduces a pass to lower GPU Dialect to the ROCDL Dialect. As with the previous PR, this one builds on the work done by @whchung, and addresses most of the review comments in the original PR. Closes tensorflow/mlir#154 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/154 from deven-amd:deven-lower-gpu-to-rocdl 809893e08236da5ab6a38e3459692fa04247773d PiperOrigin-RevId: 272390729
| * Show type even if elementsattr is elided in graphJacques Pienaar2019-10-021-2/+4
| | | | | | | | | | | | The type is quite useful for debugging and shouldn't be too large. PiperOrigin-RevId: 272390311
| * [spirv] Change enum case uniquing in gen_spirv_dialect.pyLei Zhang2019-10-012-21/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In SPIR-V we can have multiple symbols corresponding to the same enum value. This is because when an extension is introduced into the core spec, its suffix is typically removed, e.g., 'VulkanKHR' memory model becomes 'Vulkan' memory model in SPIR-V 1.5. Previously we just keep the first symbol for an enum value. That symbol is not necessarily a better one. This CL changes to sort symbols, grouped by enum values, alphabetically and then keep the first one, which is typically shorter and without the extension suffix. We also fix up certain ones like HlslSemanticGOOGLE. PiperOrigin-RevId: 272290363
| * Add a pair of hooks to DominanceInfo.Eric Schweitz2019-10-012-0/+17
| | | | | | | | | | | | | | | | | | This exposes hooks for accessing internal dominance nodes, and updating the internal DFS numbers. Closes tensorflow/mlir#151 COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/mlir/pull/151 from schweitzpgi:dominance_hooks 69d14214a423b816cbd59feffcacdd02f3b5f921 PiperOrigin-RevId: 272287352
| * Fix and simplify CallOp/CallIndirectOp to LLVM::CallOp conversionAlex Zinenko2019-10-012-38/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A recent ABI compatibility change affected the conversion from standard CallOp/CallIndirectOp to LLVM::CallOp by changing its signature. In order to analyze the signature, the code was looking up the callee symbol in the module. This is incorrect since, during the conversion, the module may contain both the original and the converted function op that have the same symbol name. There is no strict guarantee on which of the two symbols will be found by the lookup. The conversion was not failing because the type legalizer converts the LLVM types to themselves making the original and the converted function signatures ultimately produce the same type. Instead of looking up the function signature to get the list of result types, use the types of the CallOp/CallIndirectOp results which must match those of the function in valid IR. These types are guaranteed to be the original, unconverted types when converting the operation. Furthermore, this avoids the need to perform a lookup of a symbol name in the module which may be expensive. Finally, propagate attributes as-is from the original op to the converted op since they share the attribute name for the callee of direct calls and the rest of attributes are not affected by the conversion. This removes the need for additional contorsions between direct and indirect calls to extract the name of the optional callee attribute only to insert it back. This also prevents the conversion from unintentionally dropping the other attributes of the op. PiperOrigin-RevId: 272218871
| * Unify Linalg types by using strided memrefsNicolas Vasilache2019-10-0132-1546/+1107
| | | | | | | | | | | | | | This CL finishes the implementation of the Linalg + Affine type unification of the [strided memref RFC](https://groups.google.com/a/tensorflow.org/forum/#!topic/mlir/MaL8m2nXuio). As a consequence, the !linalg.view type, linalg::DimOp, linalg::LoadOp and linalg::StoreOp can now disappear and Linalg can use standard types everywhere. PiperOrigin-RevId: 272187165
| * [spirv] NFC: rename SPV_ArithmeticOp to SPV_ArithmeticBinaryOpLei Zhang2019-10-011-17/+17
| | | | | | | | | | | | | | Also rename SPV_UnaryArithmeticOp to SPV_ArithmeticUnaryOp to be consistent. PiperOrigin-RevId: 272173974
| * Change all_reduce lowering to support 2D and 3D blocks.Christian Sigg2019-10-012-55/+142
| | | | | | | | | | | | | | | | Perform second reduce only with first warp. This requires an additional __sync_threads(), but doesn't need special handling when the last warp is small. This simplifies support for block sizes that are not multiple of 32. Supporting partial warp reduce will be done in a separate CL. PiperOrigin-RevId: 272168917
| * Add verification error message for ops that require at least one operand or ↵Christian Sigg2019-10-013-10/+48
| | | | | | | | | | | | result. PiperOrigin-RevId: 272153634
| * Add integer shift ops to LLVM dialect.Christian Sigg2019-09-302-0/+9
| | | | | | | | PiperOrigin-RevId: 272140049
| * Fold away reduction over 0 dimensions.MLIR Team2019-09-301-1/+2
| | | | | | | | PiperOrigin-RevId: 272113564
| * Pass the pointer of the parent pipeline collection pass to ↵River Riddle2019-09-303-35/+76
| | | | | | | | | | | | | | | | PassInstrumentation::run*Pipeline. For the cases where there are multiple levels of nested pass managers, the parent thread ID is not enough to distinguish the parent of a given pass pipeline. Passing in the parent pass gives an exact anchor point. PiperOrigin-RevId: 272105461
| * Format markdown list.MLIR Team2019-09-301-6/+8
| | | | | | | | PiperOrigin-RevId: 272095611
OpenPOWER on IntegriCloud