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

GH-44976: [C++] Enable mimalloc by default, disable jemalloc by default and more #44951

Merged
merged 1 commit into from
Dec 10, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cpp/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"name": "features-minimal",
"hidden": true,
"cacheVariables": {
"ARROW_MIMALLOC": "OFF",
"ARROW_WITH_RE2": "OFF",
"ARROW_WITH_UTF8PROC": "OFF"
}
Expand All @@ -91,7 +92,8 @@
"ARROW_CSV": "ON",
"ARROW_DATASET": "ON",
"ARROW_FILESYSTEM": "ON",
"ARROW_JSON": "ON"
"ARROW_JSON": "ON",
"ARROW_MIMALLOC": "ON"
}
},
{
Expand Down
22 changes: 2 additions & 20 deletions cpp/cmake_modules/DefineOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -362,29 +362,11 @@ takes precedence over ccache if a storage backend is configured" ON)

define_option(ARROW_IPC "Build the Arrow IPC extensions" ON)

set(ARROW_JEMALLOC_DESCRIPTION "Build the Arrow jemalloc-based allocator")
if(WIN32
OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD"
OR CMAKE_SYSTEM_PROCESSOR MATCHES "aarch|ARM|arm"
OR NOT ARROW_ENABLE_THREADING)
# jemalloc is not supported on Windows.
#
# jemalloc is the default malloc implementation on FreeBSD and can't
# be built with --disable-libdl on FreeBSD. Because lazy-lock feature
# is required on FreeBSD. Lazy-lock feature requires libdl.
#
# jemalloc may have a problem on ARM.
# See also: https://github.com/apache/arrow/issues/44342
#
# jemalloc requires thread.
define_option(ARROW_JEMALLOC ${ARROW_JEMALLOC_DESCRIPTION} OFF)
else()
define_option(ARROW_JEMALLOC ${ARROW_JEMALLOC_DESCRIPTION} ON)
endif()
define_option(ARROW_JEMALLOC "Build the Arrow jemalloc-based allocator" OFF)

define_option(ARROW_JSON "Build Arrow with JSON support (requires RapidJSON)" OFF)

define_option(ARROW_MIMALLOC "Build the Arrow mimalloc-based allocator" OFF)
define_option(ARROW_MIMALLOC "Build the Arrow mimalloc-based allocator" ON)

define_option(ARROW_PARQUET
"Build the Parquet libraries"
Expand Down
35 changes: 17 additions & 18 deletions cpp/src/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -727,9 +727,6 @@ set(ARROW_COMPUTE_SRCS
compute/function.cc
compute/function_internal.cc
compute/kernel.cc
compute/key_hash_internal.cc
compute/key_map_internal.cc
compute/light_array_internal.cc
compute/ordering.cc
compute/registry.cc
compute/kernels/chunked_internal.cc
Expand All @@ -748,20 +745,7 @@ set(ARROW_COMPUTE_SRCS
compute/kernels/vector_selection.cc
compute/kernels/vector_selection_filter_internal.cc
compute/kernels/vector_selection_internal.cc
compute/kernels/vector_selection_take_internal.cc
compute/row/encode_internal.cc
compute/row/compare_internal.cc
compute/row/grouper.cc
compute/row/row_encoder_internal.cc
compute/row/row_internal.cc
compute/util.cc
compute/util_internal.cc)

append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/key_hash_internal_avx2.cc)
append_runtime_avx2_bmi2_src(ARROW_COMPUTE_SRCS compute/key_map_internal_avx2.cc)
append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/row/compare_internal_avx2.cc)
append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/row/encode_internal_avx2.cc)
append_runtime_avx2_bmi2_src(ARROW_COMPUTE_SRCS compute/util_avx2.cc)
compute/kernels/vector_selection_take_internal.cc)

if(ARROW_COMPUTE)
# Include the remaining kernels
Expand Down Expand Up @@ -794,10 +778,25 @@ if(ARROW_COMPUTE)
compute/kernels/vector_replace.cc
compute/kernels/vector_run_end_encode.cc
compute/kernels/vector_select_k.cc
compute/kernels/vector_sort.cc)
compute/kernels/vector_sort.cc
compute/key_hash_internal.cc
compute/key_map_internal.cc
compute/light_array_internal.cc
compute/row/encode_internal.cc
compute/row/compare_internal.cc
compute/row/grouper.cc
compute/row/row_encoder_internal.cc
compute/row/row_internal.cc
compute/util.cc
compute/util_internal.cc)
Comment on lines +790 to +791
Copy link
Member Author

Choose a reason for hiding this comment

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

Those two files may be moved into the row subdir perhaps.

pitrou marked this conversation as resolved.
Show resolved Hide resolved

append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/kernels/aggregate_basic_avx2.cc)
append_runtime_avx512_src(ARROW_COMPUTE_SRCS compute/kernels/aggregate_basic_avx512.cc)
append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/key_hash_internal_avx2.cc)
append_runtime_avx2_bmi2_src(ARROW_COMPUTE_SRCS compute/key_map_internal_avx2.cc)
append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/row/compare_internal_avx2.cc)
append_runtime_avx2_src(ARROW_COMPUTE_SRCS compute/row/encode_internal_avx2.cc)
append_runtime_avx2_bmi2_src(ARROW_COMPUTE_SRCS compute/util_avx2.cc)
endif()

arrow_add_object_library(ARROW_COMPUTE ${ARROW_COMPUTE_SRCS})
Expand Down
18 changes: 10 additions & 8 deletions cpp/src/arrow/compute/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,18 @@ add_arrow_test(internals_test
function_test.cc
exec_test.cc
kernel_test.cc
light_array_test.cc
registry_test.cc
key_hash_test.cc
row/compare_test.cc
row/grouper_test.cc
row/row_encoder_internal_test.cc
row/row_test.cc
util_internal_test.cc)
registry_test.cc)

add_arrow_compute_test(expression_test SOURCES expression_test.cc)
add_arrow_compute_test(row_test
SOURCES
key_hash_test.cc
light_array_test.cc
row/compare_test.cc
row/grouper_test.cc
row/row_encoder_internal_test.cc
row/row_test.cc
util_internal_test.cc)

add_arrow_benchmark(function_benchmark PREFIX "arrow-compute")

Expand Down
Loading