Skip to content
Snippets Groups Projects
Commit 136f7c95 authored by Markus Holzer's avatar Markus Holzer
Browse files

Fix Neon vector instruction set

parent d0cd8252
No related merge requests found
......@@ -98,12 +98,13 @@ def get_cacheline_size(instruction_set):
return _cachelinesize
import pystencils as ps
from pystencils.astnodes import SympyAssignment
import numpy as np
from pystencils.cpu.vectorization import CachelineSize
arr = np.zeros((1, 1), dtype=np.float32)
f = ps.Field.create_from_numpy_array('f', arr, index_dimensions=0)
ass = [CachelineSize(), ps.Assignment(f.center, CachelineSize.symbol)]
ass = [CachelineSize(), SympyAssignment(f.center, CachelineSize.symbol)]
ast = ps.create_kernel(ass, cpu_vectorize_info={'instruction_set': instruction_set})
kernel = ast.compile()
kernel(**{f.name: arr, CachelineSize.symbol.name: 0})
......
......@@ -254,7 +254,7 @@ def insert_vector_casts(ast_node, instruction_set, default_float_type='double'):
"""Inserts necessary casts from scalar values to vector values."""
handled_functions = (sp.Add, sp.Mul, fast_division, fast_sqrt, fast_inv_sqrt, vec_any, vec_all, DivFunc,
sp.UnevaluatedExpr)
sp.UnevaluatedExpr, sp.Abs)
def visit_expr(expr, default_type='double'): # TODO get rid of default_type
if isinstance(expr, VectorMemoryAccess):
......
......@@ -42,7 +42,8 @@ def test_vector_type_propagation(instruction_set=instruction_set):
np.testing.assert_equal(dst[1:-1, 1:-1], 2 * 10.0 + 3)
def test_aligned_and_nt_stores(instruction_set=instruction_set, openmp=False):
@pytest.mark.parametrize('openmp', [True, False])
def test_aligned_and_nt_stores(openmp, instruction_set=instruction_set):
domain_size = (24, 24)
# create a datahandling object
dh = ps.create_data_handling(domain_size, periodicity=(True, True), parallel=False, default_target=Target.CPU)
......@@ -76,10 +77,6 @@ def test_aligned_and_nt_stores(instruction_set=instruction_set, openmp=False):
np.testing.assert_equal(np.sum(dh.cpu_arrays['f']), np.prod(domain_size))
def test_aligned_and_nt_stores_openmp(instruction_set=instruction_set):
test_aligned_and_nt_stores(instruction_set, True)
def test_inplace_update(instruction_set=instruction_set):
shape = (9, 9, 3)
arr = np.ones(shape, order='f')
......
......@@ -128,7 +128,7 @@ def test_cacheline_size(instruction_set):
@pytest.mark.parametrize('instruction_set',
sorted(set(supported_instruction_sets) - {test_vectorization.instruction_set}))
@pytest.mark.parametrize('function',
[f for f in test_vectorization.__dict__ if f.startswith('test_') and f != 'test_hardware_query'])
[f for f in test_vectorization.__dict__ if f.startswith('test_') and f not in ['test_hardware_query', 'test_aligned_and_nt_stores']])
def test_vectorization_other(instruction_set, function):
test_vectorization.__dict__[function](instruction_set)
......
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