From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sender4-pp-o92.zoho.com (sender4-pp-o92.zoho.com [136.143.188.92]) by sourceware.org (Postfix) with ESMTPS id E57D03858D1E; Mon, 18 Mar 2024 11:39:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E57D03858D1E Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=zoho.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=zoho.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E57D03858D1E Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=136.143.188.92 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1710761969; cv=pass; b=YyilmF+oA4HzEzFPFme5bkqJ/yhJC7/eohgFA9J3KmvQBmdpkv+7GVfG5tOC/s42U4ZnMFcSDw213PmLb97rnMWPbFrVLbgCbmZTVhYF1JJ+lmLcQNir/P66EBwcpBr+wNS18+XaG6QlpnfXgNzvrjLzPUDx3spqD5BEL1GX9GQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1710761969; c=relaxed/simple; bh=+3o6pF4RedWHlP9PACu7xf15U2O556YOf+7CXkC9hCg=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=DZPdYJpH3Olzuzn/A6UWXKPLEdsn8uAJNZ2EK76V5ibUU6yikuBWQnTfAaoFS01nV2/pDfy1dfhsDLGLNNWypaJH5psJUW1OVFyySxup2xfmteWZvJXzT/W/HAMK6eOlE5ZwZxcgaXYpb6rHVuU6w4VWG9t+Ai+OZHfAKfzVN1w= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; t=1710761954; cv=none; d=zohomail.com; s=zohoarc; b=LNuWdRzz9LllxoFmzRDC91sMaHMzLnf519/buspB+8xl0MPSqYIiWXNowCztqERS5w2aon7Mj4/ZPOOG+KUoE6+ZjVCzjFUD1tGb2yFH3aajJSMlfHKv4Vw5UoReLKGPd8vats6q5k2YCGnXV0cu3TyWhrCebbA2YCNDFfJip+I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710761954; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=18q93dERwkN0ut2lqQ5Op0CxHl3mMOsXagvMG2D/0Yc=; b=F3hVksMPLDM6cOesygjLPKThEwean/SaDiOPnzKrmmuFD5FT2qZTTkrlMXuSBillJTx2qqshG9W6dyPCuSqOHmbdsEpw1SOQk2gEspd6bZdh5n1cRMc7cZ6pE8wkRK0CjcSRzzZ+nllmNBlI6g5OkOQFI4nk+IuIxdqotJY1v8c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=zoho.com; spf=pass smtp.mailfrom=bouanto@zoho.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1710761954; s=zm2022; d=zoho.com; i=bouanto@zoho.com; h=Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:Cc:Cc:References:From:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID:Message-Id:Reply-To; bh=18q93dERwkN0ut2lqQ5Op0CxHl3mMOsXagvMG2D/0Yc=; b=DU1y74V72h8hoR2jCFnKU/muRJ7FdsOndlDdK9XARRekNF7+zrqsk9uQWRHWhCPO vylocEQQUrfTwdxeZYmDikd2mAYAFZr2J/+vIhQU8V82oTdTBrCawhXyaOsJvx4YciA c4g+SuS6Wvp8e9iFigpt+HcgjR4+pJq6lsR/rw+M= Received: from [192.168.1.172] (38.87.11.6 [38.87.11.6]) by mx.zohomail.com with SMTPS id 1710761952118799.5278396578525; Mon, 18 Mar 2024 04:39:12 -0700 (PDT) Message-ID: <572f26cd-b915-457f-b1c3-d22e72131e58@zoho.com> Date: Mon, 18 Mar 2024 07:39:10 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Frontend access to target features (was Re: [PATCH] libgccjit: Add ability to get CPU features) To: Iain Buclaw , David Malcolm , gcc-patches@gcc.gnu.org, jit@gcc.gnu.org Cc: Arthur Cohen References: <8b0199d9835f568b7bcde41bf9432c21f604e489.camel@zoho.com> <755705e37731c4fbc3ab7eb1a96d8df0147bb002.camel@redhat.com> <6050c91ae34a2cdaeebd79ada9e2b9ffaf881e21.camel@zoho.com> <997ddb068ca13f755accd03f38141e56c87b84a7.camel@redhat.com> <1710063672.3qlr6ik163.astroid@pulse.none> Content-Language: en-US, fr From: Antoni Boucher In-Reply-To: <1710063672.3qlr6ik163.astroid@pulse.none> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Feedback-ID: rr080112284de36696f3edae82c41d2f2d0000093734f25dce475aed89276041026e939008d6eadca4439a711c:zu08011226fc1bd11295714dd1f9923c0a0000c8ffd808d874679533db6d9426ef3d423c086f08bab5782c:rf0801122caf109f26615d1947b81426040000ae77a9d88a4b022c3778fa3400c26d7b76b53bd4b3cb3d7eb25cb92605a2:ZohoMail X-ZohoMailClient: External X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,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: David: Ping. Le 2024-03-10 à 07 h 05, Iain Buclaw a écrit : > Excerpts from David Malcolm's message of März 5, 2024 4:09 pm: >> On Thu, 2023-11-09 at 19:33 -0500, Antoni Boucher wrote: >>> Hi. >>> See answers below. >>> >>> On Thu, 2023-11-09 at 18:04 -0500, David Malcolm wrote: >>>> 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) >>>>> >>>>> 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? >>>>> >>>>> 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? >>> >>> I'm less sure about this part. I'll need to do more tests. >>> >>>> >>>> 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? >>> >>> This should not change that. If it does, this is a bug. >>> >>>> >>>> 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: >>>> >>>>>         * 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? >>> >>> This was mostly copied from the same code done for the Rust and D >>> frontends. >>> See this commit and the following: >>> https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=b1c06fd9723453dd2b2ec306684cb806dc2b4fbb >>> The equivalent to i386-jit.cc is there: >>> https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=22e3557e2d52f129f2bbfdc98688b945dba28dc9 >> >> [CCing Iain and Arthur re those patches; for reference, the patch being >> discussed is attached to : >> https://gcc.gnu.org/pipermail/jit/2024q1/001792.html ] >> >> One of my concerns about this patch is that we seem to be gaining code >> that's per-(frontend x config) which seems to be copied and pasted with >> a search and replace, which could lead to an M*N explosion. >> > > That's certainly the case with the configure/make rules. Itself I think > is copied originally from the {cpu_type}-protos.h machinery. > > It might be worth pointing out that the c-family of front-ends don't > have separate headers because their per-target macros are defined in > {cpu_type}.h directly - for better or worse. > >> Is there any real difference between the per-config code for the >> different frontends, or should there be a general "enumerate all >> features of the target" hook that's independent of the frontend? (but >> perhaps calls into it). >> > > As far as I understand, the configure parts should all be identical > between tm_p, tm_d, tm_rust, ..., so would benefit from being templated > to aid any other front-ends adding in their own per target hooks. > >> Am I right in thinking that (rustc with default LLVM backend) has some >> set of feature strings that both (rustc with rustc_codegen_gcc) and >> gccrs are trying to emulate? If so, is it presumably a goal that >> libgccjit gives identical results to gccrs? If so, would it be crazy >> for libgccjit to consume e.g. config/i386/i386-rust.cc ? > > I don't know whether libgccjit can just pull in directly the > implementation of the rust target hooks here. The per-frontend target > hooks usually also make use of code specific to that front-end - > TARGET_CPU_CPP_BUILTINS and others can't be used by a non-c-family > front-end without adding a plethora of stubs, for example. > > Whether or not libgccjit wants to give identical information as as rust > I think is a decision for you as the maintainer of its API. > > Iain.