diff --git a/pystencils_tests/test_type_interference.py b/pystencils_tests/test_type_interference.py index d240cebcd5b2efe651dd116d67b5d56fdfe0b182..89529f3368ca1bc339e1435002b506c473f29d2d 100644 --- a/pystencils_tests/test_type_interference.py +++ b/pystencils_tests/test_type_interference.py @@ -26,6 +26,8 @@ def test_type_interference(): assert 'const uint16_t f' in code assert 'const int64_t e' in code - assert 'const float d = ((float)(b)) + ((float)(c)) + ((float)(e)) + _data_x_00_10[_stride_x_2*ctr_2];' in code - assert '_data_x_00_10[_stride_x_2*ctr_2] = ((float)(b)) + ((float)(c)) + _data_x_00_10[_stride_x_2*ctr_2];' in code + assert 'const float d = ((float)(b)) + ((float)(c)) + ((float)(e)) + ' \ + '_data_x[_stride_x_0*ctr_0 + _stride_x_1*ctr_1 + _stride_x_2*ctr_2];' in code + assert '_data_x[_stride_x_0*ctr_0 + _stride_x_1*ctr_1 + _stride_x_2*ctr_2] = (' \ + '(float)(b)) + ((float)(c)) + _data_x[_stride_x_0*ctr_0 + _stride_x_1*ctr_1 + _stride_x_2*ctr_2];' in code assert 'const double g = a + ((double)(b)) + ((double)(d));' in code diff --git a/pystencils_tests/test_types.py b/pystencils_tests/test_types.py index 16466df5238dde45ae711e124db451c688182e17..2198e51bfc9f422482e37d609f804ad0ff0f4c1d 100644 --- a/pystencils_tests/test_types.py +++ b/pystencils_tests/test_types.py @@ -185,9 +185,11 @@ def test_integer_comparision(dtype): # There should be an explicit cast for the integer zero to the type of the field on the rhs if dtype == 'float64': - t = "_data_f_00[_stride_f_1*ctr_1] = ((((dir) == (1))) ? (0.0): (_data_f_00[_stride_f_1*ctr_1]));" + t = "_data_f[_stride_f_0*ctr_0 + _stride_f_1*ctr_1] = " \ + "((((dir) == (1))) ? (0.0): (_data_f[_stride_f_0*ctr_0 + _stride_f_1*ctr_1]));" else: - t = "_data_f_00[_stride_f_1*ctr_1] = ((((dir) == (1))) ? (0.0f): (_data_f_00[_stride_f_1*ctr_1]));" + t = "_data_f[_stride_f_0*ctr_0 + _stride_f_1*ctr_1] = " \ + "((((dir) == (1))) ? (0.0f): (_data_f[_stride_f_0*ctr_0 + _stride_f_1*ctr_1]));" assert t in code diff --git a/pystencils_tests/test_vectorization.py b/pystencils_tests/test_vectorization.py index 3ab4bd39090520812042a9434ef6d37e20d13e99..071bc240503a2ecf2729539d8cfb6101ff105ffa 100644 --- a/pystencils_tests/test_vectorization.py +++ b/pystencils_tests/test_vectorization.py @@ -140,7 +140,9 @@ def test_aligned_and_nt_stores(openmp, instruction_set=instruction_set): opt = {'instruction_set': instruction_set, 'assume_aligned': True, 'nontemporal': True, 'assume_inner_stride_one': True} update_rule = [ps.Assignment(f.center(), 0.25 * (g[-1, 0] + g[1, 0] + g[0, -1] + g[0, 1]))] - config = pystencils.config.CreateKernelConfig(target=dh.default_target, cpu_vectorize_info=opt, cpu_openmp=openmp) + # Without the base pointer spec, the inner store is not aligned + config = pystencils.config.CreateKernelConfig(target=dh.default_target, cpu_vectorize_info=opt, cpu_openmp=openmp, + base_pointer_specification=[['spatialInner0']]) ast = ps.create_kernel(update_rule, config=config) if instruction_set in ['sse'] or instruction_set.startswith('avx'): assert 'stream' in ast.instruction_set diff --git a/pystencils_tests/test_vectorization_specific.py b/pystencils_tests/test_vectorization_specific.py index 46e13c2d7f59bfaa9fa50f5e3d8632da3c1a25ac..610f671e7163ea7885ac1d2f43e7f78c96fab8ac 100644 --- a/pystencils_tests/test_vectorization_specific.py +++ b/pystencils_tests/test_vectorization_specific.py @@ -116,7 +116,8 @@ def test_alignment_and_correct_ghost_layers(gl_field, gl_kernel, instruction_set opt = {'instruction_set': instruction_set, 'assume_aligned': True, 'nontemporal': True, 'assume_inner_stride_one': True} config = pystencils.config.CreateKernelConfig(target=dh.default_target, - cpu_vectorize_info=opt, ghost_layers=gl_kernel) + cpu_vectorize_info=opt, ghost_layers=gl_kernel, + base_pointer_specification=[['spatialInner0']]) ast = ps.create_kernel(update_rule, config=config) kernel = ast.compile() if gl_kernel != gl_field: