@@ -14,7 +14,17 @@ include "mlir/Pass/PassBase.td"
1414def SparseAssembler : Pass<"sparse-assembler", "ModuleOp"> {
1515 let summary = "Add [dis]assemble operations on external sparse tensors";
1616 let description = [{
17- A pass that converts public entry methods that use sparse tensors as
17+ Unlike dense tensors, MLIR does **not** provide a direct `_mlir_ciface_`
18+ ABI for passing sparse tensors as arguments from and to external methods
19+ (within MLIR-generated methods, sparse tensors can be freely passed
20+ around, but this eventually uses a bespoke parameter passing format
21+ that is subject to change; like opaque pointers when the sparse runtime
22+ support library is used or the constituent arrays and structs for
23+ direct IR codegen). The sparse assembler pass, however, can be used
24+ to obtain a stable `_mlir_ciface_` API for passing sparse tensors
25+ from and to an external environment, such as Python, PyTorch, or JAX.
26+
27+ The pass converts public entry methods that use sparse tensors as
1828 input parameters and/or output return values into wrapper methods
1929 that [dis]assemble the individual tensors that constitute the actual
2030 storage used externally into MLIR sparse tensors. This pass can be used
@@ -27,6 +37,8 @@ def SparseAssembler : Pass<"sparse-assembler", "ModuleOp"> {
2737 By default, the pass uses the [dis]assemble operations to input and output
2838 sparse tensors. When the direct-out option is set, however, the output
2939 directly returns the MLIR allocated buffers to the external runtime.
40+
41+ The pass should always run before the actual sparsification passes.
3042 }];
3143 let constructor = "mlir::createSparseAssembler()";
3244 let dependentDialects = [
0 commit comments