Skip to content
Snippets Groups Projects
Commit 1c89555f authored by Frederik Hennig's avatar Frederik Hennig
Browse files

Revert "fix testsuite for ARM on Apple M1"

This reverts commit 7e38e676
parent 7e38e676
No related branches found
No related tags found
No related merge requests found
Pipeline #79707 passed
......@@ -17,8 +17,6 @@ import pytest
from types import ModuleType
import pystencils as ps
from pystencils.jit import CpuJit
from pystencils.jit.cpu import GccInfo
AVAILABLE_TARGETS = ps.Target.available_targets()
TARGET_IDS = [t.name for t in AVAILABLE_TARGETS]
......@@ -31,18 +29,7 @@ def target(request) -> ps.Target:
@pytest.fixture
def cpujit(target: ps.Target, tmp_path) -> CpuJit:
# Set target in compiler info such that `-march` is set accordingly
cinfo = GccInfo(target=target)
return CpuJit(
compiler_info=cinfo,
objcache=tmp_path
)
@pytest.fixture
def gen_config(request: pytest.FixtureRequest, target: ps.Target, cpujit: CpuJit):
def gen_config(request: pytest.FixtureRequest, target: ps.Target, tmp_path):
"""Default codegen configuration for the current target.
For GPU targets, set default indexing options.
......@@ -56,7 +43,15 @@ def gen_config(request: pytest.FixtureRequest, target: ps.Target, cpujit: CpuJit
gen_config.cpu.vectorize.assume_inner_stride_one = True
if target.is_cpu():
gen_config.jit = cpujit
from pystencils.jit.cpu import CpuJit, GccInfo
# Set target in compiler info such that `-march` is set accordingly
cinfo = GccInfo(target=target)
gen_config.jit = CpuJit(
compiler_info=cinfo,
objcache=tmp_path
)
return gen_config
......
......@@ -4,26 +4,16 @@ import platform
import numpy as np
import pystencils as ps
from pystencils.jit.cpu import CpuJit, ClangInfo
@pytest.fixture
def cpujit(target: ps.Target, tmp_path) -> CpuJit:
# Set target in compiler info such that `-march` is set accordingly
cinfo = ClangInfo(target=target)
return CpuJit(
compiler_info=cinfo,
objcache=tmp_path
)
@pytest.mark.parametrize('target', (ps.Target.CPU, ps.Target.CurrentGPU))
def test_half_precison(target, cpujit):
def test_half_precison(target):
if target == ps.Target.CPU:
if not platform.machine() in ['arm64', 'aarch64']:
pytest.xfail("skipping half precision test on non arm platform")
if 'clang' not in ps.cpu.cpujit.get_compiler_config()['command']:
pytest.xfail("skipping half precision because clang compiler is not used")
if target.is_gpu():
pytest.importorskip("cupy")
......@@ -40,7 +30,6 @@ def test_half_precison(target, cpujit):
up = ps.Assignment(f3.center, f1.center + 2.1 * f2.center)
config = ps.CreateKernelConfig(target=dh.default_target, default_dtype=np.float32)
config.jit = cpujit
ast = ps.create_kernel(up, config=config)
kernel = ast.compile()
......
......@@ -144,7 +144,7 @@ def create_vector_kernel(
cinfo = GccInfo(target=setup.target)
kfactory = KernelFactory(ctx)
kernel = kfactory.create_generic_kernel(
func = kfactory.create_generic_kernel(
platform,
PsBlock([loop_nest]),
"vector_kernel",
......@@ -152,6 +152,7 @@ def create_vector_kernel(
CpuJit(cinfo),
)
kernel = func.compile()
return kernel
......@@ -173,7 +174,7 @@ def test_update_kernel(vectorization_setup: VectorTestSetup, ghost_layers: int):
Assignment(dst.center(3), x[3]),
]
kernel = create_vector_kernel(update, src, setup, ghost_layers).compile()
kernel = create_vector_kernel(update, src, setup, ghost_layers)
shape = (23, 17)
......@@ -219,7 +220,7 @@ def test_trailing_iterations(vectorization_setup: VectorTestSetup):
update = [Assignment(f(0), 2 * f(0))]
kernel = create_vector_kernel(update, f, setup).compile()
kernel = create_vector_kernel(update, f, setup)
for trailing_iters in range(setup.lanes):
shape = (setup.lanes * 12 + trailing_iters, 1)
......@@ -240,7 +241,7 @@ def test_only_trailing_iterations(vectorization_setup: VectorTestSetup):
update = [Assignment(f(0), 2 * f(0))]
kernel = create_vector_kernel(update, f, setup).compile()
kernel = create_vector_kernel(update, f, setup)
for trailing_iters in range(1, setup.lanes):
shape = (trailing_iters, 1)
......@@ -261,7 +262,7 @@ def test_set(vectorization_setup: VectorTestSetup):
update = [Assignment(f(0), DEFAULTS.spatial_counters[0])]
kernel = create_vector_kernel(update, f, setup).compile()
kernel = create_vector_kernel(update, f, setup)
shape = (23, 1)
f_arr = create_numpy_array_with_layout(
......@@ -309,7 +310,7 @@ def test_strided_load(vectorization_setup: VectorTestSetup, int_or_float):
)
]
kernel = create_vector_kernel(update, f, setup).compile()
kernel = create_vector_kernel(update, f, setup)
f_shape = (21, 17)
f_arr = create_numpy_array_with_layout(
......@@ -387,11 +388,10 @@ def test_strided_store(vectorization_setup: VectorTestSetup, int_or_float):
scatter_pattern = f"{prefix}_i{setup.type_width}scatter_{suffix}" + r"\(.*,.*,.*,\s*" + str(setup.type_width // 8) + r"\);"
assert len(re.findall(scatter_pattern, kernel.get_c_code())) == 3
assert len(re.findall(scatter_pattern, kernel.code)) == 3
if Target.X86_AVX512 in Target.available_vector_cpu_targets():
# We don't have AVX512 CPUs on the CI runners
kernel = kernel.compile()
f_shape = (21, 17)
f_arr = create_numpy_array_with_layout(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment