Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or 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
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.
fixes #4666, fixes #4664.
this fixes several bounds checks and integer overflows in the metal conv path:
steel_conv_general.h: widenedshort diff = gemm_params->N - offset_ntoint diff. with more than 32767 output channels per group,diffwrapped negative and caused the store guard to evaluate false, leaving upper channels unwritten on gpu.loader_channel_n.handloader_channel_l.h: bounded weight rows against per-group channelsgemm_params->Ninstead of total channelsparams->O. because the weight base pointer is already offset to the group, comparing against total channels caused grouped and depthwise convs (e.g. conv1d with padding) to read past the end of the weight buffer.loader_channel_l.handloader_general.h: widenedshort weight_h,weight_w,weight_dspatial counters tointso large kernel spatial dimensions do not wrap.conv.metal: evaluated winograd weight transform destination offset withsize_t(ohw_0) * C * Oto prevent 32-bit overflow whenC * Ois large.conv.cpp: widened(static_cast<int64_t>(implicit_M) + bm - 1) / bmto prevent signed 32-bit overflow.tested on m-series mac with metal shader validation and the issue reproducers:
test_conv.py.