From patchwork Fri Oct 4 14:53:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kwok Cheung Yeung X-Patchwork-Id: 1992777 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=Cxp13HNf; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XKs565gBpz1xsn for ; Sat, 5 Oct 2024 00:54:17 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 14B633844054 for ; Fri, 4 Oct 2024 14:54:15 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id 503FB385E011 for ; Fri, 4 Oct 2024 14:53:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 503FB385E011 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=baylibre.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 503FB385E011 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::632 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728053634; cv=none; b=heiBiKpnpWLlkV5SLKa5HtmteKe1xbVqkuTn/SxkfhkU30asdMbEmMJENACyDKGCaQH+yUIlRnYGV18ZKQD4Uui9Y9mcFR5KtqRqBkUDCsnw/Nj0sUQ3IFwWUSsSL+ysbxATUeYYc2xdbTFM0t6pM5fHBdvgjKL8kJ/6muuLv/Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728053634; c=relaxed/simple; bh=GSlqnXeTkFp5CdfBSg5nEeH7qOUOQU0cepAuAUfQmNk=; h=DKIM-Signature:Message-ID:Date:MIME-Version:From:Subject:To; b=AFiuP6siDO+6uPTog/cn2KBX7jA2MRJzRjPqEf6L8qvc7K0jGzTAaD/RsXsDchWnvYYMH7DrVOSO9i9SBV/XzM+fyz0oTh9lwBYft+ZGpphrZBC7PYNSUhlRokyYxc80U56z40unjTKK13ZJriABCnswOSR3BtIQZ+MagmWlJDU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a93c1cc74fdso369444566b.3 for ; Fri, 04 Oct 2024 07:53:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1728053631; x=1728658431; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:content-language:references :to:subject:from:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=Q/A0yHjK27B1kSWZOwkhq4TAzyMZ80Cgcp7p8wLRlug=; b=Cxp13HNfIoPj/sgp1beM26rkBx/7JJR1w+dbKtOX102U9+5CgW85zbKr7S7jQbSTS/ /IUYOxr2N3UNhMDuzaNg9Z+Hfg7AaG1DPaub6Yl3Sl8w/lkH70Tewjd7MJotwpJS0e8t Zho+anM3X9FRkKCO6ZEEcpQQ6SZAaRrxVAqwtjUMuQmeCm0gwOqFU55CwAhbKGkdFpOF WI+cR2AK1W1/YHhqaEuUf0acvDjSthqD8n2FBEIZKsE610l1teLNjnGKUfGgUYWSJR6G oukRxVb8ffpf0FexUc+wtB52w9lOe0i85KNdN0U6F+GwVlqMh81RZQ7z0m1xa/aXg7xx a+Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728053631; x=1728658431; h=content-transfer-encoding:in-reply-to:content-language:references :to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Q/A0yHjK27B1kSWZOwkhq4TAzyMZ80Cgcp7p8wLRlug=; b=Q0vN32GYgl6T/f3rUeTGeQFhMam7ps5LWjagWexR5xEdro8HXLICD7LjNsLeSBHz0w ph3uoUqR1Dxlbb9DKOP2tO/001bbI9IQRyMXUa3QK3cdfhkRJtT5qo1PtIQpw+hgk96u kG2JkwlrZk88hCnpP54pE5GVC6mW6VteJfUipj48N13E49cuDxrtRbyTv8lF2n2acLzU kQ4Kxa/CLgbuF8gjvRbcuI7KIWbC1U+PUg07ExJfudBZwQO62hXKoxgBaDG5q9pUnGpo qDLcsCoNOD7WBwIOOOSUaAii554aEyM+izTH7TN7BFQw/uUc2NpJDAF7F8rNcR32Rlhu /4yw== X-Gm-Message-State: AOJu0YwNCf69z9z77NrZ4CGmP84h8T6DCcpaVekt26NeWmI010n5u0oV ffo37kvaCqSM434K5VRUC8TB3fXCQrfObT+Tkymf/4vid9rzBP13Z/++y14OW56DepKNba7jD2U b X-Google-Smtp-Source: AGHT+IH56YJj+6EcnaCrmiFfAb8w8kreDMBqlaUNSSva4vqq0K/L0SXb9TmDSlIjOO6FJOnx5k+SAw== X-Received: by 2002:a17:907:e62a:b0:a8d:2c3e:7ece with SMTP id a640c23a62f3a-a991bd45a24mr260725266b.31.1728053630531; Fri, 04 Oct 2024 07:53:50 -0700 (PDT) Received: from ?IPV6:2a00:23c6:88fe:9301:2d7d:f734:bc6:c47b? ([2a00:23c6:88fe:9301:2d7d:f734:bc6:c47b]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a992e664fb9sm1375166b.88.2024.10.04.07.53.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Oct 2024 07:53:50 -0700 (PDT) Message-ID: <6b94b8ed-020b-47e2-b02a-4891891f2847@baylibre.com> Date: Fri, 4 Oct 2024 15:53:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Kwok Cheung Yeung Subject: [PATCH v3 0/5] openmp: Add support for iterators in OpenMP mapping clauses To: gcc-patches , Jakub Jelinek , Tobias Burnus References: <77f9ccb8-6f5e-4462-aa32-71f74fd7ff26@baylibre.com> Content-Language: en-GB In-Reply-To: <77f9ccb8-6f5e-4462-aa32-71f74fd7ff26@baylibre.com> X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org This is a further improved patch series to that posted at: https://gcc.gnu.org/pipermail/gcc-patches/2024-September/662138.html The main change is that the expansion of the iterators is pushed back further to the omp-lowering stage. This is because the recently committed deep-mapping support (and features such as strided array updates in the OpenMP development branch) do their work in the omplower stage, but the iterators need to be expanded after any changes to the clauses and their decls/sizes have occurred. This patch set does not support deep-mapping yet - it just emits a sorry when this happens. The iterator expansion now does not happen all at once. A new loop is generated the first time a clause with a new iterator is found, and is reused if the same iterator is used in another clause. Assigning the clause decl and size in the iterator loop are now done by calling separate functions from lower_target, which also return the new hostaddr/size expression from the iterator loop that should be passed to libgomp. This fits in better with the existing code structure. A final function is called to finalise all the loops. As multiple sets of loops can be 'in-flight' at once, a new structure and a hash map are used to keep track of their states. Instead of making the OMP_CLAUSE_DECL into a tree list with the iterator in TREE_PURPOSE and original decl in TREE_VALUE, I have stored the iterator in a third argument in the clause tree node addressed by OMP_CLAUSE_ITERATOR instead. In this way, changes do not have to be made in the intervening code-path to extract the original OMP_CLAUSE_DECL (which is messy and error-prone), allowing code unrelated to iterators to go unmodified. Nearly all special-cases for iterators have now been removed. I have also fixed some issues detected by Linaro CI - some format specifier issues, and some tests that expect a non-unified target address space failing. Gomp GCC tests and libgomp tests run on x86_64 host with Nvidia offloading. Okay for trunk? Kwok