@@ -26,8 +26,7 @@ include "mlir/IR/BuiltinAttributes.td"
2626class cuf_Op<string mnemonic, list<Trait> traits>
2727 : Op<CUFDialect, mnemonic, traits>;
2828
29- def cuf_AllocOp : cuf_Op<"alloc", [AttrSizedOperandSegments,
30- MemoryEffects<[MemAlloc]>]> {
29+ def cuf_AllocOp : cuf_Op<"alloc", [AttrSizedOperandSegments]> {
3130 let summary = "Allocate an object on device";
3231
3332 let description = [{
@@ -47,7 +46,9 @@ def cuf_AllocOp : cuf_Op<"alloc", [AttrSizedOperandSegments,
4746 cuf_DataAttributeAttr:$data_attr
4847 );
4948
50- let results = (outs fir_ReferenceType:$ptr);
49+ // Value-scoped Allocate on the returned reference
50+ let results = (outs Res<fir_ReferenceType, "",
51+ [MemAlloc<DefaultResource>]>:$ptr);
5152
5253 let assemblyFormat = [{
5354 $in_type (`(` $typeparams^ `:` type($typeparams) `)`)?
@@ -84,8 +85,7 @@ def cuf_FreeOp : cuf_Op<"free", [MemoryEffects<[MemFree]>]> {
8485 let hasVerifier = 1;
8586}
8687
87- def cuf_AllocateOp : cuf_Op<"allocate", [AttrSizedOperandSegments,
88- MemoryEffects<[MemAlloc<DefaultResource>]>]> {
88+ def cuf_AllocateOp : cuf_Op<"allocate", [AttrSizedOperandSegments]> {
8989 let summary = "Perform the device allocation of data of an allocatable";
9090
9191 let description = [{
@@ -94,7 +94,9 @@ def cuf_AllocateOp : cuf_Op<"allocate", [AttrSizedOperandSegments,
9494 is initialized before with the standard flang runtime calls.
9595 }];
9696
97- let arguments = (ins Arg<fir_ReferenceType, "", [MemRead, MemWrite]>:$box,
97+ // Value-scoped Allocate on the descriptor being allocated
98+ let arguments = (ins Arg<fir_ReferenceType, "",
99+ [MemAlloc<DefaultResource>, MemRead, MemWrite]>:$box,
98100 Arg<Optional<AnyRefOrBoxType>, "", [MemWrite]>:$errmsg,
99101 Optional<fir_ReferenceType>:$stream,
100102 Arg<Optional<AnyRefOrBoxType>, "", [MemWrite]>:$pinned,
0 commit comments