From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 623973858D33 for ; Thu, 9 Nov 2023 23:04:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 623973858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 623973858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699571083; cv=none; b=cdCXy4UGG90iyMFTw3+Mv1TbCioqE/2J0YDyCU+IWKlbZ79rX4hWWh7ACLlVBnlzUO5eMvVDCL5VWXcF0UNPUJi/07udW4PGMyHqEFogEjnx4wOdLl82g6T7gwP0dqYWWSedsfVsjrNxMDpwsbZJ5AsnF5dUeartMM26qUbe6s4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699571083; c=relaxed/simple; bh=mry9SRK6SiwjqjxNaHykE7mnotfK/hVWm06KSB4r+pg=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=AIyHJCmY/CG+SYM281RypBazx1y9ipbeKpXvFj4YNcbMu4J/hSVF5TC7tGURve/J35nXGDsydjo1gTVXNUqW8H0CrqIzzxm4LBXMIAT8jt64E4eHwNN4jZgt75VbrlcmL1ot0O+Vbc5CNoVQEE7I6NgcCiDxa+08oFPCj9iKOdI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699571081; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F6P9jVkIawXan8ODWL8gkVA3JZDCB9Eb7oBId9Ocrbg=; b=Oh52GcQC/cm8xKVABWVqQnzloYSIdkUufkaWBm0xN/v8PGW9gs+PgZnKFmwLALZNwgnAYz +VBApUnmcb3nTGoRR1lS8QXIVCzSDPsG+rvgeVsL+gpsgs5wBkGezoHtggmWgr+T4AxqCg SakB/RLl6wx9XLU4iLqTOzv31qA2oXg= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-74-gpVrv_hjOYCWlcHFfovGNA-1; Thu, 09 Nov 2023 18:04:40 -0500 X-MC-Unique: gpVrv_hjOYCWlcHFfovGNA-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-670237ba89aso23475356d6.0 for ; Thu, 09 Nov 2023 15:04:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699571080; x=1700175880; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Hxd4XGqyF2N8RO8JAmUivDYpXkVbGreCVMEijOef1iY=; b=ScTYU3hQx8AcwMis9lbCMTINZbr9SdYYcDbLxBGeI3u3SxiyKp/Up5DyIKuhmlClYd IhOZSpxd/69JvzdmPZaon30PoLHZgRTvUwFAkb7WC3C6lIh6yVLps8pzQS1Z2clo3a4C LQj8T3I79coGLGIdVbJSrfEiWGO52JD2YPjWxFPuVaDpVniVCrkAFFFQooDEiSoZ3b7y /0eyB8Kqr5LC8LjIi5wNcqdOmekOWOTNg6RGsDFOkbmw5EgLjkA+rHCrXFiY7cqTTy5i rH5/WnYPmhGQYCNcdaaECyHngJaQEGhmmvBXNeFppdJZGt5+qeyMJZEM7fe73mJ8WpwX 987g== X-Gm-Message-State: AOJu0YwxiuufgvzGQeDDUTEhIrOfwRQdu70gMj5F7p2FCItXWmPghD6F m4VV3qfGQVhVjHW8fBVhC+G8CRcbjRDvZ3LZzVWY7XkehYqiFzU51ZV72ApzvMpSUcQf/kB/Xz1 CiyHLtHk= X-Received: by 2002:a0c:f949:0:b0:677:8ac1:ee93 with SMTP id i9-20020a0cf949000000b006778ac1ee93mr1160021qvo.24.1699571079954; Thu, 09 Nov 2023 15:04:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IFz53vsoIExmgQt7dC4uJcFCASKyVcBFU/vWyOyFCWvNd6QcN4t5H8c0Dc+SrcFp3I0awuW8w== X-Received: by 2002:a0c:f949:0:b0:677:8ac1:ee93 with SMTP id i9-20020a0cf949000000b006778ac1ee93mr1159999qvo.24.1699571079712; Thu, 09 Nov 2023 15:04:39 -0800 (PST) Received: from t14s.localdomain (c-76-28-97-5.hsd1.ma.comcast.net. [76.28.97.5]) by smtp.gmail.com with ESMTPSA id c10-20020a05621401ea00b0066d04196c3dsm2463837qvu.49.2023.11.09.15.04.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 15:04:39 -0800 (PST) Message-ID: <755705e37731c4fbc3ab7eb1a96d8df0147bb002.camel@redhat.com> Subject: Re: [PATCH] libgccjit: Add ability to get CPU features From: David Malcolm To: Antoni Boucher , jit@gcc.gnu.org, gcc-patches@gcc.gnu.org Date: Thu, 09 Nov 2023 18:04:38 -0500 In-Reply-To: <8b0199d9835f568b7bcde41bf9432c21f604e489.camel@zoho.com> References: <8b0199d9835f568b7bcde41bf9432c21f604e489.camel@zoho.com> User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Thu, 2023-11-09 at 17:27 -0500, Antoni Boucher wrote: > Hi. > This patch adds support for getting the CPU features in libgccjit > (bug > 112466) >=20 > There's a TODO in the test: > I'm not sure how to test that gcc_jit_target_info_arch returns the > correct value since it is dependant on the CPU. > Any idea on how to improve this? >=20 > Also, I created a CStringHash to be able to have a > std::unordered_set. Is there any built-in way of doing > this? Thanks for the patch. Some high-level questions: Is this specifically about detecting capabilities of the host that libgccjit is currently running on? or how the target was configured when libgccjit was built? One of the benefits of libgccjit is that, in theory, we support all of the targets that GCC already supports. Does this patch change that, or is this more about giving client code the ability to determine capabilities of the specific host being compiled for? I'm nervous about having per-target jit code. Presumably there's a reason that we can't reuse existing target logic here - can you please describe what the problem is. I see that the ChangeLog has: > =09* config/i386/i386-jit.cc: New file. where i386-jit.cc has almost 200 lines of nontrivial code. Where did this come from? Did you base it on existing code in our source tree, making modifications to fit the new internal API, or did you write it from scratch? In either case, how onerous would this be for other targets? I'm not at expert at target hooks (or at the i386 backend), so if we do go with this approach I'd want someone else to review those parts of the patch. Have you verified that GCC builds with this patch with jit *not* enabled in the enabled languages? [...snip...] A nitpick: > +.. function:: const char * \ > + gcc_jit_target_info_arch (gcc_jit_target_info *info) > + > + Get the architecture of the currently running CPU. What does this string look like? How long does the pointer remain valid? Thanks again; hope the above makes sense Dave