From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id B574D3858D35 for ; Fri, 5 May 2023 19:18:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B574D3858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-63b60366047so1587836b3a.1 for ; Fri, 05 May 2023 12:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1683314293; x=1685906293; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=Z3y5IYoHkMBoH4NsbNS+ZYquoHnM5CoX2yZC3Ikjh8M=; b=x0Jhke2sKhbSWbiedjdzqxqWWJs4QAFBygFPz3qbIE/tP4LtX1DnKen5n+VTWDKKvO qU5BGMUpgAeHdYllEVRWxrKnQ8s91z8jj9ZT8QKjGdJ8eEjYCsg71LKnJQD/mwBYDxwv n8/cKRTilZmSD2RaCBaBVwFqdpmlAJoNFA9+T7AtAXc6Oet3/npUSM1qfe6EeSABh3SC D8D9jhlD0HzKXvlKYJ20wWTxlNi+9vnCzkqpjcDUoOna3HJoRRHawOy6OvHnfvSnar0g gaUjx78vqSAPNWSf+ZWuYos5REqgx6wdIq05p+1Hu/lUYEEZqfvToyhr3uK4rsZKbDOF /HEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683314293; x=1685906293; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Z3y5IYoHkMBoH4NsbNS+ZYquoHnM5CoX2yZC3Ikjh8M=; b=jysPBIr0jo3VpR6U8T9t9W14C6F4WKIkV0MQglhaIJZ/4mjYnEDm3CNLLPsYySaG5i YPXNaRsl1DZBVlNT+y6cR6BbWepDvGVW2DJKO7tMFQ3/syKZPrzr72KMy+8bbZ2P8XGE wfLa8aQRwoc8Np8DkvqG0s3XUiGFB3DUpNCAhq0lGqKx9O917+UGRMa1sI1ADmEj+fXt TlGbaXjuxPKN7WHw4hNBOHlsRqrmhwpJENyJL+NSA3KEanc/LOO1BCSxnuQev/3mDDX3 Cofn4E4cRirsPWMsSAd4dHofgP6T8TeMaqf2h94zYhsqM064vSa1/m+YR3mj818DOaVu xuBw== X-Gm-Message-State: AC+VfDxZpHRJthAiZ5Lt4NAJvR4lGB2Pul1cUUvNzygji4EWUZgp3sP3 vcTn/cIzq6nXmhp4Bj7sbZz0nw== X-Google-Smtp-Source: ACHHUZ7yVwV9ZUkmfHChxDjEm5hxi0pySIj5BtDOVKsSYvIw7vYfs+wbJpYtVajRN9onCLL9fN8nvw== X-Received: by 2002:a05:6a00:1944:b0:62d:cfd4:e440 with SMTP id s4-20020a056a00194400b0062dcfd4e440mr3417839pfk.8.1683314293292; Fri, 05 May 2023 12:18:13 -0700 (PDT) Received: from localhost ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id q21-20020a62e115000000b0063d47bfcdd5sm1956604pfh.111.2023.05.05.12.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 May 2023 12:18:12 -0700 (PDT) Date: Fri, 05 May 2023 12:18:12 -0700 (PDT) X-Google-Original-Date: Fri, 05 May 2023 12:17:54 PDT (-0700) Subject: Re: [RFC] RISC-V: Add proposed Ztso atomic mappings In-Reply-To: CC: Patrick O'Neill , gcc-patches@gcc.gnu.org, jeffreyalaw@gmail.com, Vineet Gupta , Andrew Waterman , kito.cheng@sifive.com, Daniel Lustig , cmuellner@gcc.gnu.org, hboehm@google.com, gnu-toolchain@rivosinc.com From: Palmer Dabbelt To: Andrea Parri 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.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,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 Fri, 05 May 2023 11:55:31 PDT (-0700), Andrea Parri wrote: > On Fri, May 05, 2023 at 10:12:56AM -0700, Patrick O'Neill wrote: >> The RISC-V Ztso extension currently has no effect on generated code. >> With the additional ordering constraints guarenteed by Ztso, we can emit >> more optimized atomic mappings than the RVWMO mappings. >> >> This patch implements Andrea Parri's proposed Ztso mappings ("Proposed >> Mapping"). >> https://github.com/preames/public-notes/blob/master/riscv-tso-mappings.rst >> >> LLVM has implemented this same mapping (Ztso is still behind a >> experimental flag in LLVM, so there is *not* a defined ABI for this yet). >> https://reviews.llvm.org/D143076 > > Given the recent patches/discussions, it seems worth pointing out the > the Ztso mappings referred to above was designed to be compatible with > the mappings in Table A.6 and that they are _not_ compatible with the > mappings in Table A.7 or with a "subset" of A.7 (even assuming RVTSO). I guess that brings up the question of what we should do about WMO/TSO compatibility. IIUC the general plan has been that WMO binaries would be compatible with TSO binaries when run on TSO systems, and that TSO binaries would require TSO systems. I suppose it would be possible to have TSO produce binaries that would run on WMO systems by just emitting a bunch of extra fences, but I don't think anyone wants that? We've always just assumed that WMO binaries would be compatible with TSO binaries, but I don't think it's ever really been concretely discussed. Having an ABI break here wouldn't be the craziest idea as it'd let us fix some other issues, but that'd certainly need to be pretty widely discussed. Do we have an idea of what A.7-compatible TSO mappings would look like?