diff --git a/loopy/kernel/creation.py b/loopy/kernel/creation.py index a50d797fea41ad60a44af1264457819e0680cea1..dcac16479e368908f50f5dff1ef0f4c0edcc3e7b 100644 --- a/loopy/kernel/creation.py +++ b/loopy/kernel/creation.py @@ -51,9 +51,14 @@ logger = logging.getLogger(__name__) _IDENTIFIER_RE = re.compile(r"\b([a-zA-Z_][a-zA-Z0-9_]*)\b") +# source: check_keywords() in isl_stream.c, ISL version 0.17 +_ISL_KEYWORDS = frozenset(""" + exists and or implies not infty infinity NaN min max rat true false ceild + floord mod ceil floor""".split()) + def _gather_isl_identifiers(s): - return set(_IDENTIFIER_RE.findall(s)) - set(["and", "or", "exists"]) + return set(_IDENTIFIER_RE.findall(s)) - _ISL_KEYWORDS class UniqueName: diff --git a/test/test_loopy.py b/test/test_loopy.py index d0398f216a7f85798bc5f125e353578e74765b9f..4a0e312436dd218ee5090dd4f334edc375afd5f7 100644 --- a/test/test_loopy.py +++ b/test/test_loopy.py @@ -2526,6 +2526,11 @@ def test_fixed_parameters(ctx_factory): knl(queue) +def test_parameter_inference(): + knl = lp.make_kernel("{[i]: 0 <= i < n and i mod 2 = 0}", "") + assert knl.all_params() == set(["n"]) + + def test_execution_backend_can_cache_dtypes(ctx_factory): # When the kernel is invoked, the execution backend uses it as a cache key # for the type inference and scheduling cache. This tests to make sure that