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

fixing the broken build and optimizing the engine by 2.3 sec by using unused avx function namely computeBoundsOverlapMatrixAVX #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MajidAbdelilah
Copy link
Member

as simple as that

… unused avx function namely computeBoundsOverlapMatrixAVX
@VonTum
Copy link
Member

VonTum commented Jun 11, 2023

So, the thing is, SIMDHelper is used as a kind of grouping type for methods that can be well optimized with SIMD. It is meant to be filled out by the template using the function. This way we could use dynamic dispatch for the SIMD implementation on a higher level, reducing selection overhead. Similar to how Polyhedron's SSE and AVX variants are structured.

TrunkSIMDHelperFallback for this is one implementation for SIMDHelper that should not use SIMD. So we can use it on all platforms. Currently as it stands, you made the default code path require AVX, breaking the code for SSE-only systems.

The missing header is good though, It seems the CI build doesn't require it, but other systems may.

@MajidAbdelilah
Copy link
Member Author

but the SIMDHelper didnt select the avx function for my system which is confermed with linux perf it was using the scalar function

@VonTum
Copy link
Member

VonTum commented Jun 11, 2023

Yes, dynamic dispatch at the tree's root node was never finished.

Perhaps for the time being it would be easiest to just add an 'if' in computeBoundsOverlapMatrix that checks CPUID for AVX, and executes computeBoundsOverlapMatrixAVX instead if that's the case. It would be a minor overhead for a easy implementation.

@MajidAbdelilah
Copy link
Member Author

and how to do this CPUID check

@VonTum
Copy link
Member

VonTum commented Jun 11, 2023

See Physics3D/misc/cpuid.h

if hasTechnology(AVX) {...}

@MajidAbdelilah
Copy link
Member Author

thanks

@MajidAbdelilah
Copy link
Member Author

hey are you working today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants