Skip to content

Commit

Permalink
Merge pull request #67 from SeisSol/macos
Browse files Browse the repository at this point in the history
Add apple-m1/apple-m2 support
  • Loading branch information
davschneller authored Sep 22, 2023
2 parents 0770647 + f9bb075 commit e681323
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions yateto/arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def getArchitectureIdentifiedBy(ident):
'a64fx': Architecture(name, precision, 64, True),
'neon': Architecture(name, precision, 16, False),
'apple-m1': Architecture(name, precision, 16, False),
'apple-m2': Architecture(name, precision, 16, False),
'sve128': Architecture(name, precision, 16, False),
'sve256': Architecture(name, precision, 32, False),
'sve512': Architecture(name, precision, 64, False),
Expand Down
2 changes: 1 addition & 1 deletion yateto/codegen/gemm/gemmgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def _kernel(self, routine_name):
#flags += ["LIBXSMM_GEMM_FLAG_ALIGN_C"]
libxsmm_flag_str = " | ".join(flags)

prefetch_flag = "LIBXSMM_GEMM_PREFETCH_SIGONLY" if not self._arch.enablePrefetch else "LIBXSMM_GEMM_PREFETCH_BL2_VIA_C"
prefetch_flag = "LIBXSMM_GEMM_PREFETCH_NONE" if not self._arch.enablePrefetch else "LIBXSMM_GEMM_PREFETCH_BL2_VIA_C"

kernel_var_name = f'{routine_name}_var'
return """
Expand Down
6 changes: 4 additions & 2 deletions yateto/gemm_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def preference(self, m, n, k, sparseA, sparseB, transA, transB, alpha, beta, ali
return Preference.LOW

def _archSupported(self):
supported_set = {'noarch', 'wsm', 'snb', 'hsw', 'skx', 'knc', 'knl', 'naples', 'rome', 'milan', 'bergamo', "a64fx", "thunderx2t99", 'neon', 'sve128', 'sve256', 'sve512', 'apple-m1'}
supported_set = {'noarch', 'wsm', 'snb', 'hsw', 'skx', 'knc', 'knl', 'naples', 'rome', 'milan', 'bergamo', "a64fx", "thunderx2t99", 'neon', 'sve128', 'sve256', 'sve512', 'apple-m1', "apple-m2"}

if self._arch.name.lower() in supported_set:
return True
Expand Down Expand Up @@ -210,7 +210,7 @@ def __init__(self, arch, cmd: str = 'pspamm.py', threshold: int = 128):
self._threshold = threshold

def _archSupported(self):
supported_set = {'thunderx2t99', 'knl', 'skx', 'a64fx', 'hsw', 'naples', 'rome', 'milan', 'bergamo', 'neon', 'sve128', 'sve256', 'sve512', 'sve1024', 'sve2048', 'apple-m1'}
supported_set = {'thunderx2t99', 'knl', 'skx', 'a64fx', 'hsw', 'naples', 'rome', 'milan', 'bergamo', 'neon', 'sve128', 'sve256', 'sve512', 'sve1024', 'sve2048', 'apple-m1', 'apple-m2'}
if self._arch.name.lower() in supported_set:
return True
else:
Expand Down Expand Up @@ -303,6 +303,8 @@ def __init__(self, arch):
'knl' : [libxsmm_jit, libxsmm, pspamm, mkl, blis, eigen],
'skx' : [libxsmm_jit, libxsmm, pspamm, mkl, blis, eigen],
'thunderx2t99' : [libxsmm_jit, pspamm, openblas, blis, eigen],
'apple-m1' : [libxsmm_jit, pspamm, openblas, blis, eigen],
'apple-m2' : [libxsmm_jit, pspamm, openblas, blis, eigen],
'a64fx' : [libxsmm_jit, pspamm, openblas, blis, eigen],
'neon' : [libxsmm_jit, pspamm, openblas, blis, eigen],
'sve128' : [libxsmm_jit, pspamm, openblas, blis, eigen],
Expand Down
4 changes: 2 additions & 2 deletions yateto/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def create_collection(matrices):
def tensor_from_constant_expression(name: str,
expression,
target_indices: Indices = None,
dtype: dtype = np.float128,
dtype: dtype = np.longdouble,
tensor_args: dict = dict()):
"""
Computes the result of an expression and returns
Expand Down Expand Up @@ -55,7 +55,7 @@ def tensor_collection_from_constant_expression(base_name: str,
expressions,
group_indices,
target_indices: Indices = None,
dtype=np.float128,
dtype=np.longdouble,
tensor_args: dict = {}):
"""
Computes the result of an expression group and returns
Expand Down

0 comments on commit e681323

Please sign in to comment.