-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
i#6777: AArch64-ci: Add runner for 128 bit sve
This patch configures the github CI to spawn 3 AArch64 precommit jobs without sve, with sve 256 and with sve 128. This is accomplished by a small python program which makes a call to set the vector length and an update to the job matrix to spawn the appropriate jobs. Change-Id: I238d883cd805e0a643e392fe481a0abf9359a058
- Loading branch information
1 parent
6fb84c6
commit 7a48c25
Showing
4 changed files
with
145 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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,34 @@ | ||
#!/usr/bin/env python3 | ||
|
||
""" | ||
Print the vector length in the current context | ||
""" | ||
|
||
import ctypes | ||
import sys | ||
|
||
# These constants must match linux/prctl.h | ||
PR_SVE_GET_VL = 51 | ||
PR_SVE_VL_LEN_MASK = 0xffff | ||
|
||
def get_vector_length(): | ||
""" | ||
Use Prctl(2) to set the process tree's sve vector length. See | ||
https://man7.org/linux/man-pages/man2/prctl.2.html for more details | ||
""" | ||
libc = ctypes.cdll.LoadLibrary('libc.so.6') | ||
return_code = libc.prctl( | ||
PR_SVE_GET_VL) | ||
if return_code < 0: | ||
print(f'Failed to get VL, rc: {return_code}') | ||
sys.exit(1) | ||
print((return_code & PR_SVE_VL_LEN_MASK) * 8) | ||
|
||
if __name__ == '__main__': | ||
if any(arg in ["--help", "-h"] for arg in sys.argv) or len(sys.argv) > 1: | ||
print(f"usage: {sys.argv[0]}") | ||
print("\nGets the current vector length of this process tree") | ||
sys.exit(0) | ||
|
||
get_vector_length() | ||
|
This file contains 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,50 @@ | ||
#!/usr/bin/env python3 | ||
|
||
""" | ||
Run a program as a subprocess after configuring the vector length of the | ||
system to match the value in the first argument. | ||
""" | ||
|
||
import ctypes | ||
import subprocess | ||
import sys | ||
|
||
# These constants must match linux/prctl.h | ||
PR_SVE_SET_VL = 50 | ||
|
||
PR_SVE_VL_INHERIT = 1 << 17 | ||
PR_SVE_SET_VL_ONEXEC = 1 << 18 | ||
PR_SVE_VL_LEN_MASK = 0xffff | ||
|
||
def set_vector_length(vector_length): | ||
""" | ||
Use Prctl(2) to set the process tree's sve vector length. See | ||
https://man7.org/linux/man-pages/man2/prctl.2.html for more details | ||
""" | ||
vector_length_bytes = vector_length // 8 | ||
libc = ctypes.cdll.LoadLibrary('libc.so.6') | ||
return_code = libc.prctl( | ||
PR_SVE_SET_VL, | ||
PR_SVE_SET_VL_ONEXEC | PR_SVE_VL_INHERIT | vector_length_bytes) | ||
if return_code < 0: | ||
print(f'Failed to set VL, rc: {return_code}') | ||
sys.exit(1) | ||
set_vector_length = (return_code & PR_SVE_VL_LEN_MASK) * 8 | ||
|
||
if set_vector_length != vector_length: | ||
print( | ||
f"Requested vector length {vector_length} not set, maximum of {set_vector_length} available", | ||
file=sys.stderr) | ||
sys.exit(1) | ||
|
||
if __name__ == '__main__': | ||
if any(arg in ["--help", "-h"] for arg in sys.argv) or len(sys.argv) < 3: | ||
print(f"usage: {sys.argv[0]} [vector_length] [program] [program args]...") | ||
print("\nSet the vector length of this process tree to [vector_length] bits") | ||
print("and then execute [program]") | ||
sys.exit(0) | ||
|
||
set_vector_length(int(sys.argv[1])) | ||
|
||
command = sys.argv[2:] | ||
sys.exit(subprocess.run(command, check=False).returncode) |
This file contains 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,43 @@ | ||
#!/usr/bin/env python3 | ||
|
||
""" | ||
Run a program as a subprocess after configuring the vector length of the | ||
system to match the value in the first argument. | ||
""" | ||
|
||
import ctypes | ||
import subprocess | ||
import sys | ||
|
||
# These constants must match linux/prctl.h | ||
PR_SVE_SET_VL = 50 | ||
PR_SVE_GET_VL = 51 | ||
|
||
PR_SVE_VL_INHERIT = 1 << 17 | ||
PR_SVE_SET_VL_ONEXEC = 1 << 18 | ||
PR_SVE_VL_LEN_MASK = 0xffff | ||
|
||
def set_vector_length(vector_length): | ||
""" | ||
Use Prctl(2) to set the process tree's sve vector length. See | ||
https://man7.org/linux/man-pages/man2/prctl.2.html for more details | ||
""" | ||
libc = ctypes.cdll.LoadLibrary('libc.so.6') | ||
return_code = libc.prctl( | ||
PR_SVE_SET_VL, | ||
PR_SVE_SET_VL_ONEXEC | PR_SVE_VL_INHERIT | vector_length) | ||
if return_code < 0: | ||
print(f'Failed to set VL, rc: {return_code}') | ||
sys.exit(1) | ||
|
||
if __name__ == '__main__': | ||
if any(arg in ["--help", "-h"] for arg in sys.argv) or len(sys.argv) < 3: | ||
print(f"usage: {sys.argv[0]} [vector_length] [program] [program args]...") | ||
print("\nSet the vector length of this process tree to [vector_length]") | ||
print("and then execute [program]") | ||
sys.exit(0) | ||
|
||
set_vector_length(int(sys.argv[1])) | ||
|
||
command = sys.argv[2:] | ||
subprocess.run(command, check=False) |