-
Notifications
You must be signed in to change notification settings - Fork 639
Initial commit does not build #4082
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
e0d6f02
31140fb
059c443
ca5df55
e4a50e5
d035744
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1616,6 +1616,223 @@ class ConvertAtenAdaptivePoolOp : public OpConversionPattern<OpTy> { | |||||
}; | ||||||
} // namespace | ||||||
|
||||||
namespace { | ||||||
template <typename OpTy, typename PoolingOpTy, int Dim> | ||||||
|
||||||
class ConvertRoiAlignOp : public OpConversionPattern<OpTy> { | ||||||
public: | ||||||
Muzammiluddin-Syed-ECE marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
using OpConversionPattern<OpTy>::OpConversionPattern; | ||||||
LogicalResult | ||||||
matchAndRewrite(OpTy op, typename OpTy::Adaptor adaptor, | ||||||
ConversionPatternRewriter &rewriter) const override { | ||||||
if (failed(verifyLinalgCompatibleTypes(op, rewriter))) | ||||||
return failure(); | ||||||
|
||||||
Location loc = op->getLoc(); | ||||||
const TypeConverter *typeConverter = this->getTypeConverter(); | ||||||
Value result = op.getResult(); | ||||||
|
||||||
uint64_t pooledHeight = | ||||||
cast<ConstantIntOp>(op.getPooledHeight().getDefiningOp()).getValue(); | ||||||
uint64_t pooledWidth = | ||||||
cast<ConstantIntOp>(op.getPooledWidth().getDefiningOp()).getValue(); | ||||||
uint64_t samplingRatio = | ||||||
cast<ConstantIntOp>(op.getSamplingRatio().getDefiningOp()).getValue(); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use |
||||||
Value pooledH = op.getPooledHeight(); | ||||||
Value pooledW = op.getPooledWidth(); | ||||||
Value spatialScaleVal = op.getSpatialScale(); | ||||||
llvm::APFloat spatialScale = | ||||||
cast<ConstantFloatOp>(op.getSpatialScale().getDefiningOp()).getValue(); | ||||||
Value rois = op.getRois(); | ||||||
Value input = op.getInput(); | ||||||
// RankedTensorType inputType = input.getType(); | ||||||
Value offset = | ||||||
rewriter.create<arith::ConstantOp>(loc, b.getF32FloatAttr(0.0)); | ||||||
Type resultType = cast<RankedTensorType>(result.getType()); | ||||||
Type resultElementType = resultType.getElementType(); | ||||||
if (!op.getAligned()) { | ||||||
offset = rewriter.create<arith::ConstantOp>(loc, b.getF32FloatAttr(0.5)); | ||||||
} | ||||||
|
||||||
Value lb = rewriter.create<arith::ConstantIndexOp>(loc, 0); | ||||||
Value ub0 = rewriter.create<tensor::DimOp>(loc, rois, 0); | ||||||
Value ub1 = rewriter.create<tensor::DimOp>(loc, input, 1); | ||||||
Value step = rewriter.create<arith::ConstantIndexOp>(loc, 1); | ||||||
SmallVector<Value> finalOutputShape = {ub0, ub1, pooledH, pooledW}; | ||||||
Value finalOutputTensor = rewriter.create<tensor::EmptyOp>( | ||||||
loc, getAsOpFoldResult(finalOutputShape), resultElementType); | ||||||
auto forLoop = rewriter.create<scf::ForOp>( | ||||||
loc, lb, ub0, step, ValueRange{}, | ||||||
[&](OpBuilder &b1, Location loc, Value iv0, ValueRange args) { | ||||||
auto forLoop = b1.create<scf::ForOp>( | ||||||
loc, lb, ub1, step, ValueRange{}, | ||||||
[&](OpBuilder &b, Location loc, Value iv1, ValueRange args) { | ||||||
// Step 1: Extract bounds for region of interest (roi) | ||||||
|
// Step 1: Extract bounds for region of interest (roi) | |
// Step 1: Extract bounds for region of interest (roi). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also in other comments in this file
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
llvm doesn't use underscores in variable names, see https://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly and https://mlir.llvm.org/getting_started/DeveloperGuide/#style-guide
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use pre-increment:
for (unsigned i = 2; i < inputRank; i++) { | |
for (unsigned i = 2; i < inputRank; ++i) { |
See https://llvm.org/docs/CodingStandards.html#prefer-preincrement
Also in other loops
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you need two values only you can use a plain C array
Uh oh!
There was an error while loading. Please reload this page.