[PATCH] D79620: [mlir] Adapted standard Alloc and Alloca ops to use different side-effect resources.
Marcel Koester via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 13 05:21:55 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG881c3bb6a732: [mlir] Adapted standard Alloc and Alloca ops to use new side-effect resources. (authored by dfki-mako).
Changed prior to commit:
https://reviews.llvm.org/D79620?vs=262832&id=263676#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79620/new/
https://reviews.llvm.org/D79620
Files:
mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
mlir/include/mlir/Interfaces/SideEffectInterfaces.td
mlir/include/mlir/Interfaces/SideEffects.h
Index: mlir/include/mlir/Interfaces/SideEffects.h
===================================================================
--- mlir/include/mlir/Interfaces/SideEffects.h
+++ mlir/include/mlir/Interfaces/SideEffects.h
@@ -122,6 +122,13 @@
StringRef getName() final { return "<Default>"; }
};
+/// An automatic allocation-scope resource that is valid in the context of a
+/// parent AutomaticAllocationScope trait.
+struct AutomaticAllocationScopeResource
+ : public Resource::Base<AutomaticAllocationScopeResource> {
+ StringRef getName() final { return "AutomaticAllocationScope"; }
+};
+
/// This class represents a specific instance of an effect. It contains the
/// effect being applied, a resource that corresponds to where the effect is
/// applied, and an optional value(either operand, result, or region entry
Index: mlir/include/mlir/Interfaces/SideEffectInterfaces.td
===================================================================
--- mlir/include/mlir/Interfaces/SideEffectInterfaces.td
+++ mlir/include/mlir/Interfaces/SideEffectInterfaces.td
@@ -33,6 +33,9 @@
// A link to the DefaultResource class.
def DefaultResource : IntrinsicResource<"DefaultResource">;
+// A link to the AutomaticAllocationScopeResource class.
+def AutomaticAllocationScopeResource :
+ IntrinsicResource<"AutomaticAllocationScopeResource">;
//===----------------------------------------------------------------------===//
// EffectOpInterface
Index: mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
===================================================================
--- mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
+++ mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
@@ -143,12 +143,14 @@
//
// %0 = alloclike(%m)[%s] : memref<8x?xf32, (d0, d1)[s0] -> ((d0 + s0), d1)>
//
-class AllocLikeOp<string mnemonic, list<OpTrait> traits = []> :
- Std_Op<mnemonic, !listconcat(traits, [MemoryEffects<[MemAlloc]>])> {
+class AllocLikeOp<string mnemonic,
+ Resource resource,
+ list<OpTrait> traits = []> :
+ Std_Op<mnemonic, !listconcat([MemoryEffects<[MemAlloc<resource>]>], traits)> {
let arguments = (ins Variadic<Index>:$value,
Confined<OptionalAttr<I64Attr>, [IntMinValue<0>]>:$alignment);
- let results = (outs Res<AnyMemRef, "", [MemAlloc]>);
+ let results = (outs Res<AnyMemRef, "", [MemAlloc<resource>]>);
let builders = [OpBuilder<
"OpBuilder &builder, OperationState &result, MemRefType memrefType", [{
@@ -310,7 +312,7 @@
// AllocOp
//===----------------------------------------------------------------------===//
-def AllocOp : AllocLikeOp<"alloc"> {
+def AllocOp : AllocLikeOp<"alloc", DefaultResource> {
let summary = "memory allocation operation";
let description = [{
The `alloc` operation allocates a region of memory, as specified by its
@@ -357,7 +359,7 @@
// AllocaOp
//===----------------------------------------------------------------------===//
-def AllocaOp : AllocLikeOp<"alloca"> {
+def AllocaOp : AllocLikeOp<"alloca", AutomaticAllocationScopeResource> {
let summary = "stack memory allocation operation";
let description = [{
The `alloca` operation allocates memory on the stack, to be automatically
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79620.263676.patch
Type: text/x-patch
Size: 3243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200513/5cf2de42/attachment.bin>
More information about the llvm-commits
mailing list