From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by sourceware.org (Postfix) with ESMTPS id 6822F3858C00 for ; Wed, 20 Jul 2022 21:24:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6822F3858C00 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dabbelt.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dabbelt.com Received: by mail-pj1-x1033.google.com with SMTP id l14-20020a17090a72ce00b001f20ed3c55dso3453620pjk.5 for ; Wed, 20 Jul 2022 14:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20210112.gappssmtp.com; s=20210112; h=date:subject:in-reply-to:from:to:message-id:mime-version :content-transfer-encoding; bh=Ybv9Hhb9rBjjVITmO2t6/MP7hNP5XSjha1ApJG3JQ/o=; b=e1e61zJhSmLZK0aOQJw0zH6RAcJ+1FuZCB+f6VcvH9bUihr3SycMzQg74MXNVr2WqK CHeI/s0aB7KHdg74DhLBa3Jn72p+CdYtdPhVSz+UPCdiz7VKLDJW169fH+38vESpejuq uS6RmNaTFwDcD71utmZdBVHLHYes4fBIsF3Tr9T8tSGU4HIQ+SQXD4PO8JYLVkDohvi1 xPJkdKRExoJYDyoDWdezIZvTbwwVn1g0pqEOYIW629fzqu+YOZ6gYyDa8xY9AfkKfpmC eIEF14Xlb+aLd5Kc01QIfSIWLIgoJ9gGQq0HmTJSbl3zyd2Dp1OIKhOqrsYkVdXxI7ci +FXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:subject:in-reply-to:from:to:message-id :mime-version:content-transfer-encoding; bh=Ybv9Hhb9rBjjVITmO2t6/MP7hNP5XSjha1ApJG3JQ/o=; b=1nPQ7sT9uGaLmQcWrXQZtAfVxFf/bG83Mjhtwt+/lrhpFAsl4Z97WoVuFrCxq/NMqs AOcevV/9Ud40WUPCSzH7VPukDmk8tJsKdqzjrx2diFG1IbJZ4mwWoUcHHsJN8soFomxw qjslUrQXfn9QWxZHodSTaOMDs6p4ut36u7YTDYcZ4aWdfcVjZaiXHHEqq9xwCRYmcYEh i/lb3K2y9jotY5Cf6zYqPeImfVbcd6leSJI16sq2LKLjFqYshGDxDgPteEObu2xlvCL3 jiEJAohNJIja+3LCsYEZZu2jCDIiPsCVM/0fz/C0ma1wgEU40RXJxiJj3CVPH3jUxDhi EcQA== X-Gm-Message-State: AJIora9ZUC7b+IwiEqsMJbkY2arwAu0UHAoc2hpB4AjuTrPjaHmsdEI1 NdL6+cYbxcAgaH++XGdRx0Ym0PjxTyeK8Q== X-Google-Smtp-Source: AGRyM1shWcjkQ1lb/faqGAHH7IrkOa4c7ktzNAXRmn8Zpz6Xs/oUckJ3aiLfP2nPL3TOUVUJOYdQaA== X-Received: by 2002:a17:902:f542:b0:16b:dbf1:2179 with SMTP id h2-20020a170902f54200b0016bdbf12179mr41346030plf.18.1658352271987; Wed, 20 Jul 2022 14:24:31 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id i1-20020a17090a138100b001ef899eb51fsm2143195pja.29.2022.07.20.14.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 14:24:31 -0700 (PDT) Date: Wed, 20 Jul 2022 14:24:31 -0700 (PDT) X-Google-Original-Date: Wed, 20 Jul 2022 14:22:46 PDT (-0700) Subject: Re: Supporting RISC-V Vendor Extensions in the GNU Toolchain In-Reply-To: From: Palmer Dabbelt To: binutils@sourceware.org, gcc-patches@gcc.gnu.org, libc-alpha@sourceware.org, gdb-patches@sourceware.org Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jul 2022 21:24:35 -0000 On Tue, 10 May 2022 17:01:26 PDT (-0700), Palmer Dabbelt wrote: > [Sorry for cross-posting to a bunch of lists, I figured it'd be best to > have all the discussions in one thread.] > > We currently only support what is defined by official RISC-V > specifications in the various GNU toolchain projects. There's certainly > some grey areas there, but in general that means not taking code that > relies on drafts or vendor defined extensions, even if that would result > in higher performance or more featured systems for users. > > The original goal of these policies were to steer RISC-V implementers > towards a common set of specifications, but over the last year or so > it's become abundantly clear that this is causing more harm that good. > All extant RISC-V systems rely on behaviors defined outside the official > specifications, and while that's technically always been the case we've > gotten to the point where trying to ignore that fact is impacting real > users on real systems. There's been consistent feedback from users that > we're not meeting their needs, which can clearly be seen in the many out > of tree patch sets in common use. > > There's been a handful of discussions about this, but we've yet to have > a proper discussion on the mailing lists. From the various discussions > I've had it seems that folks are broadly in favor of supporting vendor > extensions, but the devil's always in the details with this sort of > thing so I thought it'd be best to write something up so we can have a > concrete discussion. > > The idea is to start taking code that depends on vendor-defined behavior > into the core GNU toolchain ports, as long as it meets the following > criteria: > > * An ISA manual is available that can be redistributed/archived, defines > the behaviors in question as one or more vendor-specific extensions, > and is clearly versioned. The RISC-V foundation is setting various > guidelines around how vendor-defined extensions and instructions > should be named, we strongly suggest that vendors follow those > conventions whenever possible (this is all new, though, so exactly > what's necessary from vendor specifications will likely evolve as we > learn). > * There is a substantial user base that depends on the behavior in > question, which probably means there is hardware in the wild that > implements the extensions and users that require those extensions in > order for that hardware to be useful for common applications. This is > always going to be a grey area, but it's essentially the same spot > everyone else is in. > * There is a mechanism for testing the code in question without direct > access to hardware, which in practice means a QEMU port (or whatever > simulator is relevant in the space and that folks use for testing) or > some community commitment to long-term availability of the hardware > for testing (something like the GCC compile farm, for example). > * It is possible to produce binaries that are compatible with all > upstream vendors' implementations. That means we'll need mechanisms > to allow extensions from multiple vendors to be linked together and > then probed at runtime. That's not to say that all binaries will be > compatible, as users are always free to skip the compatibility code > and there will be conflicting definitions of instruction encodings, > but we can at least provide users with the option of compatibility. > > These are pretty loosely written on purpose, both because this is all > new and because each project has its own set of contribution > requirements so it's going to be all but impossible to have a single > concrete set of rules that applies everywhere -- that's nothing specific > to the vendor extensions (or even RISC-V), it's just life. Specifically > a major goal here is to balance the needs of users, both in the short > term (ie, getting new hardware to work) and the long term (ie, the long > term stability of their software). We're not talking about taking code > that can't be tested, hasn't been reviewed, isn't going to be supported > long-term, or doesn't have a stable ABI; just dropping the specific > requirement that a specification must be furnished by the RISC-V > foundation in order to accept code. > > Nothing is decided yet, so happy to hear any thought folks have. This > is certainly a very different development methodology than what we've > done in the past and isn't something that should be entreated into > lightly, so any comments are welcome. I'm going back to the start of the thread as this led to some heated discussion, both here and in private. Clearly there's lots of opinions here and everyone wants something different, but the nature of compromise is that nobody gets exactly what they want and it looks like this is as good as we're going to get any time soon. So I'm going to propose that we go with this. This was all purposefully a bit vague so we'll have to go sort out exactly how to move forward as patches go by. Hopefully we'll be able to have more constructive discussions on the specific patch sets, as at least the issues will be a bit more focused. The C906 is a widely available chip that needs vendor extensions to function in some very basic ways, it's been blocked on a policy change for way too long and at least this way we can get moving on that front. Happy to continue the discussion if anyone has concrete concerns here, either way let's give it at least a few days to get through everyone's inbox before doing anything that depends on the policy change.