Skip to content

Implement runtime check for AVX2 SIMD functionality in collisions #203

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

Merged
merged 2 commits into from
Feb 20, 2023
Merged

Implement runtime check for AVX2 SIMD functionality in collisions #203

merged 2 commits into from
Feb 20, 2023

Conversation

avaxar
Copy link
Contributor

@avaxar avaxar commented Feb 18, 2023

This PR implements a runtime check on whether the AVX2 instruction set is present or not in the CPU. Compile-time macros like __AVX2__ only flags whether the compiler support generating code using AVX2, but not whether the running system would be able to execute it. If a non-AVX2-supporting processor runs an AVX2-using code, the program will generate a segfault over an unrecognized instruction/opcode, as what I intend to fix #202. Because pygame-geometry doesn't use SDL2, which means not being able to use the straightforward SDL_HasAVX2 function, I had to make my own function to check it.

Copy link
Member

@andrewhong04 andrewhong04 left a comment

Choose a reason for hiding this comment

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

LGTM.

@andrewhong04 andrewhong04 merged commit 86094e9 into pygame-community:main Feb 20, 2023
@avaxar avaxar deleted the avx2-runtime-check branch February 20, 2023 21:26
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.

Python crashes when running the unittests on Linux Mint
2 participants