From e390b53b1f126736ec65fa580edb1b3b5a47f2f1 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 21 Oct 2024 21:24:38 -0500 Subject: [PATCH] RecursiveMapper -> Mapper --- loopy/expression.py | 4 ++-- loopy/target/c/codegen/expression.py | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/loopy/expression.py b/loopy/expression.py index 224521b03..2581ec022 100644 --- a/loopy/expression.py +++ b/loopy/expression.py @@ -23,7 +23,7 @@ import numpy as np -from pymbolic.mapper import RecursiveMapper +from pymbolic.mapper import Mapper from loopy.codegen import UnvectorizableError from loopy.diagnostic import LoopyError @@ -55,7 +55,7 @@ def dtype_to_type_context(target, dtype): # {{{ vectorizability checker -class VectorizabilityChecker(RecursiveMapper): +class VectorizabilityChecker(Mapper): """The return value from this mapper is a :class:`bool` indicating whether the result of the expression is vectorized along :attr:`vec_iname`. If the expression is not vectorizable, the mapper raises diff --git a/loopy/target/c/codegen/expression.py b/loopy/target/c/codegen/expression.py index 276407fc1..810ac4379 100644 --- a/loopy/target/c/codegen/expression.py +++ b/loopy/target/c/codegen/expression.py @@ -28,7 +28,7 @@ import islpy as isl import pymbolic.primitives as p from pymbolic import var -from pymbolic.mapper import IdentityMapper, RecursiveMapper +from pymbolic.mapper import IdentityMapper, Mapper from pymbolic.mapper.stringifier import ( PREC_BITWISE_AND, PREC_BITWISE_OR, @@ -124,9 +124,8 @@ def wrap_in_typecast(self, actual_type: LoopyType, needed_type: LoopyType, s): return s - def rec(self, expr, type_context=None, needed_type: Optional[LoopyType] = None): - result = RecursiveMapper.rec(self, expr, type_context) - + def rec(self, expr, type_context=None, needed_type: Optional[LoopyType] = None): # type: ignore[override] + result = Mapper.rec(self, expr, type_context) if needed_type is None: return result else: @@ -604,7 +603,7 @@ def map_nan(self, expr, type_context): # {{{ C expression to code mapper -class CExpressionToCodeMapper(RecursiveMapper): +class CExpressionToCodeMapper(Mapper): # {{{ helpers