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

Interface for DPS op creation #1671

Open
azecevicTT opened this issue Dec 27, 2024 · 0 comments
Open

Interface for DPS op creation #1671

azecevicTT opened this issue Dec 27, 2024 · 0 comments
Assignees
Labels
MLIR Ops Issues related to MLIR dialect ops and their implementations TTIR Dialect Issues related to TTIR dialect TTNN Dialect Issues related to TTNN dialect

Comments

@azecevicTT
Copy link
Contributor

Almost all ops in the TTIR dialect are DPS (and some are in TTNN as well). This means that during lowering from various frontends and decomposition we have a lot of repeating code that looks something like this

auto dpsOut = rewriter.create<tensor::EmptyOp(op.getLoc(), outputShape, outputElementType, outputEncoding);
auto targetOp = rewriter.create<ttir::TargetOp>(op.getLoc(), outputType, input1,..., dpsOut,...);

There are several problems with this approach. We don't have the standard way of calculating outputType (sometimes it's dpsOut.getType(), sometimes it's precomputed from the parameters of dpsOut creation, and there are a few other ways that I've seen throughout the codebase, some of them are outright wrong). Especially when multiple ops are created in a single function, it easily becomes a very error-prone process.

A better interface would be the one that would look like a rewriter.create that would abstract away the creation of EmptyOp. It would be the default interface for the creation of DPS ops when we don't have a preexisting output tensor.

@azecevicTT azecevicTT added MLIR Ops Issues related to MLIR dialect ops and their implementations TTIR Dialect Issues related to TTIR dialect TTNN Dialect Issues related to TTNN dialect labels Dec 27, 2024
@azecevicTT azecevicTT self-assigned this Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MLIR Ops Issues related to MLIR dialect ops and their implementations TTIR Dialect Issues related to TTIR dialect TTNN Dialect Issues related to TTNN dialect
Projects
None yet
Development

No branches or pull requests

1 participant