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 [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id C8C7239A8825 for ; Fri, 16 Jul 2021 19:58:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C8C7239A8825 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-551-ZqUgZDWuMSK4VU4UlU2ISw-1; Fri, 16 Jul 2021 15:58:48 -0400 X-MC-Unique: ZqUgZDWuMSK4VU4UlU2ISw-1 Received: by mail-wm1-f70.google.com with SMTP id l18-20020a05600c1d12b02902278758ab90so2599065wms.9 for ; Fri, 16 Jul 2021 12:58:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=m5ZOrgAbAd8yr6kRQXk3/ovEhSVYqZpEqUlG3RZuLa8=; b=GJiBz7/sn/LeWJn4Vb6BNeYBGmrN9FWBY03W8aJZJrrnvI9TOyLHfU15Ky0g8ppSgw Jpm9fbY5tPliI8o8zMSHzf2ave2ZdFw83J43Ha8wspaP3bpsG5B65a8ns3BiExRprlwQ 7TMuq01ztbRZJNWLPC9PwUC7GK0xEA2V3yBYwW67//e8cJhI+TwAvotVOpXIg8QyAiEz h4nQppsnjQzMNxsGVriYMx7XJEWrl84Yzy0wtMxuQy7H794+H2hMRsf4hPVIshXGpLYf rmD0LfZsPCpjJN/9EuNk7vzG/qR/5U9d+ZltM30aCzOJjBmsbdWCXjq83DRwKA29vhGY zm5Q== X-Gm-Message-State: AOAM530rskUvNC2l3wxbLlbm4BGjkGTLV6SzI0effVYm8AiK6SPnRxzc uGSYFuN+rJ+M8k2WW85lPV1/krS8OkRCKn8iUxFdziM1zUVm3BXRBN8JJ5rqRGQ9UgnifndPX7S NISY3G0+BA+gT+mVs5zf8BtIFIDNK+ia6srf6 X-Received: by 2002:a7b:c10b:: with SMTP id w11mr13005851wmi.185.1626465527332; Fri, 16 Jul 2021 12:58:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0MBwI/IFmjcg19peUfz5Ei2CcxUSOWlfqKJgmFlQx1rGUz61fY0+0hvE3YBAOA5/6pOa2jVih02h6r04U3j0= X-Received: by 2002:a7b:c10b:: with SMTP id w11mr13005842wmi.185.1626465527192; Fri, 16 Jul 2021 12:58:47 -0700 (PDT) MIME-Version: 1.0 References: <20210716023656.670004-1-jason@redhat.com> <2948804.xd1mhZDcFd@excalibur> In-Reply-To: <2948804.xd1mhZDcFd@excalibur> From: Jonathan Wakely Date: Fri, 16 Jul 2021 20:58:36 +0100 Message-ID: Subject: Re: [PATCH] c++: implement C++17 hardware interference size To: Matthias Kretz Cc: Jason Merrill , "Richard Earnshaw (lists)" , "libstdc++" , gcc-patches List , GNU C Library X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2021 19:58:53 -0000 On Fri, 16 Jul 2021 at 20:26, Matthias Kretz wrote: > > On Friday, 16 July 2021 18:54:30 CEST Jonathan Wakely wrote: > > On Fri, 16 Jul 2021 at 16:33, Jason Merrill wrote: > > > Adjusting them based on tuning would certainly simplify a significant use > > > case, perhaps the only reasonable use. Cases more concerned with ABI > > > stability probably shouldn't use them at all. And that would mean not > > > needing to worry about the impossible task of finding the right values for > > > an entire architecture. > > > > But it would be quite a significant change in behaviour if -mtune > > started affecting ABI, wouldn't it? > > For existing code -mtune still doesn't affect ABI. True, because existing code isn't using the constants. >The users who write > > struct keep_apart { > alignas(std::hardware_destructive_interference_size) std::atomic cat; > alignas(std::hardware_destructive_interference_size) std::atomic dog; > }; > > *want* to have different sizeof(keep_apart) depending on the CPU the code is > compiled for. I.e. they *ask* for getting their ABI broken. Right, but the person who wants that and the person who chooses the -mtune option might be different people. A distro might add -mtune=core2 to all package builds by default, not expecting it to cause ABI changes. Some header in a package in the distro might start using the constants. Now everybody who includes that header needs to use the same -mtune option as the distro default. That change in the behaviour and expected use of an existing option seems scary to me. Even with a warning about using the constants (because somebody's just going to use #pragma around their use of the constants to disable the warning, and now the ABI impact of -mtune is much less obvious). It's much less scary in a world where the code is written and used by the same group of people, but for something like a linux distro it worries me.