From 59fce827be8d747ca979c884ee7d73b48b0ffe58 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Thu, 7 May 2020 14:50:09 +0100 Subject: [PATCH 1/3] codegen: emit stdbool.h and complex.h when appropriate in C99 mode --- loopy/target/c/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/loopy/target/c/__init__.py b/loopy/target/c/__init__.py index 01d26dd82..f187ca859 100644 --- a/loopy/target/c/__init__.py +++ b/loopy/target/c/__init__.py @@ -80,6 +80,11 @@ class DTypeRegistryWrapper(object): def c99_preamble_generator(preamble_info): if any(dtype.is_integral() for dtype in preamble_info.seen_dtypes): yield("10_stdint", "#include ") + if any(dtype.numpy_dtype == np.dtype("bool") + for dtype in preamble_info.seen_dtypes): + yield("10_stdbool", "#include ") + if any(dtype.is_complex() for dtype in preamble_info.seen_dtypes): + yield("10_complex", "#include ") def _preamble_generator(preamble_info): -- GitLab From 90f5b92f7f3ebd39daab449f5bce47ee14b61139 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Thu, 7 May 2020 14:50:45 +0100 Subject: [PATCH 2/3] codegen: Register C99 complex types in CTarget --- loopy/target/c/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/loopy/target/c/__init__.py b/loopy/target/c/__init__.py index f187ca859..8869ebecf 100644 --- a/loopy/target/c/__init__.py +++ b/loopy/target/c/__init__.py @@ -1084,9 +1084,11 @@ class CTarget(CFamilyTarget): @memoize_method def get_dtype_registry(self): from loopy.target.c.compyte.dtypes import ( - DTypeRegistry, fill_registry_with_c99_stdint_types) + DTypeRegistry, fill_registry_with_c99_stdint_types, + fill_registry_with_c99_complex_types) result = DTypeRegistry() fill_registry_with_c99_stdint_types(result) + fill_registry_with_c99_complex_types(result) return DTypeRegistryWrapper(result) -- GitLab From 27c3e8d379658e0963acda58024c08b666811850 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Thu, 7 May 2020 14:51:02 +0100 Subject: [PATCH 3/3] codegen: Update compyte --- loopy/target/c/compyte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopy/target/c/compyte b/loopy/target/c/compyte index 25ee8b48f..7e48e1166 160000 --- a/loopy/target/c/compyte +++ b/loopy/target/c/compyte @@ -1 +1 @@ -Subproject commit 25ee8b48fd0c7d9f0bd987c6862cdb1884fb1372 +Subproject commit 7e48e1166a13cfbb7b60f909b071f088034ffda1 -- GitLab