Skip to content

GH-44249: [C++] Unify simd header includings - #44250

Merged
pitrou merged 3 commits into
apache:mainfrom
zanmato1984:cleanup-simd-inclusion
Oct 2, 2024
Merged

pitrou merged 3 commits into
apache:mainfrom
zanmato1984:cleanup-simd-inclusion

Conversation

@zanmato1984

@zanmato1984 zanmato1984 commented Sep 29, 2024 •

Copy link
Copy Markdown
Contributor

Rationale for this change

#44249

What changes are included in this PR?

Change all the system header inclusions to simd.h.

Also removed some duplicated defines.

Are these changes tested?

Existing tests should be good.

Are there any user-facing changes?

None.

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #44249 has been automatically assigned in GitHub to PR creator.

@zanmato1984

Copy link
Copy Markdown
Contributor Author

Hi @pitrou , what do you think if we do this? And if you agree with this change, shall we move forward to add some lint rules to forbid system simd header including?

Thanks.

@zanmato1984

Copy link
Copy Markdown
Contributor Author

@github-actions crossbow submit -g cpp

@github-actions

Copy link
Copy Markdown

Revision: d202127

Submitted crossbow builds: ursacomputing/crossbow @ actions-1cab231bec

Task Status
example-cpp-minimal-build-static GitHub Actions
example-cpp-minimal-build-static-system-dependency GitHub Actions
example-cpp-tutorial GitHub Actions
test-alpine-linux-cpp GitHub Actions
test-build-cpp-fuzz GitHub Actions
test-conda-cpp GitHub Actions
test-conda-cpp-valgrind GitHub Actions
test-cuda-cpp-ubuntu-20.04-cuda-11.2.2 GitHub Actions
test-cuda-cpp-ubuntu-22.04-cuda-11.7.1 GitHub Actions
test-debian-12-cpp-amd64 GitHub Actions
test-debian-12-cpp-i386 GitHub Actions
test-fedora-39-cpp GitHub Actions
test-ubuntu-20.04-cpp GitHub Actions
test-ubuntu-20.04-cpp-bundled GitHub Actions
test-ubuntu-20.04-cpp-minimal-with-formats GitHub Actions
test-ubuntu-22.04-cpp GitHub Actions
test-ubuntu-22.04-cpp-20 GitHub Actions
test-ubuntu-22.04-cpp-emscripten GitHub Actions
test-ubuntu-22.04-cpp-no-threading GitHub Actions
test-ubuntu-24.04-cpp GitHub Actions
test-ubuntu-24.04-cpp-gcc-13-bundled GitHub Actions
test-ubuntu-24.04-cpp-gcc-14 GitHub Actions
test-ubuntu-24.04-cpp-thread-sanitizer GitHub Actions

Comment on lines +702 to +706
'immintrin.h',
'intrin.h',
'nmmintrin.h',
'x86intrin.h',
'xmmintrin.h',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Technically not related to the purpose of this change. Just saw it and fixed.

Comment thread cpp/src/arrow/util/macros.h Resolved
Comment thread cpp/src/arrow/util/prefetch.h Resolved
@zanmato1984

Copy link
Copy Markdown
Contributor Author

And if you agree with this change, shall we move forward to add some lint rules to forbid system simd header including?

Thanks for looking at this @pitrou , much appreciated! And what do you think about this? The lint rule seems not trivial so I want to check with you first.

@pitrou

pitrou commented Oct 1, 2024 •

Copy link
Copy Markdown
Member

And if you agree with this change, shall we move forward to add some lint rules to forbid system simd header including?

Thanks for looking at this @pitrou , much appreciated! And what do you think about this? The lint rule seems not trivial so I want to check with you first.

We could, yes, though I'm not sure how useful that would be. What would be the rationale?

@zanmato1984

Copy link
Copy Markdown
Contributor Author

And if you agree with this change, shall we move forward to add some lint rules to forbid system simd header including?

Thanks for looking at this @pitrou , much appreciated! And what do you think about this? The lint rule seems not trivial so I want to check with you first.

We could, yes, though I'm not sure how useful that would be. What would be the rationale?

Right. After a second thought, I think the rational is not strong enough. One reason is that it doesn't really hurt anything if one uses system headers directly (except that one will have to write own platform-specific checking code) so maybe we shouldn't mandate that. The other is that intrinsics are not all simd related so requiring including simd.h (as opposed to including system intrinsic headers) for cases otherwise (like what we did for querying hardware flags) doesn't make much sense.

Let's just forget it for now. Thanks for reminding.

@pitrou

pitrou commented Oct 2, 2024

Copy link
Copy Markdown
Member

The remaining CI failure is unrelated, thanks a lot @zanmato1984 !

@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 60f29e9.

There was 1 benchmark result indicating a performance regression:

The full Conbench report has more details. It also includes information about 6 possible false positives for unstable benchmarks that are known to sometimes produce them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants