- Jun 07, 2021
-
-
River Riddle authored
We were accidentally only using the first found reference, instead of all of them. This revision fixes this by properly tracking all references to a symbol. Differential Revision: https://reviews.llvm.org/D103730
-
- Jun 04, 2021
-
-
River Riddle authored
This revision adds assembly state tracking for uses of symbols, allowing for go-to-definition and references support for SymbolRefAttrs. Differential Revision: https://reviews.llvm.org/D103585
-
- Jun 02, 2021
-
-
Jacques Pienaar authored
Currently the diagnostics reports the file:line:col, but some LSP frontends require a non-empty range. Report either the range of an identifier that starts at location, or a range of 1. Expose the id location to range helper and reuse here. Differential Revision: https://reviews.llvm.org/D103482
-
- May 25, 2021
-
-
Mathieu Fehr authored
Currently, AbstractOperation fields are function pointers. Modifying them to unique_function allow them to contain runtime information. For instance, this allows operations to be defined at runtime. Differential Revision: https://reviews.llvm.org/D103031
-
- May 23, 2021
-
-
Chris Lattner authored
This adds the ability to specify a location when creating BlockArguments. Notably Value::getLoc() will return this correctly, which makes diagnostics more precise (e.g. the example in test-legalize-type-conversion.mlir). This is currently optional to avoid breaking any existing code - if absent, the BlockArgument defaults to using the location of its enclosing operation (preserving existing behavior). The bulk of this change is plumbing location tracking through the parser and printer to make sure it can round trip (in -mlir-print-debuginfo mode). This is complete for generic operations, but requires manual adoption for custom ops. I added support for function-like ops to round trip their argument locations - they print correctly, but when parsing the locations are dropped on the floor. I intend to fix this, but it will require more invasive plumbing through "function_like_impl" stuff so I think it best to split it out to its own patch. This is a reapply of the patch here: https://reviews.llvm.org/D102567 with an additional change: we now never defer block argument locations, guaranteeing that we can round trip correctly. This isn't required in all cases, but allows us to hill climb here and works around unrelated bugs like https://bugs.llvm.org/show_bug.cgi?id=50451 Differential Revision: https://reviews.llvm.org/D102991
-
- May 19, 2021
-
-
River Riddle authored
Reland Note: This was accidentally reverted in 80d981ed, but is an important improvement even outside of the driving motivator in D102567. We currently use SourceMgr::getLineAndColumn to get the line and column for an SMLoc, but this includes a call to StringRef::find_last_of that ends up dominating compile time. In D102567, we start creating locations from the input file for block arguments which resulted in an extreme performance regression for modules with very large amounts of block arguments. This revision switches to just using a pointer offset from the beginning of the line to calculate the column(all MLIR files are simple ascii), resulting in a compile time reduction from 4700 seconds (1 hour and 18 minutes) to 8 seconds.
-
Richard Smith authored
"[mlir] Speed up Lexer::getEncodedSourceLocation" This reverts commit 3043be9d and commit 861d69a5. This change resulted in printing textual MLIR that can't be parsed; see review thread https://reviews.llvm.org/D102567 for details.
-
River Riddle authored
We currently use SourceMgr::getLineAndColumn to get the line and column for an SMLoc, but this includes a call to StringRef::find_last_of that ends up dominating compile time. In D102567, we start creating locations from the input file for block arguments which resulted in an extreme performance regression for modules with very large amounts of block arguments. This revision switches to just using a pointer offset from the beginning of the line to calculate the column(all MLIR files are simple ascii), resulting in a compile time reduction from 4700 seconds (1 hour and 18 minutes) to 8 seconds. Differential Revision: https://reviews.llvm.org/D102734
-
- May 18, 2021
-
-
Chris Lattner authored
This adds the ability to specify a location when creating BlockArguments. Notably Value::getLoc() will return this correctly, which makes diagnostics more precise (e.g. the example in test-legalize-type-conversion.mlir). This is currently optional to avoid breaking any existing code - if absent, the BlockArgument defaults to using the location of its enclosing operation (preserving existing behavior). The bulk of this change is plumbing location tracking through the parser and printer to make sure it can round trip (in -mlir-print-debuginfo mode). This is complete for generic operations, but requires manual adoption for custom ops. I added support for function-like ops to round trip their argument locations - they print correctly, but when parsing the locations are dropped on the floor. I intend to fix this, but it will require more invasive plumbing through "function_like_impl" stuff so I think it best to split it out to its own patch. Differential Revision: https://reviews.llvm.org/D102567
-
- May 12, 2021
-
-
River Riddle authored
This allows for diagnostics emitted during parsing/verification to be surfaced to the user by the language client, as opposed to just being emitted to the logs like they are now. Differential Revision: https://reviews.llvm.org/D102293
-
Ulysse Beaugnon authored
DialectAsmParser already allows converting an llvm::SMLoc location to a mlir::Location location. This commit adds the same functionality to OpAsmParser. Implementation is copied from DialectAsmParser. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D102165
-
- May 11, 2021
-
-
Chris Lattner authored
OpAsmParser (and DialectAsmParser) supports a pair of parseInteger/parseOptionalInteger methods, which allow parsing a bare integer into a C type of your choice (e.g. int8_t) using templates. It was implemented in terms of a virtual method call that is hard coded to int64_t because "that should be big enough". Change the virtual method hook to return an APInt instead. This allows asmparsers for custom ops to parse large integers if they want to, without changing any of the clients of the fixed size C API. Differential Revision: https://reviews.llvm.org/D102120
-
- May 08, 2021
-
-
River Riddle authored
This provides information when the user hovers over a part of the source .mlir file. This revision adds the following hover behavior: * Operation: - Shows the generic form. * Operation Result: - Shows the parent operation name, result number(s), and type(s). * Block: - Shows the parent operation name, block number, predecessors, and successors. * Block Argument: - Shows the parent operation name, parent block, argument number, and type. Differential Revision: https://reviews.llvm.org/D101113
-
- Apr 29, 2021
-
-
Alex Zinenko authored
This enables to express more complex parallel loops in the affine framework, for example, in cases of tiling by sizes not dividing loop trip counts perfectly or inner wavefront parallelism, among others. One can't use affine.max/min and supply values to the nested loop bounds since the results of such affine.max/min operations aren't valid symbols. Making them valid symbols isn't an option since they would introduce selection trees into memref subscript arithmetic as an unintended and undesired consequence. Also add support for converting such loops to SCF. Drop some API that isn't used in the core repo from AffineParallelOp since its semantics becomes ambiguous in presence of max/min bounds. Loop normalization is currently unavailable for such loops. Depends On D101171 Reviewed By: bondhugula Differential Revision: https://reviews.llvm.org/D101172
-
- Apr 27, 2021
-
-
Aart Bik authored
The new "encoding" field in tensor types so far had no meaning. This revision introduces: 1. an encoding attribute interface in IR: for verification between tensors and encodings in general 2. an attribute in Tensor dialect; #tensor.sparse<dict> + concrete sparse tensors API Active discussion: https://llvm.discourse.group/t/rfc-introduce-a-sparse-tensor-type-to-core-mlir/2944/ Reviewed By: silvas, penpornk, bixia Differential Revision: https://reviews.llvm.org/D101008
-
- Apr 23, 2021
-
-
Alexander Belyaev authored
Differential Revision: https://reviews.llvm.org/D101186
-
- Apr 21, 2021
-
-
River Riddle authored
This information isn't useful for general compilation, but is useful for building tools that process .mlir files. This class will be used in a followup to start building an LSP language server for MLIR. Differential Revision: https://reviews.llvm.org/D100438
-
- Apr 14, 2021
-
-
Mehdi Amini authored
This allows custom types and attribute to parse a dimension list that isn't necessarily terminated with `xtype`, for example something like: #tf.shape<4x5> Differential Revision: https://reviews.llvm.org/D100432
-
- Apr 12, 2021
-
-
Aart Bik authored
This CL introduces a generic attribute (called "encoding") on tensors. The attribute currently does not carry any concrete information, but the type system already correctly determines that tensor<8xi1,123> != tensor<8xi1,321>. The attribute will be given meaning through an interface in subsequent CLs. See ongoing discussion on discourse: [RFC] Introduce a sparse tensor type to core MLIR https://llvm.discourse.group/t/rfc-introduce-a-sparse-tensor-type-to-core-mlir/2944 A sparse tensor will look something like this: ``` // named alias with all properties we hold dear: #CSR = { // individual named attributes } // actual sparse tensor type: tensor<?x?xf64, #CSR> ``` I see the following rough 5 step plan going forward: (1) introduce this format attribute in this CL, currently still empty (2) introduce attribute interface that gives it "meaning", focused on sparse in first phase (3) rewrite sparse compiler to use new type, remove linalg interface and "glue" (4) teach passes to deal with new attribute, by rejecting/asserting on non-empty attribute as simplest solution, or doing meaningful rewrite in the longer run (5) add FE support, document, test, publicize new features, extend "format" meaning to other domains if useful Reviewed By: stellaraccident, bondhugula Differential Revision: https://reviews.llvm.org/D99548
-
- Apr 08, 2021
-
-
Tobias Gysi authored
The patch enables the use of index type in vectors. It is a prerequisite to support vectorization for indexed Linalg operations. This refactoring became possible due to the newly introduced data layout infrastructure. The data layout of a module defines the bitwidth of the index type needed to verify bitcasts and similar vector operations. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D99948
-
- Apr 03, 2021
-
-
David Blaikie authored
-
Christian Sigg authored
NDEBUG builds currently warn because it's only used inside an assert. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D99721
-
- Mar 25, 2021
-
-
Mehdi Amini authored
Define a `NoTerminator` traits that allows operations with a single block region to not provide a terminator In particular for Graph Regions, the terminator needs is just a historical artifact of the generalization of MLIR from CFG region. Operations like Module don't need a terminator, and before Module migrated to be an operation with region there wasn't any needed. To validate the feature, the ModuleOp is migrated to use this trait and the ModuleTerminator operation is deleted. This patch is likely to break clients, if you're in this case: - you may iterate on a ModuleOp with `getBody()->without_terminator()`, the solution is simple: just remove the ->without_terminator! - you created a builder with `Builder::atBlockTerminator(module_body)`, just use `Builder::atBlockEnd(module_body)` instead. - you were handling ModuleTerminator: it isn't needed anymore. - for generic code, a `Block::mayNotHaveTerminator()` may be used. Differential Revision: https://reviews.llvm.org/D98468
-
- Mar 23, 2021
-
-
Mehdi Amini authored
Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D99007
-
- Mar 17, 2021
-
-
River Riddle authored
This has been a TODO for a while, and prevents breakages for attributes/types that contain floats that can't roundtrip outside of the hex format. Differential Revision: https://reviews.llvm.org/D98808
-
River Riddle authored
With this revision, all builtin attributes and types will have been moved to the ODS generator. Differential Revision: https://reviews.llvm.org/D98474
-
- Mar 12, 2021
-
-
Alex Zinenko authored
Forward references to blocks lead to `Block`s being allocated in the parser, but they are not necessarily included into a region if parsing fails, leading to a leak. Clean them up in parser destructor. Reviewed By: rriddle, mehdi_amini Differential Revision: https://reviews.llvm.org/D98403
-
- Mar 10, 2021
-
-
Vladislav Vinogradov authored
Based on the following discussion: https://llvm.discourse.group/t/rfc-memref-memory-shape-as-attribute/2229 The goal of the change is to make memory space property to have more expressive representation, rather then "magic" integer values. It will allow to have more clean ASM form: ``` gpu.func @test(%arg0: memref<100xf32, "workgroup">) // instead of gpu.func @test(%arg0: memref<100xf32, 3>) ``` Explanation for `Attribute` choice instead of plain `string`: * `Attribute` classes allow to use more type safe API based on RTTI. * `Attribute` classes provides faster comparison operator based on pointer comparison in contrast to generic string comparison. * `Attribute` allows to store more complex things, like structs or dictionaries. It will allows to have more complex memory space hierarchy. This commit preserve old integer-based API and implements it on top of the new one. Depends on D97476 Reviewed By: rriddle, mehdi_amini Differential Revision: https://reviews.llvm.org/D96145
-
- Mar 08, 2021
-
-
River Riddle authored
This also removes the need for LocationDetail.h. Differential Revision: https://reviews.llvm.org/D98092
-
- Mar 04, 2021
-
-
River Riddle authored
This function simplifies calling the getChecked methods on Attributes and Types from within the parser, and removes any need to use `getEncodedSourceLocation` for these methods (by using an SMLoc instead). This is much more efficient than using an mlir::Location, as the encoding process to produce an mlir::Location is inefficient and undesirable for parsing (locations used during parsing should not persist afterwards unless otherwise necessary). Differential Revision: https://reviews.llvm.org/D97900
-
- Mar 03, 2021
-
-
Vladislav Vinogradov authored
Instead of hard-coded check. Reviewed By: ftynse, rriddle Differential Revision: https://reviews.llvm.org/D97612
-
- Feb 27, 2021
-
-
River Riddle authored
This also exposed a bug in Dialect loading where it was not correctly identifying identifiers that had the dialect namespace as a prefix. Differential Revision: https://reviews.llvm.org/D97431
-
- Feb 23, 2021
-
-
River Riddle authored
`verifyConstructionInvariants` is intended to allow for verifying the invariants of an attribute/type on construction, and `getChecked` is intended to enable more graceful error handling aside from an assert. There are a few problems with the current implementation of these methods: * `verifyConstructionInvariants` requires an mlir::Location for emitting errors, which is prohibitively costly in the situations that would most likely use them, e.g. the parser. This creates an unfortunate code duplication between the verifier code and the parser code, given that the parser operates on llvm::SMLoc and it is an undesirable overhead to pre-emptively convert from that to an mlir::Location. * `getChecked` effectively requires duplicating the definition of the `get` method, creating a quite clunky workflow due to the subtle different in its signature. This revision aims to talk the above problems by refactoring the implementation to use a callback for error emission. Using a callback allows for deferring the costly part of error emission until it is actually necessary. Due to the necessary signature change in each instance of these methods, this revision also takes this opportunity to cleanup the definition of these methods by: * restructuring the signature of `getChecked` such that it can be generated from the same code block as the `get` method. * renaming `verifyConstructionInvariants` to `verify` to match the naming scheme of the rest of the compiler. Differential Revision: https://reviews.llvm.org/D97100
-
- Feb 09, 2021
-
-
River Riddle authored
These properties were useful for a few things before traits had a better integration story, but don't really carry their weight well these days. Most of these properties are already checked via traits in most of the code. It is better to align the system around traits, and improve the performance/cost of traits in general. Differential Revision: https://reviews.llvm.org/D96088
-
- Feb 08, 2021
-
-
Tres Popp authored
This reverts commit 511dd4f4 along with a couple fixes. Original message: Now the context is the first, rather than the last input. This better matches the rest of the infrastructure and makes it easier to move these types to being declaratively specified. Phabricator: https://reviews.llvm.org/D96111
-
Tres Popp authored
Now the context is the first, rather than the last input. This better matches the rest of the infrastructure and makes it easier to move these types to being declaratively specified. Differential Revision: https://reviews.llvm.org/D96111
-
- Jan 15, 2021
-
-
Valentin Clement authored
Add builtin f80 and f128 following @schweitz proposition https://llvm.discourse.group/t/rfc-adding-better-support-for-higher-precision-floating-point/2526/5 Reviewed By: ftynse, rriddle Differential Revision: https://reviews.llvm.org/D94737
-
- Jan 11, 2021
-
-
Richard Uhler authored
Based on the comments in lib/Parser/TypeParser.cpp on the parseMemRefType and parseTensorType functions. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D94262
-
Chris Lattner authored
llvm::APInt cannot hold zero bit values, therefore we shouldn't try to form them. Differential Revision: https://reviews.llvm.org/D94384
-