From 5aa9f1f868c09d4c97d1fb29306427bba5298ed4 Mon Sep 17 00:00:00 2001 From: dialecticDolt Date: Fri, 5 Jan 2024 10:24:14 -0600 Subject: [PATCH 1/4] test: PyBind11 GIL release --- pykokkos/core/translators/bindings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pykokkos/core/translators/bindings.py b/pykokkos/core/translators/bindings.py index cf9b21ca..afd8fc0d 100644 --- a/pykokkos/core/translators/bindings.py +++ b/pykokkos/core/translators/bindings.py @@ -416,7 +416,7 @@ def bind_wrappers(module: str, wrappers: List[str]) -> str: variable: str = "k" binding: str = f"PYBIND11_MODULE({module}, {variable}) {{" for w in wrappers: - binding += f"{variable}.def(\"{w}\", &{w});" + binding += f"{variable}.def(\"{w}\", &{w}, py::call_guard());" binding += "}" return binding From 308494a443aef76c06f1cc9cc6e7b3bf49823932 Mon Sep 17 00:00:00 2001 From: dialecticDolt Date: Fri, 5 Jan 2024 10:39:55 -0600 Subject: [PATCH 2/4] test: release gil --- pykokkos/core/translators/bindings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pykokkos/core/translators/bindings.py b/pykokkos/core/translators/bindings.py index afd8fc0d..8650b883 100644 --- a/pykokkos/core/translators/bindings.py +++ b/pykokkos/core/translators/bindings.py @@ -416,7 +416,7 @@ def bind_wrappers(module: str, wrappers: List[str]) -> str: variable: str = "k" binding: str = f"PYBIND11_MODULE({module}, {variable}) {{" for w in wrappers: - binding += f"{variable}.def(\"{w}\", &{w}, py::call_guard());" + binding += f"{variable}.def(\"{w}\", &{w}, pybind11::call_guard());" binding += "}" return binding From 48b5775cc1a499bc1f5804660e487c97629a5608 Mon Sep 17 00:00:00 2001 From: dialecticDolt Date: Fri, 5 Jan 2024 11:06:17 -0600 Subject: [PATCH 3/4] test: release inside kernel --- pykokkos/core/translators/bindings.py | 6 +++--- pykokkos/core/translators/static.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pykokkos/core/translators/bindings.py b/pykokkos/core/translators/bindings.py index 8650b883..f8884a05 100644 --- a/pykokkos/core/translators/bindings.py +++ b/pykokkos/core/translators/bindings.py @@ -174,8 +174,8 @@ def generate_functor_instance(functor: str, members: PyKokkosMembers, with_rando constructor: str = f"{functor} {Keywords.Instance.value}" constructor += "(" + ",".join(args) + ");" - - return mirror_views + constructor + gil_release = "pybind11::gil_scoped_release release;" + return gil_release + mirror_views + constructor def generate_copy_back_from_dict(members: PyKokkosMembers,deep_copy_args: Dict[str,str]) -> str: """ @@ -416,7 +416,7 @@ def bind_wrappers(module: str, wrappers: List[str]) -> str: variable: str = "k" binding: str = f"PYBIND11_MODULE({module}, {variable}) {{" for w in wrappers: - binding += f"{variable}.def(\"{w}\", &{w}, pybind11::call_guard());" + binding += f"{variable}.def(\"{w}\", &{w});" binding += "}" return binding diff --git a/pykokkos/core/translators/static.py b/pykokkos/core/translators/static.py index 61977379..697d6222 100644 --- a/pykokkos/core/translators/static.py +++ b/pykokkos/core/translators/static.py @@ -258,7 +258,7 @@ def generate_includes(self) -> str: self.functor_cast ] headers = [f"#include <{h}>\n" for h in headers] - + #TODO(wlr): Add MACRO return "".join(headers) def generate_cast_includes(self) -> str: From 7f09795de6a8e96d8a4c832fb9f561104fd2850a Mon Sep 17 00:00:00 2001 From: dialecticDolt Date: Fri, 5 Jan 2024 11:27:31 -0600 Subject: [PATCH 4/4] clean: remove comment --- pykokkos/core/translators/static.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pykokkos/core/translators/static.py b/pykokkos/core/translators/static.py index 697d6222..61977379 100644 --- a/pykokkos/core/translators/static.py +++ b/pykokkos/core/translators/static.py @@ -258,7 +258,7 @@ def generate_includes(self) -> str: self.functor_cast ] headers = [f"#include <{h}>\n" for h in headers] - #TODO(wlr): Add MACRO + return "".join(headers) def generate_cast_includes(self) -> str: