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

[Iterators] Add some TODOs for what to do with the Tabular dialect. #660

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions experimental/iterators/include/iterators/Conversion/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ def ConvertStatesToLLVM : Pass<"convert-states-to-llvm", "ModuleOp"> {
// TabularToLLVM
//===----------------------------------------------------------------------===//

// TODO(ingomueller): This pass should probably not exist. Instead, tabular
// views should be lowered into its constituant components,
// which could be tensors, in order to compose better with
// other dialects and passes.
def ConvertTabularToLLVM : Pass<"convert-tabular-to-llvm", "ModuleOp"> {
let summary = "Convert the tabular dialect to the LLVM dialect";
let description = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,12 @@ def Iterators_TabularViewToStreamOp : Iterators_Op<"tabular_view_to_stream",
" .cast<LLVM::LLVMStructType>().getBody())">,
DeclareOpInterfaceMethods<OpAsmOpInterface, ["getAsmResultNames"]>]> {
// TODO(ingomueller): Get rid of the LLVM dependency after designing a row
// type or similar.
// type or similar. Apart from tying the lowering to LLVM,
// which probably limits the applicability of higher-level
// passes on the components of a tabular view, the
// LLVM-based design also inherits the limitations of the
// LLVM type system, such as the missing support for signed
// and unsigned integer types.
let summary = "Extracts the tuples from a tabular view as LLVM structs";
let description = [{
Produces a stream of LLVM structs from a given `tabular_view` (i.e., "scans"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ include "mlir/IR/OpBase.td"
// Dialect definition
//===----------------------------------------------------------------------===//

// TODO(ingomueller): This dialect should probably not be lowered to LLVM
// directly. I think it would be a better design to treat
// tabular views (potentially with a different name) as a
// bundle of several tensors, which we can access (and maybe
// update) one at a time. It is then up to the consumer to
// extract rows or batches of rows from the tensors, for
// which they can use the usual means. The default lowering
// would then simple decompose the tabular view into its
// constituant tensors, which would not affect the accesses
// to rows or row batches. After that decomposition, normal
// bufferization can run without knowing the tabular
// provenance of the tensors.
def Tabular_Dialect : Dialect {
let name = "tabular";
let cppNamespace = "::mlir::iterators";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ class MemRefTypeWithIdentityLayoutAndRankOf<list<Type> allowedTypes,

def Tabular_ViewAsTabularOp : Tabular_Op<"view_as_tabular",
[DeclareOpInterfaceMethods<OpAsmOpInterface, ["getAsmResultNames"]>]> {
// TODO(ingomueller): We should consider allowing tensors as operands, or even
// make that the only possibility. This would allow to keep
// the highest level of abstraction, in particular, if we
// do not lower to LLVM directly.
let summary = "Creates a `tabular_view` from the given memrefs";
let description = [{
Converts a variadic number of memrefs of rank 1 into the columns of a
Expand Down Expand Up @@ -70,4 +74,8 @@ def Tabular_ViewAsTabularOp : Tabular_Op<"view_as_tabular",
}];
}

// TODO(ingomueller): It may make sense to add accessors for individual columns,
// i.e., an ExtractColumnOp or similar, which would return a
// single column of the tabular view, possibly a tensor.

#endif // TABULAR_DIALECT_TABULAR_IR_TABULAROPS