-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[mlir][sparse] added some clarification on sparse tensors ABI #96331
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-mlir-sparse Author: Aart Bik (aartbik) ChangesFull diff: https://github.com/llvm/llvm-project/pull/96331.diff 1 Files Affected:
diff --git a/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td b/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td
index 75a479b898040..58c9b58352651 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td
@@ -14,7 +14,17 @@ include "mlir/Pass/PassBase.td"
def SparseAssembler : Pass<"sparse-assembler", "ModuleOp"> {
let summary = "Add [dis]assemble operations on external sparse tensors";
let description = [{
- A pass that converts public entry methods that use sparse tensors as
+ Unlike dense tensors, MLIR does **not** provide a direct `_mlir_ciface_`
+ ABI for passing sparse tensors as arguments from and to external methods
+ (within MLIR-generated methods, sparse tensors can be freely passed
+ around, but this eventually uses a bespoke parameter passing format
+ that is subject to change; like opaque pointers when the sparse runtime
+ support library is used or the constituent arrays and structs for
+ direct IR codegen). The sparse assembler pass, however, can be used
+ to obtain a stable `_mlir_ciface_` API for passing sparse tensors
+ in and from an external environment, such as Python, PyTorch, or JAX.
+
+ The pass converts public entry methods that use sparse tensors as
input parameters and/or output return values into wrapper methods
that [dis]assemble the individual tensors that constitute the actual
storage used externally into MLIR sparse tensors. This pass can be used
@@ -27,6 +37,8 @@ def SparseAssembler : Pass<"sparse-assembler", "ModuleOp"> {
By default, the pass uses the [dis]assemble operations to input and output
sparse tensors. When the direct-out option is set, however, the output
directly returns the MLIR allocated buffers to the external runtime.
+
+ The pass should always run before the actual sparsification passes.
}];
let constructor = "mlir::createSparseAssembler()";
let dependentDialects = [
|
@llvm/pr-subscribers-mlir Author: Aart Bik (aartbik) ChangesFull diff: https://github.com/llvm/llvm-project/pull/96331.diff 1 Files Affected:
diff --git a/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td b/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td
index 75a479b898040..58c9b58352651 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.td
@@ -14,7 +14,17 @@ include "mlir/Pass/PassBase.td"
def SparseAssembler : Pass<"sparse-assembler", "ModuleOp"> {
let summary = "Add [dis]assemble operations on external sparse tensors";
let description = [{
- A pass that converts public entry methods that use sparse tensors as
+ Unlike dense tensors, MLIR does **not** provide a direct `_mlir_ciface_`
+ ABI for passing sparse tensors as arguments from and to external methods
+ (within MLIR-generated methods, sparse tensors can be freely passed
+ around, but this eventually uses a bespoke parameter passing format
+ that is subject to change; like opaque pointers when the sparse runtime
+ support library is used or the constituent arrays and structs for
+ direct IR codegen). The sparse assembler pass, however, can be used
+ to obtain a stable `_mlir_ciface_` API for passing sparse tensors
+ in and from an external environment, such as Python, PyTorch, or JAX.
+
+ The pass converts public entry methods that use sparse tensors as
input parameters and/or output return values into wrapper methods
that [dis]assemble the individual tensors that constitute the actual
storage used externally into MLIR sparse tensors. This pass can be used
@@ -27,6 +37,8 @@ def SparseAssembler : Pass<"sparse-assembler", "ModuleOp"> {
By default, the pass uses the [dis]assemble operations to input and output
sparse tensors. When the direct-out option is set, however, the output
directly returns the MLIR allocated buffers to the external runtime.
+
+ The pass should always run before the actual sparsification passes.
}];
let constructor = "mlir::createSparseAssembler()";
let dependentDialects = [
|
PeimingLiu
approved these changes
Jun 21, 2024
This was referenced Jun 21, 2024
AlexisPerry
pushed a commit
to llvm-project-tlp/llvm-project
that referenced
this pull request
Jul 9, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.