[mlir][sparse] change variable dimension to fixed attribute pointers/indices
The "sparsification" pass does not need the ability to use runtime values for the dimension, so the only source for variability would have been user code. Restricting the dimension to constants simplifies code generation. Reviewed By: Peiming, wrengr Differential Revision: https://reviews.llvm.org/D133458
This commit is contained in:
@@ -1077,8 +1077,10 @@ public:
|
||||
Type resType = op.getType();
|
||||
Type ptrType = resType.cast<ShapedType>().getElementType();
|
||||
SmallString<16> name{"sparsePointers", overheadTypeFunctionSuffix(ptrType)};
|
||||
replaceOpWithFuncCall(rewriter, op, name, resType, adaptor.getOperands(),
|
||||
EmitCInterface::On);
|
||||
Value dim =
|
||||
constantIndex(rewriter, op->getLoc(), op.getDimension().getZExtValue());
|
||||
replaceOpWithFuncCall(rewriter, op, name, resType,
|
||||
{adaptor.getTensor(), dim}, EmitCInterface::On);
|
||||
return success();
|
||||
}
|
||||
};
|
||||
@@ -1093,8 +1095,10 @@ public:
|
||||
Type resType = op.getType();
|
||||
Type indType = resType.cast<ShapedType>().getElementType();
|
||||
SmallString<15> name{"sparseIndices", overheadTypeFunctionSuffix(indType)};
|
||||
replaceOpWithFuncCall(rewriter, op, name, resType, adaptor.getOperands(),
|
||||
EmitCInterface::On);
|
||||
Value dim =
|
||||
constantIndex(rewriter, op->getLoc(), op.getDimension().getZExtValue());
|
||||
replaceOpWithFuncCall(rewriter, op, name, resType,
|
||||
{adaptor.getTensor(), dim}, EmitCInterface::On);
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user