[libcxx-commits] [clang] [libcxx] [C++17] Support __GCC_[CON|DE]STRUCTIVE_SIZE (PR #89446)

James Y Knight via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 23 12:00:18 PDT 2024


================
@@ -1792,6 +1792,11 @@ class TargetInfo : public TransferrableTargetInfo,
   /// Whether to support HIP image/texture API's.
   virtual bool hasHIPImageSupport() const { return true; }
 
+  /// The minimum offset between two objects to avoid false sharing.
+  virtual unsigned hardwareDestructiveInterferenceSize() const { return 64; }
----------------
jyknight wrote:

I vaguely wonder if we should make this a single "hardwareInterferenceSizes" function, returning a std::pair<unsigned, unsigned>, because otherwise, when we start add per-CPU tuning to the values, it's very likely to result in duplicating the same series of conditionals in each of the two functions.

Also, with a single function, we are less likely to accidentally end up with an override that returns values such that `destructive < constructive`.

https://github.com/llvm/llvm-project/pull/89446


More information about the libcxx-commits mailing list