Filtered_kernel: Optimisation of side_of_oriented_sphere_3()#9546
Open
afabri wants to merge 4 commits into
Open
Filtered_kernel: Optimisation of side_of_oriented_sphere_3()#9546afabri wants to merge 4 commits into
afabri wants to merge 4 commits into
Conversation
sloriot
reviewed
Jul 1, 2026
|
|
||
| #include <CGAL/Profile_counter.h> | ||
| #include <CGAL/Filtered_kernel/internal/Static_filters/Static_filter_error.h> | ||
| #include <immintrin.h> |
sloriot
reviewed
Jul 1, 2026
| return _mm_cvtsd_f64(m); | ||
| } | ||
|
|
||
| inline __m256d abs4(__m256d v) |
Member
There was a problem hiding this comment.
/mnt/testsuite/include/CGAL/Filtered_kernel/internal/Static_filters/Side_of_oriented_sphere_3.h:33:30: warning: AVX vector return without AVX enabled changes the ABI [-Wpsabi]
33 | inline __m256d abs4(__m256d v)
| ^
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
This PR is the starting point to find out if and how we can accelerate the static filter of
Side_of_oriented_sphere_3.It is the first item in vtune in bottom up view when constructing a
Delaunay_triangulation_3.Running an executable that computes a triangulation has enormous fluctuations in performance. This PR has a standalone program that reads a point cloud into a
std::vectorand performsNtimes a loops over the vector, taking four consecutive points, and performing the test on the nextQpoints. The point cloud file name, as well asNandQare parameters of the standalone.The static filter first computes 12 absolute values, and then computes 3 times the max of groups of four absolute values.
We use
CGAL::abs(double)where we already usestd::fabs()instead ofstd::abs().In the code we have the macro
CGAL_USE_SSE2_MAXto enable an implementation usingSSE2for computing max.We also have a macro
CGAL_USE_SSE2_FABSfor the usage ofSSE2insideCGAL::abs(double)instead of usingstd::fabs(). The macros are by default undefined.Our code presented to chatgpt, it recommends to replace by
and to hope that the compiler vectorizes the code. It suggests to check the generated assembler.
Also our functions using
SSE2presented to chatgpt, you get quite some remarks that forjust computing the abs of a single double there is nothing to gain, and if doing
several abs and max computations the doubles should be in an array and not just individual double variables.
This PR is WIP and tries to systematically benchmark, adding as another dimension the compiler, and the operating system.
Here is the table for running once for
Qqueries, and 10 times forQ/10queries, for VC++ as well as for clang/Windows.We next try the suggested code, only for the
1 * Qscenario, once withstd::abs()once withstd::fabs()and VC++std::abs()std::fabs()and this time for clang 19.1.1 on Windows
std::abs()std::fabs()Release Management