Skip to content

Commit

Permalink
arch: switch sycl error to warning for no-compile codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Jan 21, 2025
1 parent b981be0 commit 5874852
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
4 changes: 2 additions & 2 deletions devito/arch/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ def __init_finalize__(self, **kwargs):
language = kwargs.pop('language', configuration['language'])

if language == 'sycl':
raise ValueError("Use SyclCompiler to jit-compile sycl")
warning("Use SyclCompiler to jit-compile sycl")

elif language == 'openmp':
# Earlier versions to OneAPI 2023.2.0 (clang17 underneath), have an
Expand Down Expand Up @@ -894,7 +894,7 @@ def __init_finalize__(self, **kwargs):
language = kwargs.pop('language', configuration['language'])

if language != 'sycl':
raise ValueError("Expected language sycl with SyclCompiler")
warning("Expected language sycl with SyclCompiler")

self.cflags.remove('-std=c99')
self.cflags.append('-fsycl')
Expand Down
6 changes: 3 additions & 3 deletions devito/passes/iet/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@


@iet_pass
def _complex_includes(iet: Callable, lang: type[LangBB] = None,
compiler: Compiler = None) -> tuple[Callable, dict]:
def _complex_includes(iet: Callable, lang: type[LangBB], compiler: Compiler,
sregistry: SymbolRegistry) -> tuple[Callable, dict]:
"""
Includes complex arithmetic headers for the given language, if needed.
"""
Expand Down Expand Up @@ -59,4 +59,4 @@ def lower_dtypes(graph: Callable, lang: type[LangBB] = None, compiler: Compiler
"""

for dtype_pass in dtype_passes:
dtype_pass(graph, lang=lang, compiler=compiler)
dtype_pass(graph, lang=lang, compiler=compiler, sregistry=sregistry)
4 changes: 2 additions & 2 deletions devito/passes/iet/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,10 @@ def _(expr, lang):


@_lower_macro_math.register(SafeInv)
def _(expr):
def _(expr, lang):
eps = np.finfo(np.float32).resolution**2
return (('SAFEINV(a, b)',
f'(((a) < {eps} || (b) < {eps}) ? (0.0F) : (1.0F / (a)))'),)
f'(((a) < {eps} || (b) < {eps}) ? (0.0F) : (1.0F / (a)))'),), {}


@iet_pass
Expand Down
8 changes: 2 additions & 6 deletions devito/symbolics/extended_sympy.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,11 @@ class Cast(UnaryOp):
__rkwargs__ = ('stars', 'dtype')

def __new__(cls, base, dtype=None, stars=None, **kwargs):
# Attempt simplifcation
# E.g., `FLOAT(32) -> 32.0` of type `sympy.Float`
try:
if isinstance(dtype, str):
return sympify(eval(dtype)(base))
else:
return sympify(dtype(base))
base = sympify(dtype(base))
except (NameError, SyntaxError):
# E.g., `_base_typ` is "char" or "unsigned long"
# E.g., `dtype` is "char" or "unsigned long"
pass
except (ValueError, TypeError):
# `base` ain't a number
Expand Down

0 comments on commit 5874852

Please sign in to comment.