Skip to content
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

Add padding to temporary arrays to ensure we don't read beyond bounds. #505

Merged
merged 1 commit into from Sep 17, 2020

Conversation

AdamHillier
Copy link
Contributor

@AdamHillier AdamHillier commented Sep 16, 2020

What do these changes do?

@Tombana and I had a conversation last week about the fact that in our (optimised) kernels we sometimes read beyond the bounds of our temporary arrays. For example, in the int16 accumulator kernel we read eight output transform multiplier/biases, even if there's only a single output channel (and so only one value in each array). This currently doesn't seem to be causing a problem in practice, but could lead to undefined behaviour and/or segfaults.

This PR adds a LCE_EXTRA_BYTES value (inspired by this definition in XNNPack), set to 16, and uses it to add padding to our intermediate tensors.

How Has This Been Tested?

CI.

Benchmark Results

N/A.

Related issue number

N/A.

@AdamHillier AdamHillier added the internal-improvement Internal Improvements and Maintenance label Sep 16, 2020
@AdamHillier AdamHillier requested a review from a team September 16, 2020 14:57
@AdamHillier AdamHillier force-pushed the array-padding branch 2 times, most recently from dc333d4 to 4c4fe01 Compare September 16, 2020 15:18
@Tombana Tombana merged commit 6bbc061 into master Sep 17, 2020
@Tombana Tombana deleted the array-padding branch September 17, 2020 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal-improvement Internal Improvements and Maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants