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

i#6777: AArch64-ci: Add runner for 128 bit sve #6787

Merged
merged 7 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/workflows/ci-aarchxx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,17 @@ jobs:
fail-fast: false
matrix:
# This job will run in parallel.
os: [ubuntu-20-arm64, ubuntu-20-arm64-sve]
include:
- os: ubuntu-20-arm64
sve: false
- os: ubuntu-20-arm64-sve
sve: true
sve_length: 256
- os: ubuntu-20-arm64-sve
sve: true
sve_length: 128
runs-on: ${{ matrix.os }}
name: AArch64 ${{matrix.sve && 'SVE' || ''}} precommit ${{matrix.sve_length}}
steps:
- name: Check out repository code
uses: actions/checkout@v3
Expand Down Expand Up @@ -81,6 +90,14 @@ jobs:
run: ../suite/runsuite_wrapper.pl travis
env:
CI_BRANCH: ${{ github.ref }}
if: ${{ matrix.sve == false || matrix.sve_length == '' }}

- name: Run Suite with sve vector length ${{ matrix.sve_length }}
working-directory: build
run: ../tools/run_with_vector_length.py ${{ matrix.sve_length }} ../suite/runsuite_wrapper.pl travis
env:
CI_BRANCH: ${{ github.ref }}
if: ${{ matrix.sve == true && matrix.sve_length != ''}}

- name: Send failure mail to dynamorio-devs
if: failure() && github.ref == 'refs/heads/master'
Expand Down
2 changes: 1 addition & 1 deletion core/arch/aarch64/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ get_processor_specific_info(void)
* - Release or development test build.
*/
# if !defined(DR_HOST_NOT_TARGET)
if (proc_has_feature(FEATURE_SVE)) {
if (proc_has_feature(FEATURE_SVE) && false) {
uint64 vl;
/* This RDVL instruction is inserted as raw hex because we don't build
* with SVE enabled: i.e. not -march=armv8-a+sve, so that we can run a
Expand Down
34 changes: 34 additions & 0 deletions tools/get_vector_length.py
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()

50 changes: 50 additions & 0 deletions tools/run_with_vector_length.py
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)
43 changes: 43 additions & 0 deletions tools/set_vector_length.py
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)
Loading