Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoopyPyOpenCLTarget: pass through loopy.PyOpenCLTarget #359

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions pytato/target/loopy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,25 @@ class LoopyPyOpenCLTarget(LoopyTarget):

The :mod:`pyopencl` device used to construct the
:class:`loopy.PyOpenCLTarget`, or *None*.

.. attribute:: limit_arg_size_nbytes

An optional int that indicates the size limit of kernel arguments
and gets passed to :class:`loopy.PyOpenCLTarget`.
"""

def __init__(self, device: Optional["pyopencl.Device"] = None):
def __init__(self, device: Optional["pyopencl.Device"] = None,
Copy link
Collaborator Author

@matthiasdiener matthiasdiener Sep 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a new constructor arg that accepts an lp.PyOpenCLTarget()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 2942fbf what you had in mind @inducer?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to be sending you around in circles, but I just realized we don't even need any pytato changes. We can simply subclass LoopyPyOpenCLTarget in the array context and override get_loopy_target there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of inducer/arraycontext@2768fee ?

limit_arg_size_nbytes: Optional[int] = None):
if device is not None:
from warnings import warn
warn("Passing 'device' is deprecated and will stop working in 2023.",
DeprecationWarning, stacklevel=2)
self.limit_arg_size_nbytes = limit_arg_size_nbytes

def get_loopy_target(self) -> "loopy.LoopyPyOpenCLTarget":
import loopy as lp
return lp.PyOpenCLTarget()
return lp.PyOpenCLTarget(
limit_arg_size_nbytes=self.limit_arg_size_nbytes)

def bind_program(self, program: loopy.TranslationUnit,
bound_arguments: Mapping[str, Any]) -> BoundProgram:
Expand Down