pytorch/aten/src/ATen/core
Yu, Guangye c9eabadc5e Suppress std::hardware_destructive_interference_size warning on GCC 13+ (#166297)
# Motivation
In https://github.com/pytorch/pytorch/pull/145591, `std::hardware_destructive_interference_size` was introduced in CUDACachingAllocator. Later, https://github.com/pytorch/pytorch/pull/160067 moved it to `c10/core/alignment.h` for code reuse.
However, on **GCC 13+** using `std::hardware_destructive_interference_size` triggers the following warning:
```bash
warning: use of ‘std::hardware_destructive_interference_size’ [-Winterference-size]
/home/pt-gpu/4T-4652/guangyey/stock-pytorch/aten/src/ATen/core/CachingHostAllocator.h:42:16: note: its value can vary between compiler versions or with different ‘-mtune’ or ‘-mcpu’ flags
/home/pt-gpu/4T-4652/guangyey/stock-pytorch/aten/src/ATen/core/CachingHostAllocator.h:42:16: note: if this use is part of a public ABI, change it to instead use a constant variable you define
/home/pt-gpu/4T-4652/guangyey/stock-pytorch/aten/src/ATen/core/CachingHostAllocator.h:42:16: note: the default value for the current CPU tuning is 64 bytes
/home/pt-gpu/4T-4652/guangyey/stock-pytorch/aten/src/ATen/core/CachingHostAllocator.h:42:16: note: you can stabilize this value with ‘--param hardware_destructive_interference_size=64’, or disable this warning with ‘-Wno-interference-size’
```

# Solution
- Solution 1: Replace `c10::hardware_destructive_interference_size` with a constant 64.
```cpp
constexpr std::size_t hardware_destructive_interference_size = 64;
```

- Solution 2: adding `-Wno-interference-size’ to 8d4e48831e/cmake/public/utils.cmake (L386) to suppress the warning.

# Additional Context
The current implementation uses the second approach. If the reviewers prefer the first approach, I am happy to update it accordingly.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/166297
Approved by: https://github.com/ezyang
2025-10-29 02:57:46 +00:00
..
boxing Mark unused parameters in C++ code (#164912) 2025-10-09 06:23:25 +00:00
dispatch [1/N][Fix] Fix typo in aten folder (#166126) 2025-10-27 15:34:39 +00:00
op_registration [1/N][Fix] Fix typo in aten folder (#166126) 2025-10-27 15:34:39 +00:00
adaption.cpp Make device check throw specific error (#155085) 2025-06-06 07:00:04 +00:00
alias_info.h [hop] support base_hop._gen_schema (#149688) 2025-04-09 16:42:55 +00:00
Array.h
ATen_fwd.h
ATen_pch.h Remove unnecessary __STDC_FORMAT_MACROS macro (#152513) 2025-05-02 05:06:44 +00:00
ATenGeneral.cpp
ATenGeneral.h
ATenOpList.h
BackendSelectFallbackKernel.cpp
Backtrace.h
blob.cpp
blob.h Enable more readability-redundant checks (#143963) 2024-12-30 14:49:33 +00:00
builtin_function.h Mark unused parameters in C++ code (#164912) 2025-10-09 06:23:25 +00:00
CachingHostAllocator.cpp Remove unnecessary "static" for definitions in anonymous namespace (#165035) 2025-10-11 00:04:23 +00:00
CachingHostAllocator.h Suppress std::hardware_destructive_interference_size warning on GCC 13+ (#166297) 2025-10-29 02:57:46 +00:00
CheckMemoryFormat.h [1/N] Apply bugprone-unchecked-optional-access (#140679) 2024-11-20 04:04:41 +00:00
class_type.cpp Enable more readability-redundant checks (#143963) 2024-12-30 14:49:33 +00:00
class_type.h [1/N][Fix] Fix typo in aten folder (#166126) 2025-10-27 15:34:39 +00:00
custom_class.cpp
custom_class.h
DeprecatedTypeProperties.cpp
DeprecatedTypeProperties.h
DeprecatedTypePropertiesRegistry.cpp
DeprecatedTypePropertiesRegistry.h
Dict_inl.h [BE] Replace std::runtime_error with TORCH_CHECK [1/N] (#151880) 2025-04-23 11:14:35 +00:00
Dict.cpp
Dict.h Enable modernize-use-default-member-init (#149046) 2025-04-09 11:57:24 +00:00
Dimname.cpp Cast to unsigned char to avoid UB (#152360) 2025-04-30 15:09:13 +00:00
Dimname.h
DimVector.h
DistributionsHelper.h restore rng generation for fbcode (#144819) 2025-01-16 06:46:26 +00:00
dynamic_type.cpp Mark unused parameters in C++ code (#164912) 2025-10-09 06:23:25 +00:00
dynamic_type.h Mark unused parameters in C++ code (#164912) 2025-10-09 06:23:25 +00:00
enum_type.h [4/N] Apply bugprone-unchecked-optional-access (#142832) 2024-12-12 04:33:32 +00:00
Formatting.cpp [BE][Ez]: Enable ClangFormat aten/src/core/Formatting.cpp (#154719) 2025-05-30 19:52:43 +00:00
Formatting.h
function_schema_inl.h [BE] Replace std::runtime_error with TORCH_CHECK [1/N] (#151880) 2025-04-23 11:14:35 +00:00
function_schema.cpp [1/N][Fix] Fix typo in aten folder (#166126) 2025-10-27 15:34:39 +00:00
function_schema.h Use std::string_view (#145906) 2025-01-30 03:14:27 +00:00
function.h Mark unused parameters in C++ code (#164912) 2025-10-09 06:23:25 +00:00
functional.h
Generator.cpp
Generator.h [Code Clean] Replace std::runtime_error with TORCH_CHECK (#165209) 2025-10-22 00:05:22 +00:00
GeneratorForPrivateuseone.cpp Make Context to be Device-agnostic Step by Step (3/N) (#137578) 2024-12-18 15:12:19 +00:00
GeneratorForPrivateuseone.h Make Context to be Device-agnostic Step by Step (3/N) (#137578) 2024-12-18 15:12:19 +00:00
grad_mode.h
IListRef_inl.h Fix compilation warning with gcc14 (#155934) 2025-06-16 16:43:15 +00:00
IListRef_test.cpp Enable misc-use-internal-linkage check and apply fixes (#148948) 2025-03-12 14:22:56 +00:00
IListRef.h
interned_strings_class.h
interned_strings.cpp [Code Clean] Replace std::runtime_error with TORCH_CHECK (#165209) 2025-10-22 00:05:22 +00:00
interned_strings.h
ivalue_inl.h [1/N][Fix] Fix typo in aten folder (#166126) 2025-10-27 15:34:39 +00:00
ivalue_to.h
ivalue.cpp [Code Clean] Replace std::runtime_error with TORCH_CHECK (#165209) 2025-10-22 00:05:22 +00:00
ivalue.h [1/N][Fix] Fix typo in aten folder (#166126) 2025-10-27 15:34:39 +00:00
jit_type_base.h Simplify SingletonOrSharedTypePtr (#166183) 2025-10-26 01:25:24 +00:00
jit_type.h [1/N][Fix] Fix typo in aten folder (#166126) 2025-10-27 15:34:39 +00:00
LegacyTypeDispatch.h
library.cpp [pytorch] use a mutex in initialize_torch_libraries (#151938) 2025-04-23 21:41:01 +00:00
List_inl.h Replace is_same with is_same_v for concise syntax (#145450) 2025-02-13 03:29:39 +00:00
List_test.cpp [1/N] Deprecate c10::string_view and at::string (#151972) 2025-04-29 07:23:52 +00:00
List.cpp
List.h
MetaFallbackKernel.cpp
MT19937RNGEngine.h
NamedRegistrations.cpp
NamedTensor.cpp Don't return values in void functions (#164809) 2025-10-08 01:04:14 +00:00
NamedTensor.h Mark unused parameters in C++ code (#164912) 2025-10-09 06:23:25 +00:00
NestedIntSymNodeImpl.cpp
NestedIntSymNodeImpl.h
operator_name.cpp
operator_name.h Mark unused parameters in C++ code (#164912) 2025-10-09 06:23:25 +00:00
PhiloxRNGEngine.h Turn some const variables into constexpr in C++ code (#165401) 2025-10-17 13:24:46 +00:00
PythonFallbackKernel.cpp Add a RECORD_FUNCTION for Python fallback so it shows in profile (#160573) 2025-10-01 14:10:44 +00:00
PythonFallbackKernel.h Enable cppcoreguidelines-special-member-functions (#139132) 2024-11-06 13:42:20 +00:00
PythonOpRegistrationTrampoline.cpp Revert "[BE] Remove HermeticPyObjectTLS and Simplify PythonOpRegistrationTrampoline (#163464)" 2025-09-30 18:20:20 +00:00
PythonOpRegistrationTrampoline.h Mark unused parameters in C++ code (#164912) 2025-10-09 06:23:25 +00:00
qualified_name.h
QuantizerBase.h Enable cppcoreguidelines-special-member-functions (#139132) 2024-11-06 13:42:20 +00:00
Range.cpp
Range.h
README.md
Reduction.h
register_symbols.cpp Switch c10::string_view to std::string_view (#139635) 2024-11-27 01:41:18 +00:00
rref_interface.h Enable cppcoreguidelines-special-member-functions (#139132) 2024-11-06 13:42:20 +00:00
Scalar.h
ScalarType.h
stack.h Remove unneeded Clang-tidy suppression (#148246) 2025-03-01 16:51:54 +00:00
symbol.h
tensor_type.cpp [1/N][Fix] Fix typo in aten folder (#166126) 2025-10-27 15:34:39 +00:00
Tensor.cpp [reland] Allow setting grad_dtype on leaf tensors (#164751) 2025-10-08 20:23:13 +00:00
Tensor.h Remove unneeded Clang-tidy suppression (#148246) 2025-03-01 16:51:54 +00:00
TensorAccessor.h Fix cppcoreguidelines-pro-type-member-init (#141787) 2024-12-21 07:51:30 +00:00
TensorBase.h [Code Clean] Replace std::runtime_error with TORCH_CHECK (#165209) 2025-10-22 00:05:22 +00:00
TorchDispatchUtils.cpp
TorchDispatchUtils.h
TransformationHelper.h [2/N] Fix clang-tidy readability checks (#164652) 2025-10-06 01:06:01 +00:00
type_factory.cpp [codemod] c10::string_view -> std::string_view in fields (#141736) 2024-11-28 21:35:53 +00:00
type_factory.h Fix return type of TypeFactoryBase<c10::DynamicType>::get (#151803) 2025-04-24 04:43:34 +00:00
type_ptr.h Mark unused parameters in C++ code (#164912) 2025-10-09 06:23:25 +00:00
type.cpp [Code Clean] Replace std::runtime_error with TORCH_CHECK (#165209) 2025-10-22 00:05:22 +00:00
typeid.h
UndefinedTensorImpl.h
union_type.cpp [3/N] Apply bugprone-unchecked-optional-access (#142442) 2024-12-11 01:39:10 +00:00
UnsafeFromTH.h
VariableFallbackKernel.cpp [Autograd] Add Default Autograd Fallback for PrivateUse1 in PyTorch (#165315) 2025-10-25 01:27:27 +00:00
VariableHooksInterface.cpp
VariableHooksInterface.h [reland] Allow setting grad_dtype on leaf tensors (#164751) 2025-10-08 20:23:13 +00:00
Variadic.h
Vitals.cpp [Environment Variable][7/N] Use thread-safe getenv functions (#140211) 2025-04-24 01:06:29 +00:00
Vitals.h Enable more readability-redundant checks (#143963) 2024-12-30 14:49:33 +00:00

ATen Core

ATen Core is a minimal subset of ATen which is suitable for deployment on mobile. Binary size of files in this folder is an important constraint.