Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mlir/lib/Dialect/OpenACC/IR/OpenACC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3513,7 +3513,8 @@ checkDeclareOperands(Op &op, const mlir::ValueRange &operands,
"at least one operand must appear on the declare operation");

for (mlir::Value operand : operands) {
if (!mlir::isa<acc::CopyinOp, acc::CopyoutOp, acc::CreateOp,
if (isa<BlockArgument>(operand) ||
!mlir::isa<acc::CopyinOp, acc::CopyoutOp, acc::CreateOp,
acc::DevicePtrOp, acc::GetDevicePtrOp, acc::PresentOp,
acc::DeclareDeviceResidentOp, acc::DeclareLinkOp>(
operand.getDefiningOp()))
Expand Down
9 changes: 9 additions & 0 deletions mlir/test/Dialect/OpenACC/invalid.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -831,3 +831,12 @@ func.func @acc_loop_container() {
%value = memref.alloc() : memref<f32>
// expected-error @below {{invalid data clause modifiers: readonly}}
%0 = acc.create varPtr(%value : memref<f32>) -> memref<f32> {modifiers = #acc<data_clause_modifier readonly,zero,capture,always>}

// -----

func.func @verify_declare_enter(%arg0 : memref<i32>) {
// expected-error @below {{expect valid declare data entry operation or acc.getdeviceptr as defining op}}
%0 = acc.declare_enter dataOperands(%arg0 : memref<i32>)
acc.declare_exit token(%0) dataOperands(%arg0 : memref<i32>)
return
}