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

[Substrait] Implement first version of NamedTableOp. #797

Merged
merged 12 commits into from
Mar 20, 2024

Conversation

ingomueller-net
Copy link
Collaborator

@ingomueller-net ingomueller-net commented Feb 23, 2024

This op corresponds to a Rel message with a ReadRel message that, in turn, has a NamedTable message. With this op, we are capable of representing a first complete plan in our dialect that we can serialize to protobuf and execute (by copy'n'pasting into an external consumer).

This PR is based on and, therefor, includes #795.

Copy link
Member

@jpienaar jpienaar left a comment

Choose a reason for hiding this comment

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

(just skimmed before next talk ... I should probably see how I could view stacked PRs better :) )

return failure();

Region &body = op.getBodyRegion();
if (llvm::range_size(body.getOps()) != 1)
Copy link
Member

Choose a reason for hiding this comment

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

This is a little wasteful/one could early exit without computing total size.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

How? The only way I can think of is something like ++body.getOps().begin() != body.op_end() but that's much less readable, isn't it?

Copy link
Member

Choose a reason for hiding this comment

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

Indeed it is, one could also if the first is a terminator, I think your version from comment would be cheaper than that though. One could get creative with zip and seq too , but I think simplest may be a lambda with loop inside from readability point of view (I mean this may not matter, I meant "little" in the non-British use of little :-))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Shame! std::ranges::take_view would be helpful here but it's C++20.

But, actually, maybe std::next(body.op_begin()) != body.op_end() isn't too bad?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yet another thought: if the IR is valid, then the range of the size is 1, so llvm::range_size acutally has acceptable cost. Do we really have to optimize for runtime on invalid IR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Based on that last argument, I propose to revert my latest change and go with the initial version. WDYT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Resolving this discussion because (1) the related line wasn't part of this commit, (2) it's the only one left for an otherwise approved PR, (3) we can always come back later: #815.

@ingomueller-net
Copy link
Collaborator Author

(just skimmed before next talk ... I should probably see how I could view stacked PRs better :) )

Thanks! In the "Files changed" tab, where you're probably doing the review, you can change "Show changes from all commits" to a single commit or even a range (by holding shift).

@ingomueller-net ingomueller-net force-pushed the substrait-named-table branch 4 times, most recently from 7657e6b to 4ad9d15 Compare March 7, 2024 13:18
Copy link
Member

@jpienaar jpienaar left a comment

Choose a reason for hiding this comment

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

Nice, thanks


include "mlir/IR/OpBase.td"

def Substrait_RelOpInterface : OpInterface<"RelOpInterface"> {
Copy link
Member

Choose a reason for hiding this comment

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

OOC are you going to keep a ordering here of some sorts? (E.g., top to bottom or sorted or by type or ...)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I haven't made up my mind for this file yet. For SubstraitOps.td, I have sections that correspond to the sections in the spec and the protobuf files of Substrait, and then sort alphabetically inside each section. I guess I'll do the same here (once I figure out if we need sections and which they are).

@ingomueller-net ingomueller-net force-pushed the substrait-named-table branch from 4ad9d15 to ad82b52 Compare March 8, 2024 13:27
Copy link
Collaborator Author

@ingomueller-net ingomueller-net left a comment

Choose a reason for hiding this comment

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

All in-line comments addressed with the latest commits. I'll now look again at the top-level discussion.

ingomueller-net added a commit to ingomueller-net/iree-llvm-sandbox that referenced this pull request Mar 19, 2024
@ingomueller-net ingomueller-net merged commit e2021f9 into iree-org:main Mar 20, 2024
3 checks passed
@ingomueller-net ingomueller-net deleted the substrait-named-table branch March 20, 2024 15:00
ingomueller-net added a commit to substrait-io/substrait-mlir-contrib that referenced this pull request Oct 15, 2024
…lvm-sandbox#797)

This op corresponds to a `Rel` message with a `ReadRel` message that, in
turn, has a `NamedTable` message. With this op, we are capable of
representing a first complete plan in our dialect that we can serialize
to protobuf and execute (by copy'n'pasting into an external consumer).

Signed-off-by: Ingo Müller <[email protected]>
ingomueller-net added a commit to substrait-io/substrait-mlir-contrib that referenced this pull request Oct 15, 2024
…lvm-sandbox#797)

This op corresponds to a `Rel` message with a `ReadRel` message that, in
turn, has a `NamedTable` message. With this op, we are capable of
representing a first complete plan in our dialect that we can serialize
to protobuf and execute (by copy'n'pasting into an external consumer).

Signed-off-by: Ingo Müller <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants