[CMake] Remove forcing of -O2 from torch_compile_options (#164894)

That was introduced by 75a65ffe0f
Hattip to @jathu for alerting me about the issue. As result, all our PyTorch builds were shipped with `-O2` for almost all of its modern history

Partially undo the damage introduced by https://github.com/pytorch/pytorch/pull/128406 that cause cross-ISA symbols leak, to be properly followed up in https://github.com/pytorch/pytorch/issues/165123

Pull Request resolved: https://github.com/pytorch/pytorch/pull/164894
Approved by: https://github.com/ezyang
This commit is contained in:
Nikita Shulga
2025-10-09 18:23:18 -07:00
committed by PyTorch MergeBot
parent df514a6d5a
commit 9a3c4b917e
2 changed files with 2 additions and 6 deletions

View File

@ -406,7 +406,7 @@ scalar_t cubic_convolution2(scalar_t x, scalar_t A) {
}
template <typename scalar_t>
void get_cubic_upsample_coefficients(
static inline void get_cubic_upsample_coefficients(
scalar_t coeffs[4],
scalar_t t) {
scalar_t A = -0.75;

View File

@ -439,10 +439,6 @@ function(torch_compile_options libname)
$<$<COMPILE_LANGUAGE:CXX>: -fvisibility=hidden>)
endif()
# Use -O2 for release builds (-O3 doesn't improve perf, and -Os results in perf regression)
target_compile_options(${libname} PRIVATE
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>>>:-O2>)
endfunction()
##############################################################################