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 alignment to the TxN_t vectorized type #792

Merged

Conversation

achirkin
Copy link
Contributor

The recent removal of the union-based type punning in #781 caused misaligned access in some cases. This PR returns the alignment to the data type.

@achirkin achirkin requested a review from a team as a code owner August 25, 2022 06:07
@github-actions github-actions bot added the cpp label Aug 25, 2022
@achirkin achirkin added bug Something isn't working 3 - Ready for Review non-breaking Non-breaking change cpp and removed cpp labels Aug 25, 2022
@achirkin
Copy link
Contributor Author

achirkin commented Aug 25, 2022

The failing test case for me was AnnIVFFlatTest/AnnIVFFlatTestF_uint8.AnnIVFFlat trying to write TxN_t<uint8_t, 4> into local memory (perhaps, due to register spilling):

========= Invalid __local__ write of size 4 bytes
=========     at 0x420 in {ws}/raft/cpp/include/raft/vectorized.cuh:314:void raft::TxN_t<unsigned char, (int)4>::load<unsigned int>(const unsigned char *, T1)
=========     by thread (0,0,0) in block (0,0,0)
=========     Address 0xfffbb9 is misaligned
=========     Device Frame:{ws}/raft/cpp/include/raft/linalg/detail/unary_op.cuh:37:void raft::linalg::detail::unaryOpKernel<unsigned char, (int)4, raft::spatial::knn::detail::utils::mapping<float>, float, unsigned int>(T4 *, const T1 *, T5, T3) [0x540]
=========     Saved host backtrace up to driver entry point at kernel launch time
=========     Host Frame: [0x2b5011]
=========                in /lib/x86_64-linux-gnu/libcuda.so
=========     Host Frame: [0x144dc]
=========                in {envs}/cuml_dev/lib/libcudart.so.11.0
=========     Host Frame:cudaLaunchKernel_ptsz [0x4d038]
=========                in {envs}/cuml_dev/lib/libcudart.so.11.0
=========     Host Frame:/usr/local/cuda/include/cuda_runtime_api.h:13159:cudaLaunchKernel [0xf3a758]
=========                in {ws}/raft/./cpp/build/test_raft
=========     Host Frame:/tmp/tmpxft_00004589_00000000-6_ann_ivf_flat.cudafe1.stub.c:1046:__device_stub__ZN4raft6linalg6detail13unaryOpKernelIhLi4ENS_7spatial3knn6detail5utils7mappingIfEEfjEEvPT2_PKT_T3_T1_(float*, unsigned char const*, unsigned int, raft::spatial::knn::detail::utils::mapping<float>&) [0xf407d0]
=========                in {ws}/raft/./cpp/build/test_raft
=========     Host Frame:/tmp/tmpxft_00004589_00000000-6_ann_ivf_flat.cudafe1.stub.c:1050:void raft::linalg::detail::__wrapper__device_stub_unaryOpKernel<unsigned char, 4, raft::spatial::knn::detail::utils::mapping<float>, float, unsigned int>(float*&, unsigned char const*&, unsigned int&, raft::spatial::knn::detail::utils::mapping<float>&) [0xf40818]
=========                in {ws}/raft/./cpp/build/test_raft
=========     Host Frame:{ws}/raft/cpp/include/raft/linalg/detail/unary_op.cuh:43:void raft::linalg::detail::unaryOpKernel<unsigned char, 4, raft::spatial::knn::detail::utils::mapping<float>, float, unsigned int>(float*, unsigned char const*, unsigned int, raft::spatial::knn::detail::utils::mapping<float>) [0xfc696b]
...

(BTW this is tested using cuda 11.7)
CC @wphicks @cjnolet

@cjnolet
Copy link
Member

cjnolet commented Aug 25, 2022

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 57df37d into rapidsai:branch-22.10 Aug 25, 2022
@achirkin achirkin deleted the fix-vectorized-misaligned branch August 26, 2022 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review bug Something isn't working cpp non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants