-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
[mlir][sparse] rename map utility #68611
Merged
Merged
Conversation
This file contains 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
Rename util genReaderBuffers -> genMapBuffers since it is no longer specific to the reader, but all MapRef data in general.
@llvm/pr-subscribers-mlir-sparse @llvm/pr-subscribers-mlir ChangesRename util genReaderBuffers -> genMapBuffers since it is no longer specific to the reader, but all MapRef data in general. Full diff: https://github.com/llvm/llvm-project/pull/68611.diff 4 Files Affected:
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.cpp
index c44c5985ee7bba1..dac6d6b64551c83 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.cpp
@@ -774,12 +774,12 @@ Value sparse_tensor::genReader(OpBuilder &builder, Location loc,
return reader;
}
-Value sparse_tensor::genReaderBuffers(OpBuilder &builder, Location loc,
- SparseTensorType stt,
- ArrayRef<Value> dimShapesValues,
- Value dimSizesBuffer,
- /*out*/ Value &dim2lvlBuffer,
- /*out*/ Value &lvl2dimBuffer) {
+Value sparse_tensor::genMapBuffers(OpBuilder &builder, Location loc,
+ SparseTensorType stt,
+ ArrayRef<Value> dimShapesValues,
+ Value dimSizesBuffer,
+ /*out*/ Value &dim2lvlBuffer,
+ /*out*/ Value &lvl2dimBuffer) {
const Dimension dimRank = stt.getDimRank();
const Level lvlRank = stt.getLvlRank();
// For an identity mapping, the dim2lvl and lvl2dim mappings are
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.h b/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.h
index 698b6c491a9aef7..1562ea3f20f73df 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.h
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/CodegenUtils.h
@@ -353,11 +353,11 @@ Value genReader(OpBuilder &builder, Location loc, SparseTensorType stt,
/*out*/ SmallVectorImpl<Value> &dimShapeValues,
/*out*/ Value &dimSizesBuffer);
-/// Generates code to set up the buffer parameters for a reader.
-Value genReaderBuffers(OpBuilder &builder, Location loc, SparseTensorType stt,
- ArrayRef<Value> dimShapeValues, Value dimSizesBuffer,
- /*out*/ Value &dim2lvlBuffer,
- /*out*/ Value &lvl2dimBuffer);
+/// Generates code to set up the buffer parameters for a map.
+Value genMapBuffers(OpBuilder &builder, Location loc, SparseTensorType stt,
+ ArrayRef<Value> dimShapeValues, Value dimSizesBuffer,
+ /*out*/ Value &dim2lvlBuffer,
+ /*out*/ Value &lvl2dimBuffer);
//===----------------------------------------------------------------------===//
// Inlined constant generators.
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
index 2c03f0a6020e6a8..e22789643c90af7 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
@@ -1478,8 +1478,8 @@ struct SparseNewConverter : public OpConversionPattern<NewOp> {
// Now construct the dim2lvl and lvl2dim buffers.
Value dim2lvlBuffer;
Value lvl2dimBuffer;
- genReaderBuffers(rewriter, loc, dstTp, dimShapesValues, dimSizesBuffer,
- dim2lvlBuffer, lvl2dimBuffer);
+ genMapBuffers(rewriter, loc, dstTp, dimShapesValues, dimSizesBuffer,
+ dim2lvlBuffer, lvl2dimBuffer);
// Read the COO tensor data.
Value xs = desc.getAOSMemRef();
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
index e44d8565fc867de..68b337e2d2f3f04 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp
@@ -205,7 +205,7 @@ class NewCallParams final {
params[kParamLvlTypes] = genLvlTypesBuffer(builder, loc, stt);
// Construct dimSizes, lvlSizes, dim2lvl, and lvl2dim buffers.
params[kParamDimSizes] = allocaBuffer(builder, loc, dimSizesValues);
- params[kParamLvlSizes] = genReaderBuffers(
+ params[kParamLvlSizes] = genMapBuffers(
builder, loc, stt, dimSizesValues, params[kParamDimSizes],
params[kParamDim2Lvl], params[kParamLvl2Dim]);
// Secondary and primary types encoding.
@@ -446,8 +446,8 @@ class SparseTensorNewConverter : public OpConversionPattern<NewOp> {
Value dim2lvlBuffer;
Value lvl2dimBuffer;
Value lvlSizesBuffer =
- genReaderBuffers(rewriter, loc, stt, dimShapesValues, dimSizesBuffer,
- dim2lvlBuffer, lvl2dimBuffer);
+ genMapBuffers(rewriter, loc, stt, dimShapesValues, dimSizesBuffer,
+ dim2lvlBuffer, lvl2dimBuffer);
// Use the `reader` to parse the file.
Type opaqueTp = getOpaquePointerType(rewriter);
Type eltTp = stt.getElementType();
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
yinying-lisa-li
approved these changes
Oct 9, 2023
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.
Rename util genReaderBuffers -> genMapBuffers since it is no longer specific to the reader, but all MapRef data in general.