From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id 47B383858D37 for ; Wed, 24 Jan 2024 07:06:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 47B383858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 47B383858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::631 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706079997; cv=none; b=ZmBu9oCNDWsMvDQhahbFHJVF5GVHXZz/G7zRhHzjpb07K+mq1BsKdCep710nq897UviGQRj5CV3vdPJFHF30MYuWauSJ6gmH/YLn+8LRstGuB2RamMYKmktBeksfd0+zGpcynRSqznVdk2OgNOUIwJGIxRVytGoatzgq3RB3hag= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706079997; c=relaxed/simple; bh=/Czjisl3CfBXK1II60e6iuKe9Yu0Hi6+cjGDoHeLMlQ=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=uBu1MO7untkFlZlV/znPIXG+2293w9G9mkLXPcwyG4PMFKBZUJXQZqT1He7ulKa8eRYdMU9W8jveH9/u7XGsE/HQDp+zWgp5x6QWlPe49n3andmKwVMmAY0vBJxUxqHykwo4fCZDrXONOe8Zr27BUB1HIFHx+U7pHF+Bz24Pp4Y= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a298accc440so560875866b.1 for ; Tue, 23 Jan 2024 23:06:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706079993; x=1706684793; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=h4mZr/O5/97j+Q8V0g6r5OnqYtZqu+LNV9khXmfJs6w=; b=F0tSy5kKn1ANst7BQtn0/B/xQc0xG33CXp8vV/vAo8DUwCjgE8VDTb+fDk0vIbcrt1 5u2xkBC0qLgZNYNXDOExQiHnRHW31eeuk/O02tglKKR8xHzgW3Ff4onuOgUBPqDK2thq d8+drpBqeNWFX3pt/wJ/Oli9zXGsIofHV/0yTSNa6J8PucyrNMS/zrcyarCuVawt3iW9 4G6L1LPd5U1UGwwD7hVkAKD9hveB+YGtRws5AdNjhZLo5G0OpILaPTLocD1TLhfyLwTJ vrT8WGivWk5wDtw7OODZwIF5I7ML5vJ5R7rAmcR1p2l/rD0uMrvFvr0tC5BlO2P30ePc TnLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706079993; x=1706684793; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h4mZr/O5/97j+Q8V0g6r5OnqYtZqu+LNV9khXmfJs6w=; b=NANI2ThUWljJg934wQxhMvZU52bEzV9hNvdxupKXRwI8u6o6a6HmcfozicbmCY5Mqk C/pMf3fuIMI+IaGjZCI3YLFVxhb5KAOVFWif2PGeZ0wZii2DVWTMuL1dcuuC2Aq8GBzu aJgdcaE5aU7lMHlija/N6mCQoVPD1AR4+ZDlbUhHXmmpvcK003LR67u6ShSiNmATZzvI Qg00gzdueZiwiIYvt8RuctwVnyIJCYNWndOwCXw2zFGX547KNDaULukiUT8/1tYnkMS8 uIrJtfIdfX3f527qjUE9IbObx57I0Gl1oN+bk7oqQb2uYtHY1idMwc6DtAuRRa1gyp6H 1dDw== X-Gm-Message-State: AOJu0YxSwRqGuAZfZRnedParNbUtfuB/GIODzSdL5KpHj5WxkmiZjMhy hVFd/3g6B5VORT7OO7vzHJcBGiaXgCtMkme5w4FE3Hm3pSYSpI9o1gB0NV9G X-Google-Smtp-Source: AGHT+IHvFSj6KePdBjeK0rsHlF/ULSsme3CjoMI4fhz3pGTOyRVXzc4MgNIU55cfxnwKPBEHSeLt4g== X-Received: by 2002:a17:906:9c85:b0:a31:1add:cc35 with SMTP id fj5-20020a1709069c8500b00a311addcc35mr417218ejc.135.1706079993286; Tue, 23 Jan 2024 23:06:33 -0800 (PST) Received: from ?IPv6:::1? ([2001:4bb8:10e:9093:d1c1:a374:5c1:8fa2]) by smtp.gmail.com with ESMTPSA id cw16-20020a170907161000b00a311a356760sm348044ejd.68.2024.01.23.23.06.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Jan 2024 23:06:32 -0800 (PST) Date: Wed, 24 Jan 2024 08:06:27 +0100 From: rep.dot.nop@gmail.com To: gcc-patches@gcc.gnu.org, Kwok Cheung Yeung , gcc-patches , Jakub Jelinek , Tobias Burnus CC: tschwinge@baylibre.com Subject: =?US-ASCII?Q?Re=3A_=5BPATCH=5D_openmp=3A_Change_?= =?US-ASCII?Q?to_using_a_hashtab_to_looku?= =?US-ASCII?Q?p_offload_target_addresses_for_indirect_function_calls?= In-Reply-To: <94202e90-0519-4124-9438-3ea40f6145aa@codesourcery.com> References: <37f412ee-58e7-4bde-a763-591268e8f8f4@codesourcery.com> <94202e90-0519-4124-9438-3ea40f6145aa@codesourcery.com> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 List-Id: On 22 January 2024 21:33:17 CET, Kwok Cheung Yeung = wrote: >Hi > >There was a bug in the declare-target-indirect-2=2Ec libgomp testcase (te= sting indirect calls in offloaded target regions, spread over multiple team= s/threads) that due to an errant fallthrough in a switch statement resulted= in only one indirect function ever getting called: > >switch (i % 3) > { > case 0: fn_ptr[i] =3D &foo; // Missing break > case 1: fn_ptr[i] =3D &bar; // Missing break > case 2: fn_ptr[i] =3D &baz; > } > >However, when the missing break statements are added, the testcase fails = with an invalid memory access=2E Upon investigation, this is due to the use= of a splay-tree as the lookup structure for indirect addresses, as the spl= ay-tree moves frequently accessed elements closer to the root node and so n= eeds locking when used from multiple threads=2E However, this would end up = partially serialising all the threads and kill performance=2E I have switch= ed the lookup structure from a splay tree to a hashtab instead to avoid loc= king during lookup=2E > >I have also tidied up the initialisation of the lookup table by calling i= t only from the first thread of the first team, instead of redundantly call= ing it from every thread and only having the first one reached do the initi= alisation=2E This removes the need for locking during initialisation=2E > >Tested with offloading to NVPTX and GCN with a x86_64 host=2E Okay for ma= ster? Can you please akso update the comments to talk about hashtab instead of s= play? TIA > >Thanks > >Kwok