@@ -14,7 +14,17 @@ include "mlir/Pass/PassBase.td"
14
14
def SparseAssembler : Pass<"sparse-assembler", "ModuleOp"> {
15
15
let summary = "Add [dis]assemble operations on external sparse tensors";
16
16
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
18
28
input parameters and/or output return values into wrapper methods
19
29
that [dis]assemble the individual tensors that constitute the actual
20
30
storage used externally into MLIR sparse tensors. This pass can be used
@@ -27,6 +37,8 @@ def SparseAssembler : Pass<"sparse-assembler", "ModuleOp"> {
27
37
By default, the pass uses the [dis]assemble operations to input and output
28
38
sparse tensors. When the direct-out option is set, however, the output
29
39
directly returns the MLIR allocated buffers to the external runtime.
40
+
41
+ The pass should always run before the actual sparsification passes.
30
42
}];
31
43
let constructor = "mlir::createSparseAssembler()";
32
44
let dependentDialects = [
0 commit comments