unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Matthias Kretz <m.kretz@gsi.de>
To: Jason Merrill <jason@redhat.com>, Jonathan Wakely <jwakely@redhat.com>
Cc: "Richard Earnshaw \(lists\)" <Richard.Earnshaw@arm.com>,
	libstdc++ <libstdc++@gcc.gnu.org>,
	gcc-patches List <gcc-patches@gcc.gnu.org>,
	GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] c++: implement C++17 hardware interference size
Date: Fri, 16 Jul 2021 21:26:11 +0200	[thread overview]
Message-ID: <2948804.xd1mhZDcFd@excalibur> (raw)
In-Reply-To: <CACb0b4kp-X+t7+Yuf9VwaX6cBL-jaRoVBE-EsZCyv+S0LQAKCw@mail.gmail.com>

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. The users who write 

struct keep_apart {
  alignas(std::hardware_destructive_interference_size) std::atomic<int> cat;
  alignas(std::hardware_destructive_interference_size) std::atomic<int> 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. If they wanted to 
specify the value themselves on the command line they'd written:

struct keep_apart {
  alignas(SOME_MACRO) std::atomic<int> cat;
  alignas(SOME_MACRO) std::atomic<int> dog;
};

I would be very disappointed if std::hardware_destructive_interference_size 
and std::hardware_constructive_interference_size turn into a glorified macro.

-- 
──────────────────────────────────────────────────────────────────────────
 Dr. Matthias Kretz                           https://mattkretz.github.io
 GSI Helmholtz Centre for Heavy Ion Research               https://gsi.de
 std::experimental::simd              https://github.com/VcDevel/std-simd
──────────────────────────────────────────────────────────────────────────

  parent reply	other threads:[~2021-07-16 19:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210716023656.670004-1-jason@redhat.com>
2021-07-16  2:41 ` [PATCH] c++: implement C++17 hardware interference size Jason Merrill via Libc-alpha
2021-07-16  2:48   ` Noah Goldstein via Libc-alpha
2021-07-16 11:17     ` Jonathan Wakely via Libc-alpha
2021-07-16 13:27       ` Richard Earnshaw via Libc-alpha
2021-07-16 13:26   ` Jonathan Wakely via Libc-alpha
2021-07-16 15:12   ` Matthias Kretz
2021-07-16 15:30     ` Jason Merrill via Libc-alpha
2021-07-16 16:54       ` Jonathan Wakely via Libc-alpha
2021-07-16 18:43         ` Jason Merrill via Libc-alpha
2021-07-16 19:26         ` Matthias Kretz [this message]
2021-07-16 19:58           ` Jonathan Wakely via Libc-alpha
2021-07-17  8:14             ` Matthias Kretz
2021-07-17 13:32               ` Jonathan Wakely via Libc-alpha
2021-07-17 13:54                 ` Matthias Kretz
2021-07-17 21:37                   ` Jason Merrill via Libc-alpha
2021-07-19  9:41                     ` Richard Earnshaw via Libc-alpha
2021-07-20 16:43                       ` Jason Merrill via Libc-alpha
2021-07-20 18:05                 ` Thomas Rodgers
2021-07-16 17:20     ` Noah Goldstein via Libc-alpha
2021-07-16 19:37       ` Matthias Kretz
2021-07-16 21:23         ` Noah Goldstein via Libc-alpha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2948804.xd1mhZDcFd@excalibur \
    --to=m.kretz@gsi.de \
    --cc=Richard.Earnshaw@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=jwakely@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).