Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenMPTarget: clang extensions for dynamic shared memory. (#6380)
* OpenMPTarget: clang extensions for dynamic shared memory. * OpenMPTarget: Rebase and use macros for pragma. * OpenMPTarget: Fix bug. Add Macros file. * OpenMPTarget: Fix resize_scratch. * OpenMPTarget: restore map clause. * OpenMPTarget: Fix comment. * OpenMPTarget: change L0 values in resize_scratch. * OpenMPTarget: Fix comment and spaces. --------- Co-authored-by: Rahulkumar Gayatri <rgayatri@lbl.gov>
- Loading branch information
1 parent
24b6484
commit 843fca3
Showing
5 changed files
with
102 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
//@HEADER | ||
// ************************************************************************ | ||
// | ||
// Kokkos v. 4.0 | ||
// Copyright (2022) National Technology & Engineering | ||
// Solutions of Sandia, LLC (NTESS). | ||
// | ||
// Under the terms of Contract DE-NA0003525 with NTESS, | ||
// the U.S. Government retains certain rights in this software. | ||
// | ||
// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://kokkos.org/LICENSE for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//@HEADER | ||
|
||
#ifndef KOKKOS_OPENMPTARGET_MACROS_HPP | ||
#define KOKKOS_OPENMPTARGET_MACROS_HPP | ||
|
||
// Intel architectures prefer the classical hierarchical parallelism that relies | ||
// on OpenMP. | ||
#if defined(KOKKOS_ARCH_INTEL_GPU) | ||
#define KOKKOS_IMPL_OPENMPTARGET_HIERARCHICAL_INTEL_GPU | ||
#endif | ||
|
||
// Define a macro for llvm compiler greater than version 17 and on NVIDIA and | ||
// AMD GPUs. This would be useful in cases where non-OpenMP standard llvm | ||
// extensions can be used. | ||
#if defined(KOKKOS_COMPILER_CLANG) && (KOKKOS_COMPILER_CLANG >= 1700) && \ | ||
(defined(KOKKOS_ARCH_AMD_GPU) || defined(KOKKOS_IMPL_ARCH_NVIDIA_GPU)) | ||
#define KOKKOS_IMPL_OPENMPTARGET_LLVM_EXTENSIONS | ||
#endif | ||
|
||
#define KOKKOS_IMPL_OPENMPTARGET_PRAGMA_HELPER(x) _Pragma(#x) | ||
#define KOKKOS_IMPL_OMPTARGET_PRAGMA(x) \ | ||
KOKKOS_IMPL_OPENMPTARGET_PRAGMA_HELPER(omp target x) | ||
|
||
// Use scratch memory extensions to request dynamic shared memory for the | ||
// right compiler/architecture combination. | ||
#ifdef KOKKOS_IMPL_OPENMPTARGET_LLVM_EXTENSIONS | ||
#define KOKKOS_IMPL_OMPX_DYN_CGROUP_MEM(N) ompx_dyn_cgroup_mem(N) | ||
#else | ||
#define KOKKOS_IMPL_OMPX_DYN_CGROUP_MEM(N) | ||
#endif | ||
|
||
#endif // KOKKOS_OPENMPTARGET_MACROS_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters