FBGEMM
FBGEMM copied to clipboard
Fix array-bounds error
Fix the following g++ error:
In member function ‘constexpr const std::array<_Tp, _Nm>::value_type& std::array<_Tp, _Nm>::operator[](size_type) const [with _Tp = int; long unsigned int _Nm = 1]’,
inlined from ‘fbgemm::GenConvKernelBase<SPATIAL_DIM, INST_SET>::GenConvKernelBase(const fbgemm::conv_param_t<kSpatialDim>&, int32_t, bool, bool, bool, bool, bool) [with int SPATIAL_DIM = 1; fbgemm::inst_set_t INST_SET = fbgemm::inst_set_t::avx512]’ at ../third_party/fbgemm/src/./GroupwiseConv.h:128:43:
/usr/include/c++/14.2.1/array:219:24: error: array subscript 18446744073709551615 is above array bounds of ‘std::__array_traits<int, 1>::_Type’ {aka ‘const int [1]’} [-Werror=array-bounds=]
219 | return _M_elems[__n];
| ~~~~~~~~^
/usr/include/c++/14.2.1/array: In constructor ‘fbgemm::GenConvKernelBase<SPATIAL_DIM, INST_SET>::GenConvKernelBase(const fbgemm::conv_param_t<kSpatialDim>&, int32_t, bool, bool, bool, bool, bool) [with int SPATIAL_DIM = 1; fbgemm::inst_set_t INST_SET = fbgemm::inst_set_t::avx512]’:
/usr/include/c++/14.2.1/array:115:55: note: while referencing ‘std::array<int, 1>::_M_elems’
115 | typename __array_traits<_Tp, _Nm>::_Type _M_elems;
| ^~~~~~~~
In member function ‘constexpr const std::array<_Tp, _Nm>::value_type& std::array<_Tp, _Nm>::operator[](size_type) const [with _Tp = int; long unsigned int _Nm = 1]’,
inlined from ‘fbgemm::GenConvKernelBase<SPATIAL_DIM, INST_SET>::GenConvKernelBase(const fbgemm::conv_param_t<kSpatialDim>&, int32_t, bool, bool, bool, bool, bool) [with int SPATIAL_DIM = 1; fbgemm::inst_set_t INST_SET = fbgemm::inst_set_t::avx512_vnni]’ at ../third_party/fbgemm/src/./GroupwiseConv.h:128:43:
/usr/include/c++/14.2.1/array:219:24: error: array subscript 18446744073709551615 is above array bounds of ‘std::__array_traits<int, 1>::_Type’ {aka ‘const int [1]’} [-Werror=array-bounds=]
219 | return _M_elems[__n];
| ~~~~~~~~^
/usr/include/c++/14.2.1/array: In constructor ‘fbgemm::GenConvKernelBase<SPATIAL_DIM, INST_SET>::GenConvKernelBase(const fbgemm::conv_param_t<kSpatialDim>&, int32_t, bool, bool, bool, bool, bool) [with int SPATIAL_DIM = 1; fbgemm::inst_set_t INST_SET = fbgemm::inst_set_t::avx512_vnni]’:
/usr/include/c++/14.2.1/array:115:55: note: while referencing ‘std::array<int, 1>::_M_elems’
115 | typename __array_traits<_Tp, _Nm>::_Type _M_elems;
| ^~~~~~~~
cc1plus: all warnings being treated as errors
There was an out of bound access before fix, and that access was shortcuted by and condition. Nevertheless, it's better to fix that.
Deploy Preview for pytorch-fbgemm-docs ready!
| Name | Link |
|---|---|
| Latest commit | 7cf3b3b11d09d75a3615f83d995c2513c584c912 |
| Latest deploy log | https://app.netlify.com/projects/pytorch-fbgemm-docs/deploys/685611edef63db000858a8a0 |
| Deploy Preview | https://deploy-preview-3798--pytorch-fbgemm-docs.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.
@q10 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@q10 merged this pull request in pytorch/FBGEMM@993cd49e4bd4c39e09822efc4ad617f9d87b8b4f.