summaryrefslogtreecommitdiffstats
path: root/mlir
Commit message (Collapse)AuthorAgeFilesLines
* [mlir] NFC: Rename index_t to index_typeRainer Orth2020-03-067-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | mlir currently fails to build on Solaris: /vol/llvm/src/llvm-project/dist/mlir/lib/Conversion/VectorToLoops/ConvertVectorToLoops.cpp:78:20: error: reference to 'index_t' is ambiguous IndexHandle zero(index_t(0)), one(index_t(1)); ^ /usr/include/sys/types.h:103:16: note: candidate found by name lookup is 'index_t' typedef short index_t; ^ /vol/llvm/src/llvm-project/dist/mlir/include/mlir/EDSC/Builders.h:27:8: note: candidate found by name lookup is 'mlir::edsc::index_t' struct index_t { ^ and many more. Given that POSIX reserves all identifiers ending in `_t` 2.2.2 The Name Space <https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html>, it seems quite unwise to use such identifiers in user code, even more so without a distinguished prefix. The following patch fixes this by renaming `index_t` to `index_type`. cases. Tested on `amd64-pc-solaris2.11` and `sparcv9-sun-solaris2.11`. Differential Revision: https://reviews.llvm.org/D72619 (cherry picked from commit 002ec79f979b9da9dedafe7ea036e00c90a9fbb7)
* Fix x86 32bits MLIR build (NFC)Dimitry Andric2020-02-061-1/+1
| | | | | | | | | | This is fixing a build error: error: non-constant-expression cannot be narrowed from type 'unsigned int' to 'Region::iterator::difference_type' (aka 'int') in initializer list Fix pr44767 (cherry picked from commit 31fd112eb4a90600e0f340f19053e5715e92ec4c)
* [mlir] Mark the MLIR tools for installation in CMakeKern Handa2020-02-053-3/+3
| | | | | | | | This binplaces `mlir-translate`, `mlir-cuda-runner`, and `mlir-cpu-runner` when building the CMake install target. Differential Revision: https://reviews.llvm.org/D73986 (cherry picked from commit b8004b7308b490b93231789cd05f86294a77d663)
* [mlir][orc] unbreak MLIR ExecutionEngine after ORC changesAlex Zinenko2020-01-301-3/+3
| | | | | | | | | | Changes to ORC in ce2207abaf9a925b35f15ef92aaff6b301ba6d22 changed the APIs in IRCompileLayer, now requiring the custom compiler to be wrapped in IRCompileLayer::IRCompiler. Even though MLIR relies on Orc CompileUtils, the type is still visible in several places in the code. Adapt those to the new API. (cherry picked from commit 7984b47401f7f36475619abf2ff02de3b5ff0481)
* [mlir] Fix compilation with VS2019.Alexandre Ganea2020-01-231-3/+4
| | | | (cherry picked from commit e3d92b7442eaf3319f84bc060492df5b7ac3e9a1)
* Revert "[mlir] Create a gpu.module operation for the GPU Dialect."Benjamin Kramer2020-01-1624-235/+140
| | | | | | | This reverts commit 4624a1e8ac8a3f69cc887403b976f538f587744a. Causing problems downstream. (cherry picked from commit 0133cc60e4e230ee2c176c23eff5aa2f4ee17a75)
* [mlir] : Fix ViewOp shape folder for identity affine mapsAhmed Taei2020-01-152-3/+7
| | | | | | | | | | | | Summary: Fix the ViewOpShapeFolder in case of no affine mapping associated with a Memref construct identity mapping. Reviewers: nicolasvasilache Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, liufengdb, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72735
* [mlir][spirv] Properly support SPIR-V conversion targetLei Zhang2020-01-1413-86/+559
| | | | | | | | | | | | | | | | This commit defines a new SPIR-V dialect attribute for specifying a SPIR-V target environment. It is a dictionary attribute containing the SPIR-V version, supported extension list, and allowed capability list. A SPIRVConversionTarget subclass is created to take in the target environment and sets proper dynmaically legal ops by querying the op availability interface of SPIR-V ops to make sure they are available in the specified target environment. All existing conversions targeting SPIR-V is changed to use this SPIRVConversionTarget. It probes whether the input IR has a `spv.target_env` attribute, otherwise, it uses the default target environment: SPIR-V 1.0 with Shader capability and no extra extensions. Differential Revision: https://reviews.llvm.org/D72256
* [mlir] Refactor ModuleState into AsmState and expose it to users.River Riddle2020-01-147-39/+136
| | | | | | | | | | | Summary: This allows for users to cache printer state, which can be costly to recompute. Each of the IR print methods gain a new overload taking this new state class. Depends On D72293 Reviewed By: jpienaar Differential Revision: https://reviews.llvm.org/D72294
* [mlir] Enable printing of FuncOp in the generic form.River Riddle2020-01-142-11/+10
| | | | | | | | | | | Summary: This was previously disabled as FunctionType TypeAttrs could not be roundtripped in the IR. This has been fixed, so we can now generically print FuncOp. Depends On D72429 Reviewed By: jpienaar, mehdi_amini Differential Revision: https://reviews.llvm.org/D72642
* [mlir][Linalg] Update the semantics, verifier and test for Linalg with tensors.Nicolas Vasilache2020-01-1412-312/+458
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This diff fixes issues with the semantics of linalg.generic on tensors that appeared when converting directly from HLO to linalg.generic. The changes are self-contained within MLIR and can be captured and tested independently of XLA. The linalg.generic and indexed_generic are updated to: To allow progressive lowering from the value world (a.k.a tensor values) to the buffer world (a.k.a memref values), a linalg.generic op accepts mixing input and output ranked tensor values with input and output memrefs. ``` %1 = linalg.generic #trait_attribute %A, %B {other-attributes} : tensor<?x?xf32>, memref<?x?xf32, stride_specification> -> (tensor<?x?xf32>) ``` In this case, the number of outputs (args_out) must match the sum of (1) the number of output buffer operands and (2) the number of tensor return values. The semantics is that the linalg.indexed_generic op produces (i.e. allocates and fills) its return values. Tensor values must be legalized by a buffer allocation pass before most transformations can be applied. Such legalization moves tensor return values into output buffer operands and updates the region argument accordingly. Transformations that create control-flow around linalg.indexed_generic operations are not expected to mix with tensors because SSA values do not escape naturally. Still, transformations and rewrites that take advantage of tensor SSA values are expected to be useful and will be added in the near future. Subscribers: bmahjour, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72555
* [mlir] Use double format when parsing bfloat16 hexadecimal valuesRiver Riddle2020-01-143-14/+34
| | | | | | | | Summary: bfloat16 doesn't have a valid APFloat format, so we have to use double semantics when storing it. This change makes sure that hexadecimal values can be round-tripped properly given this fact. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D72667
* Make helper functions static or move them into anonymous namespaces. NFC.Benjamin Kramer2020-01-1425-79/+113
|
* [mlir] Fix translation of splat constants to LLVM IRAlex Zinenko2020-01-142-1/+36
| | | | | | | | | | | | | | | | Summary: When converting splat constants for nested sequential LLVM IR types wrapped in MLIR, the constant conversion was erroneously assuming it was always possible to recursively construct a constant of a sequential type given only one value. Instead, wait until all sequential types are unpacked recursively before constructing a scalar constant and wrapping it into the surrounding sequential type. Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72688
* [mlir] Create a gpu.module operation for the GPU Dialect.Tres Popp2020-01-1424-140/+235
| | | | | | | | | | | | | | | | | Summary: This is based on the use of code constantly checking for an attribute on a model and instead represents the distinct operaion with a different op. Instead, this op can be used to provide better filtering. Reviewers: herhut, mravishankar, antiagainst, rriddle Reviewed By: herhut, antiagainst, rriddle Subscribers: liufengdb, aartbik, jholewinski, mgorny, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72336
* [mlir] Ran git-clang-format.Adrian2020-01-141-2/+2
| | | | | Summary: I forgot to ran git-clang-format before committing.
* [mlir] Add loop.parallel, loop.reduce and loop.reduce.return operations.Adrian Kuegel2020-01-144-4/+536
| | | | | | | | | | Summary: These operations can be used to specify a loop nest with a body that can contain reductions. The iteration space can be iterated in any order. RFC: https://groups.google.com/a/tensorflow.org/d/topic/mlir/pwtSgiKFPis/discussion Differential Revision: https://reviews.llvm.org/D72394
* [mlir] Fix -WunusedSam McCall2020-01-141-2/+2
|
* [MLIR] Fix broken link locations after move to monorepoDaniel Galvez2020-01-149-13/+13
| | | | | | | | | | I used the codemod python tool to do this with the following commands: codemod 'tensorflow/mlir/blob/master/include' 'llvm/llvm-project/blob/master/mlir/include' codemod 'tensorflow/mlir/blob/master' 'llvm/llvm-project/blob/master/mlir' codemod 'tensorflow/mlir' 'llvm-project/llvm' Differential Revision: https://reviews.llvm.org/D72244
* [mlir] [VectorOps] fixed typo in verifier of slice opAart Bik2020-01-131-1/+1
| | | | | | | | | | | | Reviewers: nicolasvasilache, andydavis1, rriddle Reviewed By: nicolasvasilache, rriddle Subscribers: merge_guards_bot, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72664
* [mlir] NFC: Remove unused variable.River Riddle2020-01-131-1/+1
|
* [mlir] Add support for attaching a visibility to symbols.River Riddle2020-01-135-3/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The visibility defines the structural reachability of the symbol within the IR. Symbols can define one of three visibilities: * Public The symbol \may be accessed from outside of the visible IR. We cannot assume that we can observe all of the uses of this symbol. * Private The symbol may only be referenced from within the operations in the current symbol table, via SymbolRefAttr. * Nested The symbol may be referenced by operations in symbol tables above the current symbol table, as long as each symbol table parent also defines a non-private symbol. This allows or referencing the symbol from outside of the defining symbol table, while retaining the ability for the compiler to see all uses. These properties help to reason about the properties of a symbol, and will be used in a follow up to implement a dce pass on dead symbols. A few examples of what this would look like in the IR are shown below: module @public_module { // This function can be accessed by 'live.user' func @nested_function() attributes { sym_visibility = "nested" } // This function cannot be accessed outside of 'public_module' func @private_function() attributes { sym_visibility = "private" } } // This function can only be accessed from within this module. func @private_function() attributes { sym_visibility = "private" } // This function may be referenced externally. func @public_function() "live.user"() {uses = [@public_module::@nested_function, @private_function, @public_function]} : () -> () Depends On D72043 Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D72044
* [mlir] Update the CallGraph for nested symbol references, and simplify ↵River Riddle2020-01-137-100/+82
| | | | | | | | | | | | | CallableOpInterface Summary: This enables tracking calls that cross symbol table boundaries. It also simplifies some of the implementation details of CallableOpInterface, i.e. there can only be one region within the callable operation. Depends On D72042 Reviewed By: jpienaar Differential Revision: https://reviews.llvm.org/D72043
* [mlir] Update the use-list algorithms in SymbolTable to support nested ↵River Riddle2020-01-135-157/+529
| | | | | | | | | | references. Summary: This updates the use list algorithms to support querying from a specific symbol, allowing for the collection and detection of nested references. This works by walking the parent "symbol scopes" and applying the existing algorithm at each level. Reviewed By: jpienaar Differential Revision: https://reviews.llvm.org/D72042
* [mlir] Remove unnecessary assert for single region.River Riddle2020-01-131-2/+0
| | | | This was left over debugging.
* [mlir] Change the syntax of AffineMapAttr and IntegerSetAttr to avoid ↵River Riddle2020-01-1378-1519/+1592
| | | | | | | | | | conflicts with function types. Summary: The current syntax for AffineMapAttr and IntegerSetAttr conflict with function types, making it currently impossible to round-trip function types(and e.g. FuncOp) in the IR. This revision changes the syntax for the attributes by wrapping them in a keyword. AffineMapAttr is wrapped with `affine_map<>` and IntegerSetAttr is wrapped with `affine_set<>`. Reviewed By: nicolasvasilache, ftynse Differential Revision: https://reviews.llvm.org/D72429
* Unbreak the mlir build after 202ab273e6eca134b69882f100c666fcd3affbcfBenjamin Kramer2020-01-132-2/+2
|
* [mlir] m_Constant()Lorenzo Chelini2020-01-134-3/+16
| | | | | | Summary: Introduce m_Constant() which allows matching a constant operation without forcing the user also to capture the attribute value. Differential Revision: https://reviews.llvm.org/D72397
* [mlir] Added missing GPU lowering ops.Julian Gross2020-01-134-2/+106
| | | | | | | | | | | Summary: This diff adds missing GPU lowering ops to MLIR. Reviewers: herhut, pifon2a, ftynse Tags: #pre-merge_beta_testing, #llvm Differential Revision: https://reviews.llvm.org/D72439
* [mlir][Linalg] Update ReshapeOp::build to be more idiomaticNicolas Vasilache2020-01-134-9/+82
| | | | | | | | | | | | | | Summary: This diff makes it easier to create a `linalg.reshape` op and adds an EDSC builder api test to exercise the new builders. Reviewers: ftynse, jpienaar Subscribers: mehdi_amini, rriddle, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72580
* Add zero_extendi and sign_extendi to intrinsic namespacePruthvi2020-01-132-0/+28
| | | | | | | | Summary: - update zero_extendi and sign_extendi in edsc/intrinsic namespace - Builder API test for zero_extendi and sign_extendi Differential Revision: https://reviews.llvm.org/D72298
* [mlir] NFC: Remove Value::operator* and Value::operator-> now that Value is ↵River Riddle2020-01-11138-1003/+957
| | | | | | | | | | properly value-typed. Summary: These were temporary methods used to simplify the transition. Reviewed By: antiagainst Differential Revision: https://reviews.llvm.org/D72548
* Remove copy ctors identical to the default one. NFC.Benjamin Kramer2020-01-113-13/+3
| | | | Those do nothing but make the type no longer trivial to the compiler.
* [mlir][ods] Support dialect specific content emission via hooksLei Zhang2020-01-103-7/+81
| | | | | | | | | | | | | Thus far we can only generate the same set of methods even for operations in different dialects. This is problematic for dialects that want to generate additional operation class methods programmatically, e.g., a special builder method or attribute getter method. Apparently we cannot update the OpDefinitionsGen backend every time when such a need arises. So this CL introduces a hook into the OpDefinitionsGen backend to allow dialects to emit additional methods and traits to operation classes. Differential Revision: https://reviews.llvm.org/D72514
* [mlir] NFC: put C++ code emission classes in their own filesLei Zhang2020-01-104-340/+408
| | | | | | This exposes thse classes so that they can be used in interfaces. Differential Revision: https://reviews.llvm.org/D72514
* [mlir][spirv] Fix typos related to (de)serialization.Denis Khalikov2020-01-102-5/+5
| | | | | | Fix typos related to (de)serialization of spv.selection. Differential Revision: https://reviews.llvm.org/D72503
* Sprinkle some constexpr on default ctors so the compiler can diagnose unused ↵Benjamin Kramer2020-01-105-5/+3
| | | | instances. NFCI.
* fix another typo to cycle botsNico Weber2020-01-091-1/+1
|
* [mlir] Use getDenseElementBitwidth instead of Type::getElementTypeBitWidth.River Riddle2020-01-092-1/+12
| | | | | | | | Summary: Some data values have a different storage width than the corresponding MLIR type, e.g. bfloat is currently stored as a double. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D72478
* [mlir] add a missing dependency for Linalg conversionEric Schweitz2020-01-091-0/+1
| | | | | | | We were seeing some occasional build failures that would come and go. It appeared to be this missing dependence. Differential Revision: https://reviews.llvm.org/D72419
* [mlir] mlir-cpu-runner test's cblas_interface should export functions on WindowsKern Handa2020-01-095-7/+66
| | | | | | | | | | | | This change fixes the build on Windows, so that cblas_interface.dll exports functions correctly and an implib is created and installed correctly. Currently, LLVM cannot be consumed on Windows after it has been installed in a location because cblas_interface.lib is not created/installed, thus failing the import check in `LLVMExports.cmake`. Differential Revision: https://reviews.llvm.org/D72384
* [mlir] NFC: Move the state for managing SSA value names out of ↵River Riddle2020-01-091-510/+571
| | | | | | | | | | | | | OperationPrinter and into a new class SSANameState. Summary: This reduces the complexity of OperationPrinter and simplifies the code by quite a bit. The SSANameState is now held by ModuleState. This is in preparation for a future revision that molds ModuleState into something that can be used by users for caching the printer state, as well as for implementing printAsOperand style methods. Depends On D72292 Reviewed By: antiagainst Differential Revision: https://reviews.llvm.org/D72293
* [mlir] fix test failure in EDSC/builder-api-testHiroshi Inoue2020-01-091-3/+4
| | | | | | | | This patch fixes a test failure on a non-intel (PowerPC64) box. The two affine.load are independent and hence llvm may reorder them. The CHECK lines are modified for supporting reordered case. Differential Revision: https://reviews.llvm.org/D72435
* [mlir][GPU] introduce utilities for promotion to workgroup memoryAlex Zinenko2020-01-0911-2/+428
| | | | | | | | | | | | | | | | | | | Introduce a set of function that promote a memref argument of a `gpu.func` to workgroup memory using memory attribution. The promotion boils down to additional loops performing the copy from the original argument to the attributed memory in the beginning of the function, and back at the end of the function using all available threads. The loop bounds are specified so as to adapt to any size of the workgroup. These utilities are intended to compose with other existing utilities (loop coalescing and tiling) in cases where the distribution of work across threads is uneven, e.g. copying a 2D memref with only the threads along the "x" dimension. Similarly, specialization of the kernel to specific launch sizes should be implemented as a separate pass combining constant propagation and canonicalization. Introduce a simple attribute-driven pass to test the promotion transformation since we don't have a heuristic at the moment. Differential revision: https://reviews.llvm.org/D71904
* [mlir][VectorOps] Implement insert_strided_slice conversionNicolas Vasilache2020-01-092-42/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This diff implements the progressive lowering of insert_strided_slice. Two cases appear: 1. when the source and dest vectors have different ranks, extract the dest subvector at the proper offset and reduce to case 2. 2. when they have the same rank N: a. if the source and dest type are the same, the insertion is trivial: just forward the source b. otherwise, iterate over all N-1 D subvectors and create an extract/insert_strided_slice/insert replacement, reducing the problem to vecotrs of the same N-1 rank. This combines properly with the other conversion patterns to lower all the way to LLVM. Reviewers: ftynse, rriddle, AlexEichenberger, andydavis1, tetuante, nicolasvasilache Reviewed By: andydavis1 Subscribers: merge_guards_bot, mehdi_amini, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72317
* [mlir][VectorOps] Implement strided_slice conversionNicolas Vasilache2020-01-093-3/+178
| | | | | | | | | | | | | | | | | | | | | Summary: This diff implements the progressive lowering of strided_slice to either: 1. extractelement + insertelement for the 1-D case 2. extract + optional strided_slice + insert for the n-D case. This combines properly with the other conversion patterns to lower all the way to LLVM. Appropriate tests are added. Reviewers: ftynse, rriddle, AlexEichenberger, andydavis1, tetuante Reviewed By: andydavis1 Subscribers: merge_guards_bot, mehdi_amini, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72310
* [MLIR] Don't use SSA names directly for std.view canonicalization testAhmed Taei2020-01-081-5/+5
| | | | | | | | | | Reviewers: rriddle, nicolasvasilache Subscribers: mehdi_amini, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72408
* Canonicalize static alloc followed by memref_cast and std.viewAhmed Taei2020-01-082-4/+29
| | | | | | | | | | | | Summary: Rewrite alloc, memref_cast, std.view into allo, std.view by droping memref_cast. Reviewers: nicolasvasilache Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72379
* [MLIR] Fix ML IR build on Windows with Visual StudioStella Stamenova2020-01-081-1/+1
| | | | | | | | | | | | | | Summary: Right now the path for each lib in whole_archive_link when MSVC is used as the compiler is not a full path - and it's not even the correct path when VS is used to build. This patch sets the lib path to a full path using CMAKE_CFG_INTDIR which means the path will be correct regardless of whether ninja, make or VS is used and it will always be a full path. Reviewers: denis13, jpienaar Reviewed By: jpienaar Subscribers: mgorny, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, llvm-commits, asmith Tags: #llvm Differential Revision: https://reviews.llvm.org/D72403
* [mlir] NFC: Move the state for managing aliases out of ModuleState and into ↵River Riddle2020-01-081-137/+185
| | | | | | | | | | a new class AliasState. Summary: This reduces the complexity of ModuleState and simplifies the code. A future revision will mold ModuleState into something that can be used by users for caching of printer state, as well as for implementing printAsOperand style methods. Reviewed By: antiagainst Differential Revision: https://reviews.llvm.org/D72292
OpenPOWER on IntegriCloud