Skip to content

Fix out-of-bound accessing in pad op lowering. - #2615

Merged
hanhanW merged 3 commits into
iree-org:mainfrom
hanhanW:pad
Jul 22, 2020
Merged

hanhanW merged 3 commits into
iree-org:mainfrom
hanhanW:pad

Conversation

@hanhanW

@hanhanW hanhanW commented Jul 22, 2020

Copy link
Copy Markdown
Contributor

This also fixes convolution issue, because there is a pass to extract
padding attributes from convolution op, which hits pad op issue as well.

Fixes #2531
Fixes #2530
Fixes #2345

This also fixes convolution issue, because there is a pass to extract
padding attributes from convolution op, which hits pad op issue as well.

Fixes iree-org#2531
Fixes iree-org#2530
Fixes iree-org#2345
@hanhanW hanhanW added the codegen Shared code generation infrastructure and dialects label Jul 22, 2020

@antiagainst antiagainst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super awesome! One pull request to close three issues. Thanks Hahan!!

// value.
const auto &edgePaddingLow = op.edge_padding_low();
const auto &edgePaddingHigh = op.edge_padding_high();
const auto &interiorPadding = op.interior_padding();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we return error when interior padding contains non-zero values at the very beginning. Here we are actually able to handle that case.. Should we drop the check at the beginning? (Can happen as a separate patch and will want to have tests.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, forgot the condition. I think we can remove it, it was there because it made the logic complicated. It's simple in this approach, let me also add a test for it.

note that it's still passing on Android.

rewriter.create<CmpIOp>(loc, CmpIPredicate::slt, dim, bound);
applyAndOp(checkUb);
}
// The pass for splitting dispatch function for vulkan requires no other ops

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That pass should be relaxed to allow "metadata" ops in the middle. Technically this pass should not be concerning its downstream users.. But it's fine for now. :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I added a TODO here. Once the condition is relaxed, we can move it to before where it's used.

@hanhanW
hanhanW merged commit dfac5f5 into iree-org:main Jul 22, 2020
@hanhanW
hanhanW deleted the pad branch July 22, 2020 17:55
@rsuderman rsuderman mentioned this pull request Jul 22, 2020
@MaheshRavishankar

Copy link
Copy Markdown
Collaborator

Thanks. Sorry I missed this (had an issue with notifications that is fixed now)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codegen Shared code generation infrastructure and dialects

Projects

None yet

4 participants