From patchwork Wed Jan 3 14:47:54 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: 184774 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp5063258dyb; Wed, 3 Jan 2024 06:49:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IFDEiOmxvZdqRVeY6LHMofntiCfn2T5buQ+d5k/fMIBv6cBEwhaucPsd0r1gLLy5YMnp8aS X-Received: by 2002:a05:6808:2f09:b0:3bb:bf4c:9600 with SMTP id gu9-20020a0568082f0900b003bbbf4c9600mr17592701oib.109.1704293364154; Wed, 03 Jan 2024 06:49:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704293364; cv=pass; d=google.com; s=arc-20160816; b=twyriWWqiKSgFsdXN7P65o2LUs/4wBjaDuFGB6jL6BKctSETM0Wlx57tJn+arpz5Qk M5E2O5s/Gl2ruOQOfPk7VMUQcR1yrOOhLs9UqHK1UNb9yt8ZKXRHbcbe3iHiJ/EEJkLd x3vjjz7KVQUJ/B0/PRH+JVmNZzf5bQCE2enCf495X2oPpL7z09uftyQbyfgg+thn0lS2 R7wcTZcFqPcU+qjtwOndbbYIOIl+Iihb/D3DxtRr+WDNSCuY8JPl2GRoCW+UpynAhTr3 g1TT7HrIu1u1PWxr/HkZj3Wwrym9/k6dyt9+Ni0YESqMlVMPF5F36ykyg7kSBuRzk5te Zh7A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:in-reply-to:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :ironport-sdr:arc-filter:dmarc-filter:delivered-to; bh=riLrMphW4oper3V5LeYVR2DP76VWxy1dmKerBs888bk=; fh=dGINLZgjgEFQPPVq+qIYAIZHN8g3AfA13cFkVJ41Iic=; b=VSv18A+VnHElefbpcG9gdLWmsf/sDCb7AwpjYHhKWBLn5JOsmQ/G0vCBIDB/nKhDN4 g/dywIwiYBSj8tG1UljkyNZ/UoddNJN0i5ouuBpooq64pNBm7cJAQN3zVUdhY3HAQaM/ KN3b4jRF+k+4rUVJxgi/tVLdjG5mBcBNg2UaK0ffd19WXld4APR3/3WHC36ABqXCcUSI q+h9d64ViXose+Dtk5um9IsELeIYuVSkodk92RpcBJ7EAAnlL+GKnHf1bPpZIp2xNUuQ OdPfhl+BYu3EvIQvantfV8Fe3+tQX3rjTtgMyERwcq9NifMHw1ScmZvGFr8edL3hAZaR Qx8w== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id k8-20020a05620a07e800b007816e1a846csi13681516qkk.40.2024.01.03.06.49.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 06:49:24 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 942213858C2F for ; Wed, 3 Jan 2024 14:49:23 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id ED63B3858D38 for ; Wed, 3 Jan 2024 14:48:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ED63B3858D38 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org ED63B3858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.137.180 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704293317; cv=none; b=O+HwTWkFh7FFSnKJ+Igqy07inWDPIEXccenBgs4CBabuTO63hLpyC4rW2S7oHqxVCbmiZCNlfvRREXdqGeX74yk1Hw6SpICdNltBm3n3anJBJ216Vnf+vZ0BeDv6a9vrFWtnSCe0hOtSv+6wg/DdlyQdyI69yVi/4cOYLhr2WDE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704293317; c=relaxed/simple; bh=XhODI4j1LBxWR9CJRjSaAeMPyIwRFovwZTqLC2fvOoY=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=CRRJM6BpuWycwzaorz6P22cRHUDC71lZUaK1E758YiETpPmeSFCMewa3PoKpKicbbFhQi60BRUmuNqdqh4zL3P/dV87xU35feyhu1rXN7LHiBYBzN35ZWDdDN4UV5xZ4GyWnjtqljB45iqu7bt6nEJKkcgsfC/Kh+3m9LFh6yVI= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: ulwf+sbwSnW3wcsWAqdnag== X-CSE-MsgGUID: sYDZ3Yw3QU6Ji1ZChRSKog== X-IronPort-AV: E=Sophos;i="6.04,327,1695715200"; d="scan'208,223";a="26942444" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 03 Jan 2024 06:48:30 -0800 IronPort-SDR: 84SUQBbq8GIBaHEvYdXfhitn7WAdWUsPXIoAPUUJIHWqevTP9O4WG/Cd/+8J1F2yEBzQ0iMOoK uRDh6jzEx+/hY6B9cd4VGUZiIckoaI6s54jQEOs17JOAiDm93g/7Jh7X8anooFtnKbfTIiEFSA qrIT/SmpvQY0GtqKDYsDmyy1tSCVoaOkiDkQb9pCSnaABWlNs6kjuf4XbdZ/VqGPB232zE95Mh ItsoaOMypG3PiEgD3fM5+pNcAFSwzBg7hDbcUgwnyS4UChEC9rdsiUEKpW8HUQzF+aMSjTXeTh XsY= Message-ID: <79a12614-a2b8-4da6-8316-c172abda6dbf@codesourcery.com> Date: Wed, 3 Jan 2024 14:47:54 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [committed] Re: [PATCH] openmp: Add support for the 'indirect' clause in C/C++ Content-Language: en-GB To: Thomas Schwinge CC: Tobias Burnus , , "Jakub Jelinek" References: <37f412ee-58e7-4bde-a763-591268e8f8f4@codesourcery.com> <87wmurru61.fsf@euler.schwinge.homeip.net> From: Kwok Cheung Yeung In-Reply-To: <87wmurru61.fsf@euler.schwinge.homeip.net> X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779193180839435435 X-GMAIL-MSGID: 1787081118508724780 Hello I have committed the following trivial patch to emit FUNC_MAP or IND_FUNC_MAP in separate branches of an if statement. Kwok On 09/11/2023 12:24 pm, Thomas Schwinge wrote: > Similar to how you have it here: > >> --- a/gcc/config/nvptx/mkoffload.cc >> +++ b/gcc/config/nvptx/mkoffload.cc >> @@ -51,6 +51,7 @@ struct id_map >> }; >> >> static id_map *func_ids, **funcs_tail = &func_ids; >> +static id_map *ind_func_ids, **ind_funcs_tail = &ind_func_ids; >> static id_map *var_ids, **vars_tail = &var_ids; >> >> /* Files to unlink. */ >> @@ -302,6 +303,11 @@ process (FILE *in, FILE *out, uint32_t omp_requires) > | else if (startswith (input + i, "FUNC_MAP ")) > | { >> output_fn_ptr = true; >> record_id (input + i + 9, &funcs_tail); >> } >> + else if (startswith (input + i, "IND_FUNC_MAP ")) >> + { >> + output_fn_ptr = true; >> + record_id (input + i + 13, &ind_funcs_tail); >> + } >> else >> abort (); >> /* Skip to next line. */ > > ..., please also here: > >> --- a/gcc/config/nvptx/nvptx.cc >> +++ b/gcc/config/nvptx/nvptx.cc >> @@ -5919,7 +5919,11 @@ nvptx_record_offload_symbol (tree decl) >> /* OpenMP offloading does not set this attribute. */ >> tree dims = attr ? TREE_VALUE (attr) : NULL_TREE; >> >> - fprintf (asm_out_file, "//:FUNC_MAP \"%s\"", >> + fprintf (asm_out_file, "//:"); >> + if (lookup_attribute ("omp declare target indirect", >> + DECL_ATTRIBUTES (decl))) >> + fprintf (asm_out_file, "IND_"); >> + fprintf (asm_out_file, "FUNC_MAP \"%s\"", >> IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))); > > ... maintain separate 'if' branches for 'FUNC_MAP' vs. 'IND_FUNC_MAP', so > that we're able to easily locate those with 'grep', for example. > From 6ae84729940acff598e1a7f49d7b381025082ceb Mon Sep 17 00:00:00 2001 From: Kwok Cheung Yeung Date: Wed, 3 Jan 2024 14:27:39 +0000 Subject: [PATCH] nvptx: Restructure code generating function map labels This restructures the code generating FUNC_MAP and IND_FUNC_MAP labels in the assembly code for mkoffload to consume, hopefully making it a bit clearer and easier to search for. 2024-01-03 Kwok Cheung Yeung gcc/ * config/nvptx/nvptx.cc (nvptx_record_offload_symbol): Restucture printing of FUNC_MAP/IND_FUNC_MAP labels. --- gcc/config/nvptx/nvptx.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc index 724e403a0e9..9363d3ecc6a 100644 --- a/gcc/config/nvptx/nvptx.cc +++ b/gcc/config/nvptx/nvptx.cc @@ -5921,8 +5921,10 @@ nvptx_record_offload_symbol (tree decl) fprintf (asm_out_file, "//:"); if (lookup_attribute ("omp declare target indirect", DECL_ATTRIBUTES (decl))) - fprintf (asm_out_file, "IND_"); - fprintf (asm_out_file, "FUNC_MAP \"%s\"", + fprintf (asm_out_file, "IND_FUNC_MAP"); + else + fprintf (asm_out_file, "FUNC_MAP"); + fprintf (asm_out_file, " \"%s\"", IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))); for (; dims; dims = TREE_CHAIN (dims))