This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Implement P0154R1 (Hardware inference size)
ClosedPublic

Authored by philnik on Mar 22 2022, 5:33 PM.

Details

Summary

__GCC_CONSTRUCTIVE_SIZE and __GCC_DESTRUCTIVE_SIZE are available since GCC 12. I'm assuming clang will also implement these for compatability with libstdc++.

Diff Detail

Event Timeline

philnik created this revision.Mar 22 2022, 5:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 22 2022, 5:33 PM
Herald added a subscriber: arichardson. · View Herald Transcript
philnik requested review of this revision.Mar 22 2022, 5:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 22 2022, 5:33 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript

Do you know whether Clang intends to implement this and if so whether they will use the same approach?
Since GCC 12 hasn't been released yet there's no CI testing done. So I would prefer to wait with this patch until we have GCC 12 in the CI.

libcxx/docs/Status/Cxx17Papers.csv
38

I don't think we can claim we're implemented this. ATM it's not implemented in Clang.
At the very least we need to add a note explaining the compiler dependency.
(Requiring using the GCC compiler means it doesn't work for all users, for example AppleClang users.)

ldionne requested changes to this revision.Mar 24 2022, 4:04 PM

I just pinged this topic: https://discourse.llvm.org/t/rfc-c-17-hardware-constructive-destructive-interference-size/48674/37?u=ldionne

Let's see if someone from Clang jumps on it. In all cases, I really don't like implementing this on GCC only, but if that's a way to exert slight pressure on Clang to implement it, I think it's acceptable.

Requesting changes for now, but I don't see anything wrong with the patch as-is.

This revision now requires changes to proceed.Mar 24 2022, 4:04 PM
ldionne accepted this revision.May 25 2022, 6:55 AM

Let's rebase this, apply my comments and land this if CI is green.

libcxx/docs/Status/Cxx17Papers.csv
30

Let's also add a release note.

libcxx/test/std/language.support/support.dynamic/hardware_inference_size.compile.pass.cpp
9

Can we use // XFAIL: clang && stdlib=libc++ instead of #if defined(__cpp_lib_hardware_interference_size) ...?

This revision is now accepted and ready to land.May 25 2022, 6:55 AM
ldionne added inline comments.May 25 2022, 9:40 AM
libcxx/docs/Status/Cxx17Papers.csv
38

Ugh yeah, that's true, we need to add a note.

philnik updated this revision to Diff 432058.May 25 2022, 11:35 AM
philnik marked 4 inline comments as done.
  • Address comments
philnik updated this revision to Diff 438936.Jun 22 2022, 1:06 AM
  • Rebased
  • Fix release notes
philnik updated this revision to Diff 439124.Jun 22 2022, 12:11 PM
  • Also XFAIL apple-clang
This revision was automatically updated to reflect the committed changes.