[OG12][committed] OpenMP, libgomp: Handle unified shared memory in omp_target_is_accessible.

2022-12-13 Thread Marcel Vollweiler
Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 commit 9044b7efb3518de180a5b3168615b7e12d93eea8 Author: Marcel Vollweiler Date: Tue Dec 13 12:04:48 2022 + OpenMP, libgomp: Handle unified shared memory

Re: [Patch] OpenMP, libgomp, gimple: omp_get_max_teams, omp_set_num_teams, and omp_{gs}et_teams_thread_limit on offload devices

2022-11-24 Thread Marcel Vollweiler
Hi Jakub, > * testsuite/libgomp.c-c++-common/icv-4.c: Bugfix. Better say what exactly you changed in words. Changed. > --- a/gcc/gimplify.cc > +++ b/gcc/gimplify.cc > @@ -14153,7 +14153,7 @@ optimize_target_teams (tree target, gimple_seq *pre_p) >struct gimplify_omp_ctx *target_ctx

Re: [Patch] OpenMP, libgomp, gimple: omp_get_max_teams, omp_set_num_teams, and omp_{gs}et_teams_thread_limit on offload devices

2022-09-18 Thread Marcel Vollweiler
Hi Jakub, The last version of this patch was slightly adapted to the latest changes of the device-specific environment variable syntax (https://gcc.gnu.org/pipermail/gcc-patches/2022-September/601145.html), also considering the latest related bug fixes (commits 994ea892bd02d and 7d37c7f67c1bb).

Re: [PATCH] OpenMP, libgomp: Environment variable syntax extension.

2022-08-31 Thread Marcel Vollweiler
Hi Jakub, Am 22.08.2022 um 17:35 schrieb Jakub Jelinek: +/* Default values of ICVs according to the OpenMP standard. */ +struct gomp_default_icv_t gomp_default_icv_values = { + .run_sched_var = GFS_DYNAMIC, + .run_sched_chunk_size = 1, + .max_active_levels_var = 1, + .bind_var =

Re: [Patch] OpenMP, libgomp, gimple: omp_get_max_teams, omp_set_num_teams, and omp_{gs}et_teams_thread_limit on offload devices

2022-08-03 Thread Marcel Vollweiler
Hi Jakub, This patch was reduced a bit and most of your comments were considered in the last submission of the environment variable syntax extension patch (https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599175.html). This patch also builds on that envvar patch version. The nteams-var

Re: [PATCH] OpenMP, libgomp: Environment variable syntax extension.

2022-07-25 Thread Marcel Vollweiler
Hi Jakub, I'm not sure we can rely on execv on all targets that do support libgomp. Any reason why you actually need this, rather than using dg-set-target-env-var directive(s) and perhaps return 0; if getenv doesn't return the expected values? Interesting topic. After some (internal)

[PING][Patch] OpenMP, libgomp, gimple: omp_get_max_teams, omp_set_num_teams, and omp_{gs}et_teams_thread_limit on offload devices

2022-06-09 Thread Marcel Vollweiler
Hi, I’d like to ping the patch for the OpenMP runtime routines omp_get_max_teams, omp_set_num_teams, and omp_{gs}et_teams_thread_limit on offload devices: https://gcc.gnu.org/pipermail/gcc-patches/2022-April/593260.html This patch builds on the following patch which is currently in

Re: [PATCH] OpenMP, libgomp: Add new runtime routines omp_target_memcpy_async and omp_target_memcpy_rect_async

2022-05-19 Thread Marcel Vollweiler
Hi Jakub, Am 17.05.2022 um 20:08 schrieb Jakub Jelinek: On Tue, May 17, 2022 at 11:57:02AM +0200, Marcel Vollweiler wrote: More importantly, I have no idea how this can work when you pass arg_size 0 and arg_align 0. The s variable is in the current function frame, with arg_size 0 nothing

Re: [PATCH] OpenMP, libgomp: Add new runtime routines omp_target_memcpy_async and omp_target_memcpy_rect_async

2022-05-17 Thread Marcel Vollweiler
Hi Jakub, --- a/libgomp/libgomp.map +++ b/libgomp/libgomp.map @@ -224,6 +224,8 @@ OMP_5.1 { omp_set_teams_thread_limit_8_; omp_get_teams_thread_limit; omp_get_teams_thread_limit_; +omp_target_memcpy_async; +omp_target_memcpy_rect_async; } OMP_5.0.2; These should be

Re: [PATCH] OpenMP, C++: Add template support for the has_device_addr clause.

2022-05-10 Thread Marcel Vollweiler
Hi Jakub, diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index 0cb17a6..452ecfd 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -8534,11 +8534,14 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) { if (handle_omp_array_sections (c, ort))

[PATCH] OpenMP, libgomp: Handle unified shared memory in omp_target_is_accessible.

2022-05-06 Thread Marcel Vollweiler
Hi, This is a follow up patch of the patch that adds the OpenMP runtime routine omp_target_is_accessible: https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591601.html It considers now also unified shared memory (usm) that was submitted recently (but not yet approved/committed):

Re: [Patch] OpenMP, libgomp: Add new runtime routine omp_target_is_accessible.

2022-05-06 Thread Marcel Vollweiler
Hi Jakub, Am 05.05.2022 um 11:33 schrieb Jakub Jelinek: On Mon, Mar 14, 2022 at 04:42:14PM +0100, Marcel Vollweiler wrote: --- a/libgomp/libgomp.map +++ b/libgomp/libgomp.map @@ -226,6 +226,11 @@ OMP_5.1 { omp_get_teams_thread_limit_; } OMP_5.0.2; +OMP_5.1.1 { + global

[Patch] OpenMP, libgomp, gimple: omp_get_max_teams, omp_set_num_teams, and omp_{gs}et_teams_thread_limit on offload devices

2022-04-14 Thread Marcel Vollweiler
Hi, This patch adds support for omp_get_max_teams, omp_set_num_teams, and omp_{gs}et_teams_thread_limit on offload devices. The patch builds on the following patches which are submitted, but not yet approved/committed: - [PATCH] OpenMP, libgomp: Environment variable syntax extension.

Re: [PATCH] OpenMP, Fortran: Bugfix for omp_set_num_teams.

2022-03-16 Thread Marcel Vollweiler
Hi Jakub, ! { dg-do run } ! { dg-additional-options "-fdefault-integer-8" } program set_num_teams_8 use omp_lib omp_set_num_teams (42) if (omp_get_num_teams () .ne. 42) stop 1 end program I modified your suggested test case a bit: program set_num_teams_8 use omp_lib use,

[PATCH] OpenMP, Fortran: Bugfix for omp_set_num_teams.

2022-03-15 Thread Marcel Vollweiler
Hi, This patch fixes a small bug for omp_set_num_teams in fortran.c. Marcel - Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft:

Re: [Patch] OpenMP, libgomp: Add new runtime routine omp_target_is_accessible.

2022-03-14 Thread Marcel Vollweiler
Hi Tobias, Minor remark to the test: On 11.03.22 13:30, Marcel Vollweiler wrote: + int d = omp_get_default_device (); ... + int shared_mem = 0; + #pragma omp target map (alloc: shared_mem) device (d) +shared_mem = 1; + if (omp_target_is_accessible (p, sizeof (int), d) != shared_mem

[Patch] OpenMP, libgomp: Add new runtime routine omp_target_is_accessible.

2022-03-11 Thread Marcel Vollweiler
Hi, This patch adds the OpenMP runtime routine "omp_target_is_accessible" which was introduced in OpenMP 5.1 (specification section 3.8.4): "The omp_target_is_accessible routine tests whether host memory is accessible from a given device." "This routine returns true if the storage of size

Re: [PATCH] OpenMP, libgomp: Add new runtime routine omp_get_mapped_ptr.

2022-03-10 Thread Marcel Vollweiler
Hi Jakub, This is an update to the patch from Tue Mar 8: https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591343.html I just added "get_mapped_ptr" to the "omp_runtime_apis" array in omp-low.cc and replaced "omp_get_num_devices" by "gomp_get_num_devices" in target.c. Marcel

Re: [PATCH] OpenMP, libgomp: Add new runtime routine omp_get_mapped_ptr.

2022-03-08 Thread Marcel Vollweiler
Hi Jakub, diff --git a/libgomp/libgomp.map b/libgomp/libgomp.map index 2ac5809..00a4858 100644 --- a/libgomp/libgomp.map +++ b/libgomp/libgomp.map @@ -224,6 +224,7 @@ OMP_5.1 { omp_set_teams_thread_limit_8_; omp_get_teams_thread_limit; omp_get_teams_thread_limit_; +

[PATCH] OpenMP, libgomp: Add new runtime routine omp_get_mapped_ptr.

2022-03-04 Thread Marcel Vollweiler
Hi, This patch adds the OpenMP runtime routine "omp_get_mapped_ptr" which was introduced in OpenMP 5.1 (specification section 3.8.11): "The omp_get_mapped_ptr routine returns the device pointer that is associated with a host pointer for a given device." "The device_num argument must be greater

[PATCH] OpenMP, C++: Add template support for the has_device_addr clause.

2022-02-23 Thread Marcel Vollweiler
Hi, The patch for adding the has_device_addr clause on the target construct was recently committed (bbb7f8604e1dfc08f44354cfd93d2287f2fdd489). Additionally, this patch adds support for list items in the has_device_addr clause which type is given by C++ template parameters. Marcel

[PATCH] OpenMP, libgomp: Add new runtime routines omp_target_memcpy_async and omp_target_memcpy_rect_async

2022-02-21 Thread Marcel Vollweiler
Hi, This patch adds two new OpenMP runtime routines: omp_target_memcpy_async and omp_target_memcpy_rect_async. Both functions are introduced in OpenMP 5.1 as asynchronous variants of omp_target_memcpy and omp_target_memcpy_rect. In contrast to the synchronous variants, the asynchronous

Re: [PATCH] C, C++, Fortran, OpenMP: Add 'has_device_addr' clause to 'target' construct

2022-02-02 Thread Marcel Vollweiler
Hi Jakub, +case OMP_CLAUSE_HAS_DEVICE_ADDR: + t = OMP_CLAUSE_DECL (c); + if (TREE_CODE (t) == TREE_LIST) +{ + if (handle_omp_array_sections (c, ort)) +remove = true; + else +{ + t = OMP_CLAUSE_DECL (c); +

[PATCH] OpenMP, libgomp: Environment variable syntax extension.

2022-01-18 Thread Marcel Vollweiler
Hi, This patch considers the environment variable syntax extension for device-specific variants of environment variables from OpenMP 5.1 (see OpenMP 5.1 specification, p. 75 and p. 639). An environment variable (e.g. OMP_NUM_TEAMS) can have different suffixes: _DEV (e.g. OMP_NUM_TEAMS_DEV):

OpenMP, libgomp: Environment variable syntax extension.

2022-01-18 Thread Marcel Vollweiler
Hi, This patch considers the environment variable syntax extension for device-specific variants of environment variables from OpenMP 5.1 (see OpenMP 5.1 specification, p. 75 and p. 639). An environment variable (e.g. OMP_NUM_TEAMS) can have different suffixes: _DEV (e.g. OMP_NUM_TEAMS_DEV):

Re: [PATCH] libgomp, OpenMP: Fix issue for omp_get_device_num on gfx targets.

2022-01-18 Thread Marcel Vollweiler
Hi Thomas, Am 18.01.2022 um 13:25 schrieb Thomas Schwinge: Hi! Maybe I'm just totally confused -- as so often ;-) -- but things seem strange here: On 2022-01-12T10:43:05+0100, Marcel Vollweiler wrote: Currently omp_get_device_num does not work on gcn targets with more than one offload

[PATCH] libgomp, OpenMP: Fix issue for omp_get_device_num on gfx targets.

2022-01-12 Thread Marcel Vollweiler
Hi, Currently omp_get_device_num does not work on gcn targets with more than one offload device. The reason is that GOMP_DEVICE_NUM_VAR is static in icv-device.c and thus "__gomp_device_num" is not visible in the offload image. This patch removes "static" such that "__gomp_device_num" is now

[PING] [PATCH] C, C++, Fortran, OpenMP: Add 'has_device_addr' clause to 'target' construct

2022-01-10 Thread Marcel Vollweiler
Hi, I'd like to ping the patch for the OpenMP 'has_device_addr' clause on the target construct: https://gcc.gnu.org/pipermail/gcc-patches/2021-November/585361.html Thanks Marcel - Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München;

Re: [PATCH] C, C++, Fortran, OpenMP: Add 'has_device_addr' clause to 'target' construct

2021-11-24 Thread Marcel Vollweiler
Hi Jakub, this is again a new version of the 'has_device_addr' patch. It includes further minor changes in the C/C++ part and in addition the Fortran implementation. Tested on x86_64-linux with nvptx offloading with no regressions. Marcel - Siemens Electronic Design Automation

Re: [PATCH] C, C++, OpenMP: Add 'has_device_addr' clause to 'target' construct

2021-11-15 Thread Marcel Vollweiler
Hi Jakub, Am 20.10.2021 um 14:38 schrieb Jakub Jelinek: On Mon, Oct 18, 2021 at 06:17:20PM +0200, Marcel Vollweiler wrote: @@ -14255,6 +14257,16 @@ c_parser_omp_clause_use_device_addr (c_parser *parser, tree list) list); } +/* OpenMP 5.1

[PATCH] C, C++, OpenMP: Add 'has_device_addr' clause to 'target' construct

2021-10-18 Thread Marcel Vollweiler
Hi, This patch adds the 'has_device_addr' clause to the OpenMP 'target' construct which was introduced in OpenMP 5.1: "The has_device_addr clause was added to the target construct to allow access to variables or array sections that already have a device address" (OpenMP 5.1 Specification, p.

Re: [Patch] libgomp: Add tests for omp_atv_serialized and deprecate omp_atv_sequential.

2021-10-11 Thread Marcel Vollweiler
Hi Jakub, Am 11.10.2021 um 11:49 schrieb Jakub Jelinek: On Mon, Oct 11, 2021 at 11:40:54AM +0200, Marcel Vollweiler wrote: libgomp: Add tests for omp_atv_serialized and deprecate omp_atv_sequential. The variable omp_atv_sequential was replaced by omp_atv_serialized in OpenMP 5.1

[Patch] libgomp: Add tests for omp_atv_serialized and deprecate omp_atv_sequential.

2021-10-11 Thread Marcel Vollweiler
Hi, The variable omp_atv_sequential was replaced by omp_atv_serialized in OpenMP 5.1. This was already implemented by Jakub (C/C++, commit ea82325afec) and Tobias (Fortran, commit fff15bad1ab). This patch adds two tests to check if omp_atv_serialized is available (one test for C/C++ and one for

[Patch] C, C++, Fortran, OpenMP: Add support for 'flush seq_cst' construct

2021-09-06 Thread Marcel Vollweiler
Hi, this patch adds support for the 'seq_cst' memory order clause on the 'flush' directive which was introduced in OpenMP 5.1 (p.275ff of the OpenMP 5.1 Specification): "If neither memory-order-clause nor a list appears on the flush construct then the behavior is as if memory-order-clause is

Re: [Patch v2] C, C++, Fortran, OpenMP: Add support for device-modifiers for 'omp target device'

2021-09-02 Thread Marcel Vollweiler
Am 01.09.2021 um 11:02 schrieb Jakub Jelinek: On Wed, Sep 01, 2021 at 09:06:31AM +0200, Christophe Lyon wrote: * gfortran.dg/gomp/target-device-ancestor-4.f90: New test. The last new test fails on aarch64: /gcc/testsuite/gfortran.dg/gomp/target-device-ancestor-4.f90:7:15: Error:

Re: [Patch v2] C, C++, Fortran, OpenMP: Add support for device-modifiers for 'omp target device'

2021-08-25 Thread Marcel Vollweiler
:32PM +0200, Marcel Vollweiler wrote: --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -15864,37 +15864,81 @@ c_parser_omp_clause_map (c_parser *parser, tree list) } /* OpenMP 4.0: - device ( expression

Re: [Patch v2] C, C++, Fortran, OpenMP: Add support for device-modifiers for 'omp target device'

2021-08-20 Thread Marcel Vollweiler
Hi Jakub, this is the second version of the patch for the device-modifiers for 'omp target device'. Am 20.07.2021 um 15:30 schrieb Jakub Jelinek: On Wed, Jul 07, 2021 at 07:59:58PM +0200, Marcel Vollweiler wrote: OpenMP: Add support for device-modifiers for 'omp target device' gcc/c

[Patch] C, C++, Fortran, OpenMP: Add support for device-modifiers for 'omp target device'

2021-07-07 Thread Marcel Vollweiler
This patch adds device-modifiers to the device clause: #pragma omp target device ([ device-modifier :] integer-expression) where device-modifier is either 'ancestor' or 'device_num'. The 'device_num' case #pragma omp target device (device_num : integer-expression) is treated in the

Re: [PATCH] gcc/configure.ac: fix register issue for global_load assembler functions

2021-06-17 Thread Marcel Vollweiler
Am 16.06.2021 um 19:19 schrieb Joseph Myers: On Wed, 16 Jun 2021, Julian Brown wrote: +if test x$gcc_cv_as_gcn_global_load_fixed = xyes; then + AC_DEFINE(HAVE_GCN_ASM_GLOBAL_LOAD_FIXED, 1, [Define if your assembler has fixed global_load functions.]) +else +

Re: [PATCH] gcc/configure.ac: fix register issue for global_load assembler functions

2021-06-16 Thread Marcel Vollweiler
Changed the variable "gcc_cv_as_global_load_fixed" into "gcc_cv_as_gcn_global_load_fixed" in order to have the "gcn" substring also in the config.patch file. Am 09.06.2021 um 16:47 schrieb Marcel Vollweiler: This patch fixes an issue with global_load assembler f

[PATCH] gcc/configure.ac: fix register issue for global_load assembler functions

2021-06-09 Thread Marcel Vollweiler
This patch fixes an issue with global_load assembler functions leading to a "invalid operand for instruction" error since in different LLVM versions those functions use either one or two registers. In this patch a compatibility check is added to the configure.ac. Marcel - Mentor

Re: [PATCH] Fortran/OpenMP: Add support for 'close' in map clause

2021-05-20 Thread Marcel Vollweiler
Hi Jakub, Am 20.05.2021 um 10:57 schrieb Jakub Jelinek: On Thu, May 20, 2021 at 10:47:52AM +0200, Marcel Vollweiler wrote: --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -1710,10 +1710,21 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask, && g

[PATCH] Fortran/OpenMP: Add support for 'close' in map clause

2021-05-20 Thread Marcel Vollweiler
Hi, This patch adds handling for the map-type-modifier 'close' in the map clause in the Fortran parser (for C and C++ parsers the changes were already committed). 'close' was introduced with OpenMP 5.0: "The close map-type-modifier is a hint to the runtime to allocate memory close to the target

Re: [Committed] MAINTAINERS: Add myself for write after approval

2021-05-12 Thread Marcel Vollweiler
Am 12.05.2021 um 19:37 schrieb Marcel Vollweiler: - Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf - Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201

[Committed] MAINTAINERS: Add myself for write after approval

2021-05-12 Thread Marcel Vollweiler
- Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf commit 8982a5354d2697eeb12a77d49b6730db90053618 Author: Marcel Vollweiler Date: Wed May 12 10:14:41 2021 -0700

Re: [PATCH] OpenMP: Add support for 'close' in map clause

2021-05-12 Thread Marcel Vollweiler
Am 11.05.2021 um 17:20 schrieb Jakub Jelinek: On Tue, May 11, 2021 at 04:27:55PM +0200, Marcel Vollweiler wrote: The usual wording would be "too many % modifiers" Changed for 'always' and 'close' for C and C++. One extra thing, sorry, forgot to mention, for the translator

Re: [PATCH] OpenMP: Add support for 'close' in map clause

2021-05-11 Thread Marcel Vollweiler
Am 10.05.2021 um 20:34 schrieb Jakub Jelinek: On Mon, May 10, 2021 at 04:11:39PM +0200, Marcel Vollweiler wrote: @@ -15660,37 +15665,54 @@ c_parser_omp_clause_map (c_parser *parser, tree list) if (!parens.require_open (parser)) return list; - if (c_parser_next_token_is (parser

[PATCH] OpenMP: Add support for 'close' in map clause

2021-05-10 Thread Marcel Vollweiler
Hi, This patch adds handling for the map-type-modifier 'close' in the map clause that was introduced with OpenMP 5.0: "The close map-type-modifier is a hint to the runtime to allocate memory close to the target device." In OpenMP 5.0 'close' can be used beside/together with 'always' in a list