Skip to content
Snippets Groups Projects
Commit 6d6b2f03 authored by Michael Kuron's avatar Michael Kuron :mortar_board: Committed by Michael Kuron
Browse files

Remove support for non-power-of-2 SVE vector widths

parent 967a5579
No related merge requests found
Pipeline #52036 canceled with stages
in 27 seconds
This commit is part of merge request !325. Comments created here will be created in the context of that merge request.
......@@ -175,7 +175,8 @@ arm64v9:
extends: .multiarch_template
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/arm64
variables:
PYSTENCILS_SIMD: "sve256,sve512,sve"
PYSTENCILS_SIMD: "sve128,sve256,sve512,sve1024,sve2048,sve"
QEMU_CPU: "max,sve-default-vector-length=-1"
before_script:
- *multiarch_before_script
- sed -i s/march=native/march=armv8-a+sve/g ~/.config/pystencils/config.json
......
......@@ -151,9 +151,7 @@ def get_vector_instruction_set_arm(data_type='double', instruction_set='neon'):
result['any'] = f'vaddlvq_u8(vreinterpretq_u8_u{bits[data_type]}({{0}})) > 0'
result['all'] = f'vaddlvq_u8(vreinterpretq_u8_u{bits[data_type]}({{0}})) == 16*0xff'
if instruction_set == 'sve' or bitwidth & (bitwidth - 1) == 0:
# only power-of-2 vector sizes will evenly divide a cacheline
result['cachelineSize'] = 'cachelineSize()'
result['cachelineZero'] = 'cachelineZero((void*) {0})'
result['cachelineSize'] = 'cachelineSize()'
result['cachelineZero'] = 'cachelineZero((void*) {0})'
return result
import math
import os
import platform
from ctypes import CDLL
......@@ -86,15 +85,12 @@ def get_supported_instruction_sets():
if flags.issuperset(required_sve_flags):
if platform.system() == 'Linux':
libc = CDLL('libc.so.6')
native_length = 8 * libc.prctl(51, 0, 0, 0, 0) # PR_SVE_GET_VL
if native_length < 0:
length = 8 * libc.prctl(51, 0, 0, 0, 0) # PR_SVE_GET_VL
if length < 0:
raise OSError("SVE length query failed")
pwr2_length = int(2**math.floor(math.log2(native_length)))
if pwr2_length % 256 == 0:
result.append(f"sve{pwr2_length//2}")
if native_length != pwr2_length:
result.append(f"sve{pwr2_length}")
result.append(f"sve{native_length}")
while length > 128:
result.append(f"sve{length}")
length //= 2
result.append("sve")
return result
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment