diff --git a/Abid_ReadME.txt b/Abid_ReadME.txt deleted file mode 100644 --- a/Abid_ReadME.txt +++ /dev/null @@ -1,87 +0,0 @@ -Start date : May 4th, 2021 ---------------------------- - -How to install LLVM on Mac: -1) There is a problem in installing with libcxxabi and libcxx. So, on my Mac, I installed it with out these two projects. However, I need to understand why it was not building on Mac with the LLVM. It works on Shilie' MacBook - -2) The configuration that works for me: - -cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DLLVM_INCLUDE_TESTS=OFF ../llvm -DLLVM_ENABLE_PROJECTS="mlir;clang;clang-tools-extra;lld;openmp" -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_INSTALL_PREFIX=/Users/abidmalik/Programming/MLIR_target/llvm-project/myInstall -DCMAKE_CXX_FLAGS="-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ -std=c++14" - -ninja all for builfing -ninja install for installing - -I am not sure about the -DCMAKE_CXX_FLAGS="-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ -std=c++14" flag as I played with it to overcome the problem with libcxxabi and libcxx. I will try to build that same with this flag. - -The build works without the aformentioned flag as well. - -Python3 is required -if there is a problem on Mac about the python instalation check the following website -https://mattbanderson.com/so-you-hosed-your-mac-os-python-install/ - - -May 5th, 2021 --------------- --DCMAKE_CXX_FLAGS="-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ -std=c++14" - -Python 3.* is needed. -On my Mac, the default was Python 2.7. You can alias python = 'Python3' to make the python3 as your default. -** Still need to check why libcxxabi and libcxx could not build on my Mac. However, we donot need them for my MLIR OpenMP dialect work - -May 7th, 2021 --------------- - -When I cmake: The following error was raised: - - -No rule to make target /usr/lib/libz.dylib', needed by `lib/libzip.5.3.dylib'. Stop. - -The solution was found on the following link - -https://stackoverflow.com/questions/62719000/can-not-find-libz-dylib-when-build-libzip-by-homebrew-in-mac-os-10-16-big-sur - -I reinstall the libbz with brew and also use the DZLIB_LIBRARY_RELEASE flag to the library. It works and error was not there. - - -Also an interesting link for building LLVM - -https://lists.llvm.org/pipermail/llvm-dev/2019-September/135333.html - -May 8th, 2021 -============== - -For LLVM_9 , the following configuration work - -cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DLLVM_INCLUDE_TESTS=OFF ../llvm -DLLVM_ENABLE_PROJECTS="mlir;clang;clang-tools-extra;lld;openmp" -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_INSTALL_PREFIX=/Users/abidmalik/Programming/LLVM_9/llvm-project/INSATLL -DCMAKE_CXX_FLAGS="-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ -std=c++14" - - -I am not pointing anything. for libz.dylib which is needed for LLVM_11. - -Question: Any reason why? Is it related to the LLVM version? Need to check with the LLVM community. - - - -May 17th, 2021 -=============== - -Build the MLIR with - - -cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_INCLUDE_TESTS=ON ../llvm -DLLVM_ENABLE_PROJECTS=mlir -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_INSTALL_PREFIX=/Users/abidmalik/Programming/MLIR_target/llvm-project/INSTALL/ -DCMAKE_CXX_FLAGS="-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ -std=c++14" - - -and then - -cmake --build . --target check-mlir - -Now all tests are passing - - -May 18th, 2021 -=============== - -FYI, - -TableGen syntax sometimes can be obscure; reading the generated content can be a very helpful way to understand and debug issues. -To build mlir-tblgen, run cmake --build . --target mlir-tblgen in your build directory and find the mlir-tblgen binary in the bin/ subdirectory. -All the supported generators can be found via mlir-tblgen --help. For example, --gen-op-decls and --gen-op-defs as explained in Generated C++ code . diff --git a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td --- a/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td +++ b/mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td @@ -241,6 +241,167 @@ 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:$if_expr, + Optional:$device, + Variadic:$use_device_ptr, + Variadic:$use_device_addr, + Variadic:$map_operands, + Variadic:$map_to_operands, + Variadic:$map_from_operands, + Variadic:$map_to_from_operands, + Variadic:$map_alloc_operands, + Variadic:$map_release_operands, + Variadic:$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:$if_expr, + Optional:$device, + UnitAttr:$nowait, + Variadic:$map_operands, + Variadic:$map_to_operands, + Variadic:$map_from_operands, + Variadic:$map_to_from_operands, + Variadic:$map_alloc_operands, + Variadic:$map_release_operands, + Variadic:$map_delete_operands, + VectorOf<[AnyInteger]>:$map_type_modifier); + + let regions = (region AnyRegion:$region); +} + +//===---------------------------------------------------------------------===// +// 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:$if_expr, + Optional:$device, + UnitAttr:$nowait, + Variadic:$map_operands, + Variadic:$map_to_operands, + Variadic:$map_from_operands, + Variadic:$map_to_from_operands, + Variadic:$map_alloc_operands, + Variadic:$map_release_operands, + Variadic:$map_delete_operands, + VectorOf<[AnyInteger]>:$map_type_modifier); + +} + //===----------------------------------------------------------------------===// // 2.13.7 flush Construct //===----------------------------------------------------------------------===// diff --git a/mlir/test/Dialect/OpenMP/ops.mlir b/mlir/test/Dialect/OpenMP/ops.mlir --- a/mlir/test/Dialect/OpenMP/ops.mlir +++ b/mlir/test/Dialect/OpenMP/ops.mlir @@ -278,3 +278,28 @@ return } +// CHECK-LABEL: omp_target_data +func @omp_target_data (%if_cond : i1, %device : si32, %data1: memref, %data2: memref) -> () { + + // 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, memref ) -> () + + // 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 +} +