Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-15678: [C++] Add support for -DCMAKE_BUILD_TYPE=MinSizeRel #14342

Merged
merged 3 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions cpp/cmake_modules/SetupCxxFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,9 @@ elseif("${CMAKE_BUILD_TYPE}" STREQUAL "PROFILE_GEN")
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "PROFILE_BUILD")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS_PROFILE_BUILD}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_FLAGS_PROFILE_BUILD}")
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "MINSIZEREL")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS_MINSIZEREL}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_FLAGS_MINSIZEREL}")
else()
message(FATAL_ERROR "Unknown build type: ${CMAKE_BUILD_TYPE}")
endif()
Expand Down
17 changes: 14 additions & 3 deletions cpp/src/parquet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,28 @@ set(PARQUET_SRCS
if(ARROW_HAVE_RUNTIME_AVX2)
# AVX2 is used as a proxy for BMI2.
list(APPEND PARQUET_SRCS level_comparison_avx2.cc level_conversion_bmi2.cc)
# We need CXX_FLAGS_RELEASE here to prevent the one-definition-rule
# violation with -DCMAKE_BUILD_TYPE=MinSizeRel. CXX_FLAGS_RELEASE
# will force inlining as much as possible.
# See also: ARROW-15664 and ARROW-15678
set_source_files_properties(level_comparison_avx2.cc
PROPERTIES SKIP_PRECOMPILE_HEADERS ON COMPILE_FLAGS
"${ARROW_AVX2_FLAG}")
PROPERTIES SKIP_PRECOMPILE_HEADERS ON
COMPILE_FLAGS
"${ARROW_AVX2_FLAG} ${CXX_FLAGS_RELEASE}")
# WARNING: DO NOT BLINDLY COPY THIS CODE FOR OTHER BMI2 USE CASES.
# This code is always guarded by runtime dispatch which verifies
# BMI2 is present. For a very small number of CPUs AVX2 does not
# imply BMI2.
#
# We need CXX_FLAGS_RELEASE here to prevent the one-definition-rule
# violation with -DCMAKE_BUILD_TYPE=MinSizeRel. CXX_FLAGS_RELEASE
# will force inlining as much as possible.
# See also: ARROW-15664 and ARROW-15678
set_source_files_properties(level_conversion_bmi2.cc
PROPERTIES SKIP_PRECOMPILE_HEADERS ON
COMPILE_FLAGS
"${ARROW_AVX2_FLAG} -DARROW_HAVE_BMI2 -mbmi2")
"${ARROW_AVX2_FLAG} -DARROW_HAVE_BMI2 ${CXX_FLAGS_RELEASE}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh... I removed -mbmi2 accidentally...
It caused a build failure on macOS High Sierra:

https://github.com/ursacomputing/crossbow/actions/runs/3225397138/jobs/5278904264#step:13:7034

/Users/voltrondata/tmp/hbtmp/apache-arrow-20221011-35535-3alkwv/cpp/src/parquet/level_conversion_inc.h:278:10: error: always_inline function '_pext_u64' requires target feature 'bmi2', but would be inlined into function 'ExtractBits' that is compiled without support for 'bmi2'
  return _pext_u64(bitmap, select_bitmap);
         ^

I'll restore the flag.

)
endif()

if(PARQUET_REQUIRE_ENCRYPTION)
Expand Down
6 changes: 6 additions & 0 deletions dev/tasks/r/github.macos-linux.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ jobs:
autobrew:
name: "install from local source"
runs-on: {{ "${{ matrix.os }}" }}
{% if env is defined %}
env:
{% for key, value in env.items() %}
{{ key }}: "{{ value }}"
{% endfor %}
{% endif %}
strategy:
fail-fast: false
matrix:
Expand Down
8 changes: 7 additions & 1 deletion dev/tasks/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,13 @@ tasks:
ci: github
template: r/github.macos-linux.local.yml

test-r-install-local-minsizerel:
ci: github
template: r/github.macos-linux.local.yml
params:
env:
CMAKE_BUILD_TYPE: MinSizeRel

test-r-devdocs:
ci: github
template: r/github.devdocs.yml
Expand Down Expand Up @@ -1355,7 +1362,6 @@ tasks:
ci: github
template: r/github.linux.offline.build.yml


test-r-rhub-debian-gcc-release-custom-ccache:
ci: azure
template: r/azure.linux.yml
Expand Down