Skip to content

Fix RNG vectorization for LB

Michael Kuron requested to merge random-vectorization into master

Reported by @RudolfWeeber. Not sure why it wasn't caught by the pycodegen nightly job. Added new tests to lbmpy in lbmpy!82 (merged).

Forgotten type check in _print_Function:

  File "pystencils/pystencils/backends/cbackend.py", line 673, in _print_Function
    (isinstance(arg, TypedSymbol) and arg.dtype.is_int())
AttributeError: 'VectorType' object has no attribute 'is_int'

Generation of invalid tail loops when assume_sufficient_line_padding=False:

_data_pdfs_tmp_20_30_10[ctr_0] = _mm256_add_pd(_mm256_add_pd(_mm256_add_pd(_mm256_add_pd(_mm256_add_pd(_mm256_add_pd(_mm256_add_pd(_mm256_add_pd(_mm256_add_pd(_mm256_mul_pd(xi_88,_mm256_set_pd(0.142857142857143,0.142857142857143,0.142857142857143,0.142857142857143)),_mm256_mul_pd(xi_89,_mm256_set_pd(0.2,0.2,0.2,0.2))),_mm256_mul_pd(xi_91,_mm256_set_pd(-1.0,-1.0,-1.0,-1.0))),_mm256_mul_pd(xi_92,_mm256_set_pd(0.0857142857142857,0.0857142857142857,0.0857142857142857,0.0857142857142857))),_mm256_set_pd(xi_108*-0.5,xi_108*-0.5,xi_108*-0.5,xi_108*-0.5)),_mm256_set_pd(xi_112*0.0238095238095238,xi_112*0.0238095238095238,xi_112*0.0238095238095238,xi_112*0.0238095238095238)),_mm256_set_pd(xi_95*0.1,xi_95*0.1,xi_95*0.1,xi_95*0.1)),_mm256_set_pd(xi_98*0.0428571428571429,xi_98*0.0428571428571429,xi_98*0.0428571428571429,xi_98*0.0428571428571429)),_mm256_set_pd(_data_pdfs_20_30_10[ctr_0],_data_pdfs_20_30_10[ctr_0],_data_pdfs_20_30_10[ctr_0],_data_pdfs_20_30_10[ctr_0])),_mm256_set_pd(forceTerm_0,forceTerm_0,forceTerm_0,forceTerm_0));

Generation of partially-vectorized code with assume_inner_stride_is_one=False in conjunction with the random number generator:

const double xi_22 = -xi_64 + xi_66;                                                                                                                             
const float64x2_t xi_26 = vaddq_f64(random_1_1,vdupq_n_f64(-0.5)); 
Edited by Michael Kuron

Merge request reports