Skip to content

[C++][SIMD] Avoid one-definition-rule violation of arrow::internal::BitmapWriter without depending on -O2  #36902

Open

Description

@kou

Describe the enhancement requested

Contexts:

We have runtime SIMD dispatch feature. For example, it's used in cpp/src/parquet/level_conversion.cc to run BMI2 based DefLevelsToBitmap implementation if available.

DefLevelsToBitmap (DefLevelsToBitmapSimd) is implemented in cpp/src/parquet/level_conversion_inc.h and it's built with/without BMI2. DefLevelsToBitmapSimd uses arrow::internal::BitmapWriter. If arrow::internal::BitmapWriter in DefLevelsToBitmapSimd is not inlined, one-definition-rule violation is happen. If it's happen, libparquet.dylib has two BitmapWriter definitions for with/without BMI2. If BMI2 version BitmapWriter is used on BMI2 unavailable machine, "illegal opcode" is happen.

GH-14342 resolved this by forcing to use -O2 to enforce inlining. But it doesn't work with Homebrew. Because Homebrew overrides -O* specified by us.

If we can avoid one-definition-rule violation of arrow::internal::BitmapWriter without depending on -O2, we can provide a Homebrew bottle that can use the BMI2 based implementation on machines that support BMI2.

Component(s)

C++

Activity

  1. added
    Status: stale-warning
    on Feb 18, 2026
  2. thisisnic commented on Feb 18, 2026

    @thisisnic
    Member

    This issue has been marked as stale because it has had no activity in the past 2 years. Please remove the stale label or comment below, or this issue will be closed in 14 days.

  3. removed
    Status: stale-warning
    on Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions