abidmalikwaterloo updated this revision to Diff 429235.
abidmalikwaterloo edited the summary of this revision.
abidmalikwaterloo added a comment.
Herald added subscribers: cfe-commits, mgorny.
Herald added a project: clang.

Rebase the patch and clean some formatting as needed


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105255/new/

https://reviews.llvm.org/D105255

Files:
  clang/lib/Testing/CMakeLists.txt
  mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
  mlir/test/Dialect/OpenMP/ops.mlir

Index: mlir/test/Dialect/OpenMP/ops.mlir
===================================================================
--- mlir/test/Dialect/OpenMP/ops.mlir
+++ mlir/test/Dialect/OpenMP/ops.mlir
@@ -377,6 +377,31 @@
     return
 }
 
+// CHECK-LABEL: omp_target_data
+func @omp_target_data (%if_cond : i1, %device : si32,  %data1: memref<?xi32>, %data2: memref<?xi32>) -> () {
+
+    // CHECK: omp.target_data
+    "omp.target_data"(%if_cond, %device, %data1, %data2) ({
+       // CHECK: omp.terminator
+       //omp.terminator
+    }) {operand_segment_sizes = dense<[1,1,1,1,0,0,0,0,0,0,0,0]>: vector<12xi32> } : ( i1, si32, memref<?xi32>, memref<?xi32> ) -> ()
+
+    // CHECK: omp.target_enter_data
+    "omp.target_enter_data"(%if_cond, %device) ({
+       // CHECK: omp.terminator
+       //omp.terminator
+    }) {operand_segment_sizes = dense<[1,1,0,0,0,0,0,0,0,0]>: vector<10xi32>, nowait } : ( i1, si32 ) -> ()
+
+    // CHECK:omp.target_exit_data
+    "omp.target_exit_data"(%if_cond, %device)
+       {operand_segment_sizes = dense<[1,1,0,0,0,0,0,0,0,0]>: vector<10xi32>, nowait } : ( i1, si32 ) -> ()
+
+    // CHECK: omp.barrier
+    omp.barrier
+
+    return
+}
+
 // CHECK: omp.reduction.declare
 // CHECK-LABEL: @add_f32
 // CHECK: : f32
Index: mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
===================================================================
--- mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
+++ mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
@@ -562,6 +562,177 @@
   let assemblyFormat = "attr-dict";
 }
 
+//===---------------------------------------------------------------------===//
+// 2.12.2 target data Construct 
+//===---------------------------------------------------------------------===//
+
+def Target_Data: OpenMP_Op<"target_data", [AttrSizedOperandSegments]>{
+  let summary = "target data construct";
+  let description = [{
+    Map variables to a device data environment for the extent of the region.
+
+    The omp target data directive maps variables to a device data 
+    environment, and defines the lexical scope of the data environment 
+    that is created. The omp target data directive can reduce data copies 
+    to and from the offloading device when multiple target regions are using 
+    the same data.
+
+    The optional $if_expr parameter specifies a boolean result of a
+    conditional check. If this value is 1 or is not provided then the target
+    region runs on a device, if it is 0 then the target region is executed 
+    on the host device.
+
+    The optional $device parameter specifies the device number for the target 
+    region.
+
+    The optional $use_device_ptr specifies the device pointers to the 
+    corresponding list items in the device data environment
+	
+    The optional $use_device_addr specifies the adress of the objects in the 
+    device data enviornment
+
+    The $map_operands specifies operands with no map type
+
+    The $map_to_operands specifies operands with  map type "to"
+
+    The $map_from_operands specifies operands with map type "from"
+
+    The $map_alloc_operands specifies operands with map type "alloc"
+
+    The $map_release_operands specifies operands with map type "release"
+
+    The $map_delete_operands specifies operands with map type "delete"
+
+    The $map_type_modifier vector specifies the modifier for each map type 
+    operand
+  }];
+
+  let arguments = (ins Optional<I1>:$if_expr,
+             Optional<AnyInteger>:$device,
+             Variadic<AnyType>:$use_device_ptr,
+             Variadic<AnyType>:$use_device_addr,
+             Variadic<AnyType>:$map_operands,
+             Variadic<AnyType>:$map_to_operands,
+             Variadic<AnyType>:$map_from_operands,
+             Variadic<AnyType>:$map_to_from_operands,
+             Variadic<AnyType>:$map_alloc_operands,
+             Variadic<AnyType>:$map_release_operands,
+             Variadic<AnyType>:$map_delete_operands,
+             VectorOf<[AnyInteger]>:$map_type_modifier);
+
+  let regions = (region AnyRegion:$region);
+}
+
+//===---------------------------------------------------------------------===//
+// 2.12.3 target enter data Construct
+//===---------------------------------------------------------------------===//
+
+def Target_EnterDataOp: OpenMP_Op<"target_enter_data", 
+                                                 [AttrSizedOperandSegments]>{
+  let  summary = "target enter data construct";
+  let description = [{
+    The target enter data directive specifies that variables are mapped to 
+    a device data environment. The target enter data directive is a 
+    stand-alone directive.
+	
+    The optional $if_expr parameter specifies a boolean result of a
+    conditional check. If this value is 1 or is not provided then the target
+    region runs on a device, if it is 0 then the target region is executed on 
+    the host device.
+
+    The optional $device parameter specifies the device number for the 
+    target region.
+
+    The optional $nowait elliminates the implicit barrier so the parent task 
+    can make progress even if the target task is not yet completed.
+
+    The $map_operands specifies operands with no map type
+
+    The $map_to_operands specifies operands with  map type "to"
+
+    The $map_from_operands specifies operands with map type "from"
+
+    The $map_alloc_operands specifies operands with map type "alloc"
+
+    The $map_release_operands specifies operands with map type "release"
+
+    The $map_delete_operands specifies operands with map type "delete"
+
+    The $map_type_modifier vector specifies the modifier for each map type 
+    operand
+
+    TODO:  depend
+  }];
+
+  let arguments = (ins Optional<I1>:$if_expr,
+             Optional<AnyInteger>:$device,
+             UnitAttr:$nowait,
+             Variadic<AnyType>:$map_operands,
+             Variadic<AnyType>:$map_to_operands,
+             Variadic<AnyType>:$map_from_operands,
+             Variadic<AnyType>:$map_to_from_operands,
+             Variadic<AnyType>:$map_alloc_operands,
+             Variadic<AnyType>:$map_release_operands,
+             Variadic<AnyType>:$map_delete_operands,
+             VectorOf<[AnyInteger]>:$map_type_modifier);
+
+}
+
+//===---------------------------------------------------------------------===//
+// 2.12.4 target exit data Construct
+//===---------------------------------------------------------------------===//
+
+def Target_ExitDataOp: OpenMP_Op<"target_exit_data",
+                                                 [AttrSizedOperandSegments]>{
+  let  summary = "target exit data construct";
+  let description = [{
+    The target exit data directive specifies that variables are mapped to a 
+    device data environment. The target exit data directive is 
+    a stand-alone directive.
+
+    The optional $if_expr parameter specifies a boolean result of a
+    conditional check. If this value is 1 or is not provided then the target
+    region runs on a device, if it is 0 then the target region is executed 
+    on the host device.
+
+    The optional $device parameter specifies the device number for the 
+    target region.
+
+    The optional $nowait elliminates the implicit barrier so the parent 
+    task can make progress even if the target task is not yet completed.
+	
+    The $map_operands specifies operands with no map type
+
+    The $map_to_operands specifies operands with  map type "to"
+
+    The $map_from_operands specifies operands with map type "from"
+
+    The $map_alloc_operands specifies operands with map type "alloc"
+
+    The $map_release_operands specifies operands with map type "release"
+
+    The $map_delete_operands specifies operands with map type "delete"
+
+    The $map_type_modifier vector specifies the modifier for each map type 
+    operand
+
+    TODO: depend
+  }];
+
+  let arguments = (ins Optional<I1>:$if_expr,
+             Optional<AnyInteger>:$device,
+             UnitAttr:$nowait,
+             Variadic<AnyType>:$map_operands,
+             Variadic<AnyType>:$map_to_operands,
+             Variadic<AnyType>:$map_from_operands,
+             Variadic<AnyType>:$map_to_from_operands,
+             Variadic<AnyType>:$map_alloc_operands,
+             Variadic<AnyType>:$map_release_operands,
+             Variadic<AnyType>:$map_delete_operands,
+             VectorOf<[AnyInteger]>:$map_type_modifier);
+                                     
+}
+
 //===----------------------------------------------------------------------===//
 // 2.13.7 flush Construct
 //===----------------------------------------------------------------------===//
Index: clang/lib/Testing/CMakeLists.txt
===================================================================
--- clang/lib/Testing/CMakeLists.txt
+++ clang/lib/Testing/CMakeLists.txt
@@ -1,6 +1,9 @@
+<<<<<<< HEAD
 # Don't include this target in LLVMExports. FIXME: is there a cleaner way?
 set(EXCLUDE_FROM_ALL ON)
 
+=======
+>>>>>>> [Testing] TestAST, a helper for writing straight-line AST tests
 # Not add_clang_library: this is not part of clang's public library interface.
 # Unit tests should depend on this with target_link_libraries(), rather
 # than with clang_target_link_libraries().
@@ -26,4 +29,6 @@
 target_link_libraries(clangTesting
   PRIVATE
   llvm_gtest
+  clangBasic
+  clangFrontend
   )
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to