Mahesh Ravishankar [Thu, 11 Jul 2019 00:33:28 +0000 (17:33 -0700)]
Update the gen_spirv_dialect.py script to add opcodes from the SPIR-V
JSON spec into the SPIRBase.td file. This is done incrementally to
only import those opcodes that are needed, through use of the script
define_opcode.sh added.
PiperOrigin-RevId:
257517343
River Riddle [Wed, 10 Jul 2019 22:49:27 +0000 (15:49 -0700)]
NFC: Replace Module::getNamedFunction with lookupSymbol<FuncOp>.
This allows for removing the last direct reference to FuncOp from ModuleOp.
PiperOrigin-RevId:
257498296
River Riddle [Wed, 10 Jul 2019 22:16:52 +0000 (15:16 -0700)]
Refactor the parsing/printing of the top-level module.
This changes the top-level module parser to handle the case where the top-level module is defined with the module operation syntax, i.e:
module ... {
}
The printer is also updated to always print the top-level module in this form. This allows for cleanly round-tripping the location and attributes of the top-level module.
PiperOrigin-RevId:
257492069
Nicolas Vasilache [Wed, 10 Jul 2019 18:42:56 +0000 (11:42 -0700)]
Fix BufferSizeOp type lowering to LLVM.
This fixes a bug where the result type was incorrect when lowering to LLVM.
PiperOrigin-RevId:
257449384
Alex Zinenko [Wed, 10 Jul 2019 18:39:09 +0000 (11:39 -0700)]
PassRegistation: use overloads instead of a default argument
Windows build is not happy trying to convert a lambda into a constant reference
to a function in default arguments of the PassRegistration constructor. Define
two overloaded constructors instead and construct the lambda as a variable in
the constructor body.
PiperOrigin-RevId:
257448633
River Riddle [Wed, 10 Jul 2019 18:34:57 +0000 (11:34 -0700)]
Drop the trailing newline from the FuncOp syntax.
The ModulePrinter prints the newline now for children of the top-level module. This also fixes the location printing for functions as the location used to be printed on a different line.
PiperOrigin-RevId:
257447633
Alex Zinenko [Wed, 10 Jul 2019 18:16:40 +0000 (11:16 -0700)]
EDSC: use affine.load/store instead of std.load/store
Standard load and store operations are evolving to be separated from the Affine
constructs. Special affine.load/store have been introduced to uphold the
restrictions of the Affine control flow constructs on their operands.
EDSC-produced loads and stores were originally intended to uphold those
restrictions as well so they should use affine.load/store instead of
std.load/store.
PiperOrigin-RevId:
257443307
River Riddle [Wed, 10 Jul 2019 18:12:27 +0000 (11:12 -0700)]
NFC: Remove Function::getModule.
There is already a more general 'getParentOfType' method, and 'getModule' is likely to be misused as functions get placed within different regions than ModuleOp.
PiperOrigin-RevId:
257442243
Nicolas Vasilache [Wed, 10 Jul 2019 18:02:56 +0000 (11:02 -0700)]
Delete dead code
AffineIfOp::build is not tested or exercised anywhere. It also perpetuates a questionable choice of encoding an optional region as an empty region which we would like to change in the future.
PiperOrigin-RevId:
257439832
River Riddle [Wed, 10 Jul 2019 17:07:49 +0000 (10:07 -0700)]
NFC: Rename Module to ModuleOp.
Module is a legacy name that only exists as a typedef of ModuleOp.
PiperOrigin-RevId:
257427248
River Riddle [Wed, 10 Jul 2019 00:57:24 +0000 (17:57 -0700)]
Update ModuleOp::create(...) to take a Location instead of a context.
This allows for giving a Module a more interesting location than 'Unknown'.
PiperOrigin-RevId:
257310117
River Riddle [Tue, 9 Jul 2019 23:17:55 +0000 (16:17 -0700)]
NFC: Rename Function to FuncOp.
PiperOrigin-RevId:
257293379
Jacques Pienaar [Tue, 9 Jul 2019 20:17:30 +0000 (13:17 -0700)]
Constrain regex to avoid ordering issues.
PiperOrigin-RevId:
257257173
River Riddle [Tue, 9 Jul 2019 18:49:41 +0000 (11:49 -0700)]
Relax the restriction that Modules cannot contain operations producing results.
This was an arbitrary restriction caused by the way that modules were printed. Now that that has been fixed, this restriction can be removed.
PiperOrigin-RevId:
257240329
River Riddle [Tue, 9 Jul 2019 17:40:29 +0000 (10:40 -0700)]
Standardize the value numbering in the AsmPrinter.
Change the AsmPrinter to number values breadth-first so that values in adjacent regions can have the same name. This allows for ModuleOp to contain operations that produce results. This also standardizes the special name of region entry arguments to "arg[0-9+]" now that Functions are also operations.
PiperOrigin-RevId:
257225069
Alex Zinenko [Tue, 9 Jul 2019 14:51:17 +0000 (07:51 -0700)]
Add parentheses around boolean operators in an assertion in
Linalg/Transforms/Tiling.cpp. This fixes a warning.
PiperOrigin-RevId:
257191302
Alex Zinenko [Tue, 9 Jul 2019 14:43:17 +0000 (07:43 -0700)]
Fix a test broken on some systems due to a mis-rebase.
PiperOrigin-RevId:
257190161
Alex Zinenko [Tue, 9 Jul 2019 13:37:17 +0000 (06:37 -0700)]
Implement parametric tiling on standard for loops
Parametric tiling can be used to extract outer loops with fixed number of
iterations. This in turn enables mapping to GPU kernels on a fixed grid
independently of the range of the original loops, which may be unknown
statically, making the kernel adaptable to different sizes. Provide a utility
function that also computes the parametric tile size given the range of the
loop. Exercise the utility function through a simple pass that applies it to
all top-level loop nests. Permutability or parallelism checks must be
performed before calling this utility function in actual passes.
Note that parametric tiling cannot be implemented in a purely affine way,
although it can be encoded using semi-affine maps. The choice to implement it
on standard loops is guided by them being the common representation between
Affine loops, Linalg and GPU kernels.
PiperOrigin-RevId:
257180251
Alex Zinenko [Tue, 9 Jul 2019 12:26:18 +0000 (05:26 -0700)]
Extend AffineToGPU to support Linalg loops
Extend the utility that converts affine loop nests to support other types of
loops by abstracting away common behavior through templates. This also
slightly simplifies the existing Affine to GPU conversion by always passing in
the loop step as an additional kernel argument even though it is a known
constant. If it is used, it will be propagated into the loop body by the
existing canonicalization pattern and can be further constant-folded, otherwise
it will be dropped by canonicalization.
This prepares for the common loop abstraction that will be used for converting
to GPU kernels, which is conceptually close to Linalg loops, while maintaining
the existing conversion operational.
PiperOrigin-RevId:
257172216
River Riddle [Tue, 9 Jul 2019 07:58:41 +0000 (00:58 -0700)]
NFC: Change a usage of StringLiteral to StringRef.
This matches the result type of other functions returning c-string, and fixes a build failure where some compilers fail to construct the StringLiteral.
PiperOrigin-RevId:
257139513
River Riddle [Tue, 9 Jul 2019 05:31:25 +0000 (22:31 -0700)]
Generalize the symbol table functionality of ModuleOp into a trait 'OpTrait::SymbolTable'.
Operations must only contain a single region. Once attached, all operations that contain a 'mlir::SymbolTable::getSymbolAttrName()' StringAttr attribute within the child region will be verified to ensure that the names are uniqued. Operations using this trait also gain access to the 'SymbolTable' class, which can be used to manage the symbol table of the operation. This class also provides constant-time lookup of symbols by name, and will automatically rename symbols on insertion.
PiperOrigin-RevId:
257123573
River Riddle [Tue, 9 Jul 2019 01:27:45 +0000 (18:27 -0700)]
NFC: Remove `Module::getFunctions` in favor of a general `getOps<T>`.
Modules can now contain more than just Functions, this just updates the iteration API to reflect that. The 'begin'/'end' methods have also been updated to iterate over opaque Operations.
PiperOrigin-RevId:
257099084
River Riddle [Mon, 8 Jul 2019 21:05:37 +0000 (14:05 -0700)]
NFC: Make the 'disable-pass-threading' flag a PassManagerOption.
This also adds the ability to programmatically disable threading.
PiperOrigin-RevId:
257051809
Jacques Pienaar [Mon, 8 Jul 2019 21:01:09 +0000 (14:01 -0700)]
Remove dead code.
PiperOrigin-RevId:
257050780
Lei Zhang [Mon, 8 Jul 2019 18:56:16 +0000 (11:56 -0700)]
Add dependencies for standard ops to SPIR-V conversion
PiperOrigin-RevId:
257026374
Jacques Pienaar [Mon, 8 Jul 2019 18:45:05 +0000 (11:45 -0700)]
Add missing override.
PiperOrigin-RevId:
257024265
River Riddle [Mon, 8 Jul 2019 18:20:26 +0000 (11:20 -0700)]
NFC: Remove the various "::getFunction" methods.
These methods assume that a function is a valid builtin top-level operation, and removing these methods allows for decoupling FuncOp and IR/. Utility "getParentOfType" methods have been added to Operation/OpState to allow for querying the first parent operation of a given type.
PiperOrigin-RevId:
257018913
River Riddle [Mon, 8 Jul 2019 18:17:40 +0000 (11:17 -0700)]
NFC: Add AbstractOperation as a friend of 'Op'.
This allows for accessing the hidden overload of 'Op::hasTrait'.
PiperOrigin-RevId:
257018255
Mahesh Ravishankar [Mon, 8 Jul 2019 17:56:20 +0000 (10:56 -0700)]
Add Ops in SPIR-V Dialect corresponding to OpEntryPoint and OpExecutionMode
PiperOrigin-RevId:
257013183
Jacques Pienaar [Mon, 8 Jul 2019 17:52:16 +0000 (10:52 -0700)]
Remove dead code.
PiperOrigin-RevId:
257012369
River Riddle [Mon, 8 Jul 2019 17:30:20 +0000 (10:30 -0700)]
Add 'hasTrait' support to Operation.
This is accomplished by adding a new callback to AbstractOperation that takes a ClassID for a given trait type and compares that against the ClassIDs for the traits used when registering an operation. This allows for opaquely querying if an operation was registered with a given trait, e.g:
Operation *op = ...;
bool singleResult = op->hasTrait<OpTrait::OneResult>();
PiperOrigin-RevId:
257007710
Lei Zhang [Mon, 8 Jul 2019 17:10:39 +0000 (10:10 -0700)]
[spirv] NFC: Remove functions wrapping spv.module in tests
Now both functions and modules are just general ops and we do not require
top-level entities in a module's block to be the old builtin functions
any more. Removing the wrapping functions to simplify the tests.
PiperOrigin-RevId:
257003572
Jacques Pienaar [Mon, 8 Jul 2019 16:35:19 +0000 (09:35 -0700)]
Add missing overrides.
PiperOrigin-RevId:
256995548
Jacques Pienaar [Mon, 8 Jul 2019 15:19:19 +0000 (08:19 -0700)]
Remove std::move of trivially-copyable type.
Address ClangTidy finding:
* std::move of the expression of the trivially-copyable type 'mlir::Module' (aka 'mlir::ModuleOp') has no effect; remove std::move()
PiperOrigin-RevId:
256981849
Jacques Pienaar [Mon, 8 Jul 2019 15:04:40 +0000 (08:04 -0700)]
Include missing header.
This target was failing to build with newer version of libc++.
PiperOrigin-RevId:
256979592
Alex Zinenko [Mon, 8 Jul 2019 11:17:45 +0000 (04:17 -0700)]
LinalgOp::Model: add missing override specifiers
All non-static functions in LinalgOp::Model override pure virtual functions
from LinalgOp::Concept, but only some of them have the `override` specifier.
This may lead one to erroneously believe the functions without the specified
are not overrides or virtual functions. Add the specifier to all relevant
functions.
PiperOrigin-RevId:
256948453
Jacques Pienaar [Sun, 7 Jul 2019 21:04:46 +0000 (14:04 -0700)]
Use isa instead of dyn_cast as cast value isn't used.
Avoids unused variable warning.
PiperOrigin-RevId:
256874512
Lei Zhang [Fri, 5 Jul 2019 17:05:16 +0000 (10:05 -0700)]
Migrate NativeCodeCall and AllAttrConstraintsOf tests to use TestDialect
PiperOrigin-RevId:
256685260
Lei Zhang [Fri, 5 Jul 2019 16:23:47 +0000 (09:23 -0700)]
Migrate pattern attribute matching tests to use TestDialect
This CL also reorders op definitions and tests a bit to make them
group more logically.
PiperOrigin-RevId:
256682105
Nicolas Vasilache [Fri, 5 Jul 2019 12:04:53 +0000 (05:04 -0700)]
Move StdForOp to ODS ForOp
PiperOrigin-RevId:
256657155
Nicolas Vasilache [Fri, 5 Jul 2019 10:34:49 +0000 (03:34 -0700)]
Add a standard if op
This CL adds an "std.if" op to represent an if-then-else construct whose condition is an arbitrary value of type i1.
This is necessary to lower all the existing examples from affine and linalg to std.for + std.if.
This CL introduces the op and adds the relevant positive and negative unit test. Lowering will be done in a separate followup CL.
PiperOrigin-RevId:
256649138
Alex Zinenko [Fri, 5 Jul 2019 09:51:26 +0000 (02:51 -0700)]
Simplify launch_func rewrite pattern in mlir-cuda-runner
Use the bulk setOperands on the cloned operation, no need to cast or iterate
over the operand list.
PiperOrigin-RevId:
256643496
Alex Zinenko [Fri, 5 Jul 2019 09:27:39 +0000 (02:27 -0700)]
ODS: provide a flag to skip generation of default build methods
Some operations need to override the default behavior of builders, in
particular region-holding operations such as affine.for or tf.graph want to
inject default terminators into the region upon construction, which default
builders won't do. Provide a flag that disables the generation of default
builders so that the custom builders could use the same function signatures.
This is an intentionally low-level and heavy-weight feature that requires the
entire builder to be implemented, and it should be used sparingly. Injecting
code into the end of a default builder would depend on the naming scheme of the
default builder arguments that is not visible in the ODS. Checking that the
signature of a custom builder conflicts with that of a default builder to
prevent emission would require teaching ODG to differentiate between types and
(optional) argument names in the generated C++ code. If this flag ends up
being used a lot, we should consider adding traits that inject specific code
into the default builder.
PiperOrigin-RevId:
256640069
Nicolas Vasilache [Fri, 5 Jul 2019 09:20:38 +0000 (02:20 -0700)]
Add ODS accessors for named regions.
PiperOrigin-RevId:
256639471
Chris Lattner [Fri, 5 Jul 2019 05:17:42 +0000 (22:17 -0700)]
Trivial typo in comment fix.
PiperOrigin-RevId:
256616187
River Riddle [Thu, 4 Jul 2019 20:22:42 +0000 (13:22 -0700)]
NFC: Remove Region::getContainingFunction as Functions are now Operations.
PiperOrigin-RevId:
256579717
Alex Zinenko [Thu, 4 Jul 2019 20:05:28 +0000 (13:05 -0700)]
Fix another incorrect forward declaration of LogicalResult
LogicalResult is a struct and the Windows build is unhappy about it being
forward-declared as class.
PiperOrigin-RevId:
256578230
Alex Zinenko [Thu, 4 Jul 2019 17:16:39 +0000 (10:16 -0700)]
Forward-declare LogicalResult as struct
LogicalResult is a struct but some headers forward-declare it as a class, which
breaks Windows builds. Forward-delcare as a struct instead.
PiperOrigin-RevId:
256565699
Alex Zinenko [Thu, 4 Jul 2019 15:18:45 +0000 (08:18 -0700)]
Make TranslateFromMLIRFunction type return LogicalResult instead of bool
This interface was created before MLIR introduced LogicalResult.
PiperOrigin-RevId:
256554557
Stephan Herhut [Thu, 4 Jul 2019 14:49:52 +0000 (07:49 -0700)]
Add an mlir-cuda-runner tool.
This tool allows to execute MLIR IR snippets written in the GPU dialect
on a CUDA capable GPU. For this to work, a working CUDA install is required
and the build has to be configured with MLIR_CUDA_RUNNER_ENABLED set to 1.
PiperOrigin-RevId:
256551415
Alex Zinenko [Thu, 4 Jul 2019 14:47:34 +0000 (07:47 -0700)]
AllocOp: drop redundant verifier check
The equality check between the rank of a memref and the input size of the
layout affine map in AllocOp::verify is subsumed by the well-formedness check
of the memref type itself. Drop the redundant check from the verifier since it
is never exercised (the type builder does not allow one to construct a type
that would not pass the verifier check).
PiperOrigin-RevId:
256551247
Stephan Herhut [Thu, 4 Jul 2019 14:02:25 +0000 (07:02 -0700)]
Add missing mlir:: namespace in definition of createConvertToLLVMIRPass.
PiperOrigin-RevId:
256546769
Alex Zinenko [Thu, 4 Jul 2019 11:41:02 +0000 (04:41 -0700)]
Make ConvertStandardToLLVMPass extendable with other patterns
Extend the LLVM lowering pass to accept callbacks that construct an instance of
(a subclass of) LLVMTypeConverter and populate a list of conversion patterns.
These callbacks will be called when the pass processes a module and their
results will be used to set up the dialect conversion infrastructure. Clients
can now provide additional conversion patterns to avoid the need of
materializing type conversions between LLVM and other types.
PiperOrigin-RevId:
256532415
Mahesh Ravishankar [Thu, 4 Jul 2019 01:12:52 +0000 (18:12 -0700)]
NFC: Refactoring to remove code bloat in SPIRV due to handling of Enum
Class Attribute parsing
PiperOrigin-RevId:
256471248
Lei Zhang [Thu, 4 Jul 2019 00:17:33 +0000 (17:17 -0700)]
[TableGen] Support creating multi-result ops in result patterns
This CL introduces a new syntax for creating multi-result ops and access their
results in result patterns. Specifically, if a multi-result op is unbound or
bound to a name without a trailing `__N` suffix, it will act as a value pack
and expand to all its values. If a multi-result op is bound to a symbol with
`__N` suffix, only the N-th result will be extracted and used.
PiperOrigin-RevId:
256465208
River Riddle [Wed, 3 Jul 2019 20:21:24 +0000 (13:21 -0700)]
Replace the implementation of Function and Module with FuncOp and ModuleOp.
This is an important step in allowing for the top-level of the IR to be extensible. FuncOp and ModuleOp contain all of the necessary functionality, while using the existing operation infrastructure. As an interim step, many of the usages of Function and Module, including the name, will remain the same. In the future, many of these will be relaxed to allow for many different types of top-level operations to co-exist.
PiperOrigin-RevId:
256427100
Andy Davis [Wed, 3 Jul 2019 17:35:03 +0000 (10:35 -0700)]
Globally change load/store/dma_start/dma_wait operations over to affine.load/store/dma_start/dma_wait.
In most places, this is just a name change (with the exception of affine.dma_start swapping the operand positions of its tag memref and num_elements operands).
Significant code changes occur here:
*) Vectorization: LoopAnalysis.cpp, Vectorize.cpp
*) Affine Transforms: Transforms/Utils/Utils.cpp
PiperOrigin-RevId:
256395088
Nicolas Vasilache [Wed, 3 Jul 2019 12:05:05 +0000 (05:05 -0700)]
More general subview calculation in tiling
This CL refactors tiling to enable tiling of views that are not just specified by a simple permutation. This allows the tiling of convolutions for which a new example is added.
PiperOrigin-RevId:
256346028
Nicolas Vasilache [Wed, 3 Jul 2019 09:56:37 +0000 (02:56 -0700)]
Add a generic loop abstraction to the std dialect
This CL is the first step of a refactoring unification of the control flow abstraction used in different dialects. The `std.for` loop accepts unrestricted indices to encode min, max and step and will be used as a common abstraction on the way to lower level dialects.
PiperOrigin-RevId:
256331795
River Riddle [Wed, 3 Jul 2019 01:32:34 +0000 (18:32 -0700)]
NFC: Allow clearing the functions of a Module and splicing the functions from other modules.
PiperOrigin-RevId:
256280543
River Riddle [Wed, 3 Jul 2019 01:24:58 +0000 (18:24 -0700)]
Add support for getting and setting the dialect attributes of an operation.
This allows for handling dialect attributes, those with names starting with a dialect prefix, to be handled explicitly.
PiperOrigin-RevId:
256279728
River Riddle [Wed, 3 Jul 2019 01:05:04 +0000 (18:05 -0700)]
Add a 'getOps<>' method to Block to only iterate operations of a certain kind.
PiperOrigin-RevId:
256277436
Lei Zhang [Wed, 3 Jul 2019 00:22:21 +0000 (17:22 -0700)]
NFC: Move Standard to SPIR-V conversion to lib/Conversion
PiperOrigin-RevId:
256271759
River Riddle [Tue, 2 Jul 2019 22:00:38 +0000 (15:00 -0700)]
NFC: Move the Function/Module/Operation::verify methods out-of-line.
As Functions/Modules becomes operations, these methods will conflict with the 'verify' hook already on derived operation types.
PiperOrigin-RevId:
256246112
Nicolas Vasilache [Tue, 2 Jul 2019 21:17:30 +0000 (14:17 -0700)]
Add support for promoting Linalg views into new buffers.
This CL uses the generic CopyOp to promote a subview (constructed during tiling) into a new buffer + copy by:
1. Creating a new buffer for the subview.
2. Taking a view into the buffer and copying into it.
3. Adapting the linalg op to operating on the view from point 2.
Tiling is extended with a boolean flag to enable promoting views (all or nothing for now).
More specifically, the current implementation creates a buffer that is always of the full size of the ranges of the subview. This produces a buffer whose size may be bigger
than the actual size of the `subView` at the boundaries and is related to the full/partial tile problem.
In practice, we introduce a `buffer`, a `fullLocalView` and a `partialLocalView` such that:
* `buffer` is always the size of the subview in the full tile case.
* `fullLocalView` is a dense contiguous view into that buffer.
* `partialLocalView` is a dense non-contiguous slice of `fullLocalView`
that corresponds to the size of `subView` and accounting for boundary
effects.
The point of the full tile buffer is that constant static tile sizes are
folded and result in a buffer type with statically known size and alignment
properties.
Padding is introduced on the boundary tiles with a `fill` op followed by a partial `copy` op.
These behaviors will be refined later, on a per-need basis.
PiperOrigin-RevId:
256237319
Mahesh Ravishankar [Tue, 2 Jul 2019 19:30:34 +0000 (12:30 -0700)]
Add support for SPIR-V Struct Types. Current support is limited to
supporting only Offset decorations
PiperOrigin-RevId:
256216704
Lei Zhang [Tue, 2 Jul 2019 18:19:22 +0000 (11:19 -0700)]
[spirv] Various small improvements
* Added comments
* Improved op creation
* Used LogicalResult where suitable
PiperOrigin-RevId:
256203068
River Riddle [Tue, 2 Jul 2019 17:49:17 +0000 (10:49 -0700)]
NFC: Refactor Module to be value typed.
As with Functions, Module will soon become an operation, which are value-typed. This eases the transition from Module to ModuleOp. A new class, OwningModuleRef is provided to allow for owning a reference to a Module, and will auto-delete the held module on destruction.
PiperOrigin-RevId:
256196193
Brett Koonce [Sat, 20 Apr 2019 01:15:44 +0000 (18:15 -0700)]
docs: minor spelling tweaks
Close tensorflow/mlir#23
Mahesh Ravishankar [Tue, 2 Jul 2019 17:13:34 +0000 (10:13 -0700)]
Resolving buffer operand of linalg.view doesnt have the information
about the buffer size. This is needed to resolve the operand
correctly. Add that information to view op
serialization/deserialization
Also modify the parsing of buffer type by splitting at 'x' to
side-step issues with StringRef number parsing.
PiperOrigin-RevId:
256188319
Jacques Pienaar [Tue, 2 Jul 2019 15:39:46 +0000 (08:39 -0700)]
Update readme to reflect accepting contributions.
PiperOrigin-RevId:
256171145
Lei Zhang [Tue, 2 Jul 2019 15:27:32 +0000 (08:27 -0700)]
[ODS] NFC: Rename EnumAttr to StrEnumAttr to be consistent with IntEnumAttr
PiperOrigin-RevId:
256169019
Lei Zhang [Tue, 2 Jul 2019 13:02:20 +0000 (06:02 -0700)]
[spirv] Use I32EnumAttr for enum attributes
This saves us the excessive string conversions and comparisons in
verification and transformation and scopes them only to parsing
and printing, which are meant for I/O so string conversions should
be fine.
In order to do this, changed the custom assembly format of
spv.module regarding addressing model and memory model.
PiperOrigin-RevId:
256149856
River Riddle [Tue, 2 Jul 2019 05:35:06 +0000 (22:35 -0700)]
NFC: Update the Operation 'walk' methods to use llvm::function_ref instead of std::function.
PiperOrigin-RevId:
256099638
River Riddle [Tue, 2 Jul 2019 05:15:13 +0000 (22:15 -0700)]
NFC: Add several utilities to OpState.
* 'walk' functionality.
* Method to set the location.
* 'dump'/'print' methods.
* Method to set the attributes.
PiperOrigin-RevId:
256097960
Lei Zhang [Tue, 2 Jul 2019 03:56:13 +0000 (20:56 -0700)]
EnumsGen: remove dangling assertion
StringAttr-backed enum attribute cases changed to allow explicit values,
But this assertion was not deleted.
Fixes https://github.com/tensorflow/mlir/issues/39
PiperOrigin-RevId:
256090793
Jacques Pienaar [Tue, 2 Jul 2019 00:40:40 +0000 (17:40 -0700)]
Update variable naming to match LLVM coding style.
Update to follow enumerators naming style
https://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly
this also avoids the mach/boolean.h macros.
PiperOrigin-RevId:
256069831
Alex Zinenko [Mon, 1 Jul 2019 21:38:02 +0000 (14:38 -0700)]
gpu::LaunchOp: canonicalize away constant kernel arguments
The GPU Launch operation may take constants as arguments, in particular
affine-to-GPU mapping pass automatically forwards potentially constant lower
bounds of loops into the kernel. Define a canonicalization pattern for
LaunchOp that recreates the constants inside the kernel region instead of
accepting them as kernel arguments. This is currently restricted to standard
constants but may be extended to other constant operations.
Also fix an off-by-one indexing bug in OperandStorage::eraseOperand.
PiperOrigin-RevId:
256035437
River Riddle [Mon, 1 Jul 2019 21:10:52 +0000 (14:10 -0700)]
Generalize the CFG graph printing for Functions to work on Regions instead.
PiperOrigin-RevId:
256029944
River Riddle [Mon, 1 Jul 2019 17:53:31 +0000 (10:53 -0700)]
Standardize the definition and usage of getAllArgAttrs between FuncOp and Function.
PiperOrigin-RevId:
255988352
River Riddle [Mon, 1 Jul 2019 17:29:09 +0000 (10:29 -0700)]
NFC: Refactor Function to be value typed.
Move the data members out of Function and into a new impl storage class 'FunctionStorage'. This allows for Function to become value typed, which will greatly simplify the transition of Function to FuncOp(given that FuncOp is also value typed).
PiperOrigin-RevId:
255983022
River Riddle [Mon, 1 Jul 2019 17:12:33 +0000 (10:12 -0700)]
Update the 1->N legalizer test to use "test.return" so that the conversion cast is elided properly.
PiperOrigin-RevId:
255979732
Alex Zinenko [Mon, 1 Jul 2019 16:52:53 +0000 (09:52 -0700)]
TypeConversion: do not materialize conversion of the type to itself
Type conversion does not necessarily affect all types, some of them may remain
untouched. The type conversion tool from the dialect conversion framework will
unconditionally insert a temporary cast operation from the type to itself
anyway, and will try to materialize it to a real conversion operation if there
are remaining uses. Simply use the original value instead.
PiperOrigin-RevId:
255975450
Alex Zinenko [Mon, 1 Jul 2019 16:49:31 +0000 (09:49 -0700)]
Run FileCheck on test-legalizer.mlir
The RUN line was missing a call to FileCheck making the test always pass. Add
the call to FileCheck and temporarily disable one of the tests that does not
produce the expected result.
PiperOrigin-RevId:
255974805
Andy Davis [Mon, 1 Jul 2019 15:32:44 +0000 (08:32 -0700)]
Add affine-to-standard lowerings for affine.load/store/dma_start/dma_wait.
PiperOrigin-RevId:
255960171
Lei Zhang [Mon, 1 Jul 2019 14:30:23 +0000 (07:30 -0700)]
Also disable generating underlying value to symbol conversion declaration when there is an enumerant without explicit value
PiperOrigin-RevId:
255950779
Lei Zhang [Mon, 1 Jul 2019 13:51:39 +0000 (06:51 -0700)]
Avoid generating underlying value to symbol conversion function if there is an enumerant without explicit value.
PiperOrigin-RevId:
255945801
Lei Zhang [Mon, 1 Jul 2019 12:26:14 +0000 (05:26 -0700)]
[ODS] Introduce IntEnumAttr
In ODS, right now we use StringAttrs to emulate enum attributes. It is
suboptimal if the op actually can and wants to store the enum as a
single integer value; we are paying extra cost on storing and comparing
the attribute value.
This CL introduces a new enum attribute subclass that are backed by
IntegerAttr. The downside with IntegerAttr-backed enum attributes is
that the assembly form now uses integer values, which is less obvious
than the StringAttr-backed ones. However, that can be remedied by
defining custom assembly form with the help of the conversion utility
functions generated via EnumsGen.
Choices are given to the dialect writers to decide which one to use for
their enum attributes.
PiperOrigin-RevId:
255935542
Nicolas Vasilache [Mon, 1 Jul 2019 08:31:15 +0000 (01:31 -0700)]
Add a folder-based EDSC intrinsics constructor (NFC)
PiperOrigin-RevId:
255908660
Alex Zinenko [Mon, 1 Jul 2019 07:47:58 +0000 (00:47 -0700)]
Expose AffineToGPUPass for use with PassManager
Originally, AffineToGPUPass was created and registered in the source file
mainly for testing purposes. Provide a factory function that constructs
AffineToGPU pass to make it usable in pass pipelines.
PiperOrigin-RevId:
255902831
River Riddle [Sun, 30 Jun 2019 17:44:07 +0000 (10:44 -0700)]
Extract the automatic function renaming and symbol table out of Module.
This functionality is now moved to a new class, ModuleManager. This class allows for inserting functions into a module, and will auto-rename them on insert to ensure a unique name. This now means that users adding new functions to a module must ensure that the function name is unique, as the Module will no longer do it automatically. This also means that Module::getNamedFunction now operates in O(N) instead of the O(c) time it did before. This simplifies the move of Modules to Operations as the ModuleOp will not be able to have this functionality.
PiperOrigin-RevId:
255846088
Nicolas Vasilache [Sun, 30 Jun 2019 14:07:50 +0000 (07:07 -0700)]
Move BufferAllocOp and BufferDeallocOp to ODS
This CL also fixes a parsing issue in the BufferType, adds LLVM lowering support for handling the static constant buffer size and a roundtrip test.
PiperOrigin-RevId:
255834356
jpienaar [Mon, 1 Jul 2019 16:54:15 +0000 (09:54 -0700)]
Merge pull request tensorflow/mlir#37 from tensorflow:jpienaar-patch-1
PiperOrigin-RevId:
255769524
jpienaar [Sat, 29 Jun 2019 01:06:45 +0000 (18:06 -0700)]
Update link to presentation
Jacques Pienaar [Sat, 29 Jun 2019 00:52:48 +0000 (17:52 -0700)]
Internal change
PiperOrigin-RevId:
255700627
A. Unique TensorFlower [Sat, 29 Jun 2019 00:59:58 +0000 (17:59 -0700)]
Merge pull request tensorflow/mlir#36 from pkanwar23:patch-2
PiperOrigin-RevId:
255694478
pkanwar23 [Fri, 28 Jun 2019 23:44:32 +0000 (16:44 -0700)]
Update CONTRIBUTING.md
Co-Authored-By: Mehdi Amini <joker.eph@gmail.com>
pkanwar23 [Fri, 28 Jun 2019 22:11:04 +0000 (15:11 -0700)]
Update CONTRIBUTING.md
pkanwar23 [Fri, 28 Jun 2019 22:05:13 +0000 (15:05 -0700)]
Update CONTRIBUTING.md
pkanwar23 [Fri, 28 Jun 2019 22:00:57 +0000 (15:00 -0700)]
Update CONTRIBUTING.md