-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[mlir][test] Make SME e2e tests require an emulator #86489
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
banach-space
merged 5 commits into
llvm:main
from
banach-space:andrzej/restrict_sme_e2e_tests
Apr 4, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
199a5b5
[mlir][test] Make SME e2e tests require an emulator
banach-space 891e2fc
fixup! [mlir][test] Make SME e2e tests require an emulator
banach-space 85b819b
fixup! fixup! [mlir][test] Make SME e2e tests require an emulator
banach-space af5a2cc
[mlir][test] Extend CMake logic for e2e tests
banach-space 7531c0e
fixup! [mlir][test] Extend CMake logic for e2e tests
banach-space File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| # A collection of helper CMake functions to detect hardware capabilities. At | ||
| # the moment these are used when configuring MLIR integration tests. | ||
|
|
||
| # Checks whether the specified hardware capability is supported by the host | ||
| # Linux system. This is implemented by checking auxiliary vector feature | ||
| # provided by the Linux kernel. | ||
| # | ||
| # check_hwcap( | ||
| # hwcap_spec | ||
| # output_var | ||
| # ) | ||
| # | ||
| # hwcap_spec - HWCAP value to check - these are defined in hwcap.h in the Linux | ||
| # kernel. | ||
| # | ||
| # output_var - Output variable to use to save the results (TRUE for supported, | ||
| # FALSE for not supported). | ||
| # | ||
| # EXAMPLES: | ||
| # | ||
| # check_hwcap("HWCAP2_SME" SME_EMULATOR_REQUIRED) | ||
| # | ||
| function(check_hwcap hwcap_spec output) | ||
| set(hwcap_test_src | ||
| [====[ | ||
| #include <asm/hwcap.h> | ||
| #include <sys/auxv.h> | ||
|
|
||
| int main(void) | ||
| { | ||
| long hwcaps = getauxval(AT_<HWCAP_VEC>); | ||
| return (hwcaps & <HWCAP_SPEC>) != 0; | ||
| } | ||
| ]====] | ||
| ) | ||
|
|
||
| # Extract from $hwcap_spec whether this is AT_HWCAP or AT_HWCAP2 | ||
| string(FIND ${hwcap_spec} "_" wsloc) | ||
| string(SUBSTRING ${hwcap_spec} 0 ${wsloc} hwcap_vec) | ||
|
|
||
| string(REPLACE "<HWCAP_VEC>" ${hwcap_vec} hwcap_test_src "${hwcap_test_src}") | ||
| string(REPLACE "<HWCAP_SPEC>" ${hwcap_spec} hwcap_test_src "${hwcap_test_src}") | ||
|
|
||
| set(hwcap_test_file ${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/hwcap_check.c) | ||
| file(WRITE ${hwcap_test_file} "${hwcap_test_src}") | ||
|
|
||
| # Compile _and_ run | ||
| try_run( | ||
| test_run_result test_compile_result | ||
| ${CMAKE_BINARY_DIR} | ||
| ${hwcap_test_file} | ||
| ) | ||
| # Compilation will fail if hwcap_spec is not defined - this usually means | ||
| # that your Linux kernel is too old. | ||
| if(${test_compile_result} AND (DEFINED test_run_result)) | ||
| message(${test_run_result}) | ||
| message(STATUS "Checking whether ${hwcap_spec} is supported by the host system: ${test_run_result}") | ||
| set(${output} ${test_run_result} PARENT_SCOPE) | ||
| else() | ||
| message(STATUS "Checking whether ${hwcap_spec} is supported by the host system: FALSE") | ||
| endif() | ||
| endfunction(check_hwcap) | ||
|
|
||
| # For the given group of e2e tests (defined by the `mlir_e2e_tests` flag), | ||
| # checks whether an emulator is required. If yes, verifies that the | ||
| # corresponding CMake var pointing to an emulator (`emulator_exec`) has been | ||
| # set. | ||
| # | ||
| # check_emulator( | ||
| # mlir_e2e_tests | ||
| # hwcap_spec | ||
| # emulator_exec | ||
| # ) | ||
| # | ||
| # mlir_e2e_tests - MLIR CMake variables corresponding to the group of e2e tests | ||
| # to check | ||
| # hwcap_spec - HWCAP value to check. This should correspond to the hardware | ||
| # capabilities required by the tests to be checked. Possible | ||
| # values are defined in hwcap.h in the Linux kernel. | ||
| # emulator_exec - variable the defines the emulator (ought to be set if | ||
| # required, can be empty otherwise). | ||
| # | ||
| # EXAMPLES: | ||
| # | ||
| # check_emulator(MLIR_RUN_ARM_SVE_TESTS "HWCAP_SVE" ARM_EMULATOR_EXECUTABLE) | ||
| # | ||
| function(check_emulator mlir_e2e_tests hwcap_spec emulator_exec) | ||
| if (NOT ${mlir_e2e_tests}) | ||
| return() | ||
| endif() | ||
|
|
||
| check_hwcap(${hwcap_spec} emulator_not_required) | ||
| if (${emulator_not_required}) | ||
| return() | ||
| endif() | ||
|
|
||
| if (${emulator_exec} STREQUAL "") | ||
| message(FATAL_ERROR "${mlir_e2e_tests} requires an emulator, but ${emulator_exec} is not set") | ||
| endif() | ||
|
|
||
| endfunction() |
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.