Skip to content
Snippets Groups Projects

Make RNG vectorization more robust

Merged Michael Kuron requested to merge vectorization into master
1 file
+ 2
2
Compare changes
  • Side-by-side
  • Inline
+ 2
2
@@ -2,7 +2,7 @@ import copy
@@ -2,7 +2,7 @@ import copy
import numpy as np
import numpy as np
import sympy as sp
import sympy as sp
from pystencils.data_types import TypedSymbol
from pystencils.data_types import TypedSymbol, cast_func
from pystencils.astnodes import LoopOverCoordinate
from pystencils.astnodes import LoopOverCoordinate
from pystencils.backends.cbackend import CustomCodeNode
from pystencils.backends.cbackend import CustomCodeNode
from pystencils.sympyextensions import fast_subs
from pystencils.sympyextensions import fast_subs
@@ -47,7 +47,7 @@ class RNGBase(CustomCodeNode):
@@ -47,7 +47,7 @@ class RNGBase(CustomCodeNode):
def get_code(self, dialect, vector_instruction_set, print_arg):
def get_code(self, dialect, vector_instruction_set, print_arg):
code = "\n"
code = "\n"
for r in self.result_symbols:
for r in self.result_symbols:
if vector_instruction_set and isinstance(self.args[1], sp.Integer):
if vector_instruction_set and not self.args[1].atoms(cast_func):
# this vector RNG has become scalar through substitution
# this vector RNG has become scalar through substitution
code += f"{r.dtype} {r.name};\n"
code += f"{r.dtype} {r.name};\n"
else:
else:
Loading