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

actx.tag() comes too late to benefit eager mode execution #5

Open
inducer opened this issue May 1, 2021 · 4 comments
Open

actx.tag() comes too late to benefit eager mode execution #5

inducer opened this issue May 1, 2021 · 4 comments

Comments

@inducer
Copy link
Owner

inducer commented May 1, 2021

For lazy mode, actx.tag(MyTag(), 2*x+3) works great. For eager mode, this doesn't help at all, as the result will already be computed (i.e. the kernel whose transformation would have benefited from the metadata was already executed). Is there a tagging interface that can work for both eager and lazy?

cc @alexfikl @thomasgibson @nchristensen @kaushikcfd

x-ref: inducer/meshmode#176

@thomasgibson
Copy link
Collaborator

This is more or less kinda what I was trying (albeit rushed/incomplete) in inducer/meshmode#170 --- Based on your comments there, I can imagine that one would tag information to a loopy program "as you go", which can then be transformed based on said information in transform_loopy_kernel. This is assuming that, when doing any kind of eager evaluation, it always ends up going through actx.call_loopy.

Obviously with eager this would be somewhat limited (since results are computed as you go), but some level of code transformation can and should happen along the way.

With lazy, this information just gets propogated through until evaluation is needed, and so I imagine these transformations will occur at the pytato level.

@thomasgibson
Copy link
Collaborator

thomasgibson commented May 1, 2021

In short, I think tagging can still work for eager.

Update: Unless I am fundamentally misunderstanding something. I guess what I'm wondering is, if all expressions (whether eager or lazy) go through transform_loopy_kernel, then what can we do to potentially take advantage of this?

@inducer
Copy link
Owner Author

inducer commented May 3, 2021

if all expressions (whether eager or lazy) go through transform_loopy_kernel, then what can we do to potentially take advantage of this?

My thought was that lazy would bypass transform_loopy_kernel mostly. And much of eager (specifically the array arithmetic) also directly uses PyOpenCL array arithmetic and bypasses transform_loopy_kernel.

@inducer
Copy link
Owner Author

inducer commented May 3, 2021

In short, I think tagging can still work for eager.

I agree that it can, but what this issue is about is the method actx.tag, whose job it is to apply a tag to an array result. The complaint is that it'll only work for lazy.

@inducer inducer transferred this issue from inducer/meshmode May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants