Skip to content

Add tests for CPU features#1287

Open
AntoinePrv wants to merge 6 commits intoxtensor-stack:masterfrom
AntoinePrv:cpu-test
Open

Add tests for CPU features#1287
AntoinePrv wants to merge 6 commits intoxtensor-stack:masterfrom
AntoinePrv:cpu-test

Conversation

@AntoinePrv
Copy link
Copy Markdown
Contributor

  • Add cpu_feature test
  • Add run CPU tests in CI

run: cmake --build _build
- name: Set CPU feature test expectations
run: |
echo "XSIMD_TEST_CPU_ASSUME_SSE4_2=0" >> "$GITHUB_ENV"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wouldn't that be easy to just not set it instead of setting it to zero?

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.

Here we have two cases:

  • not defined (the default): Do not run the tests. This is important so that the test runs properly locally without failing.
  • Define to zero: Explicitly check the absence of a feature. This is important so that we do not detect a higher architecture at runtime than is available and crash the program.

xsimd::x86_cpu_features cpu;

// SSE implication chain
CHECK_IMPLICATION(cpu.sse4_2(), cpu.sse4_1());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would that make sense to use this to also check the is_base_of type relationship?

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.

What do you have in mind, could you provide an example?

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