Skip to content

[8.0] Fix undefined behavior in U/INT8 in L2_SVE [MOD-9080] #682

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

Merged
merged 1 commit into from
May 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/VecSim/spaces/L2/L2_SVE_INT8.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ float INT8_L2SqrSIMD_SVE(const void *pVect1v, const void *pVect2v, size_t dimens
svint8_t v2_i8 = svld1_s8(pg, pVect2 + offset); // Load int8 vectors from pVect2

// The result of svabd can be reinterpreted as uint8
svuint8_t abs_diff = svreinterpret_u8_s8(svabd_s8_x(pg, v1_i8, v2_i8));
svuint8_t abs_diff = svreinterpret_u8_s8(svabd_s8_x(all, v1_i8, v2_i8));

// Can sum with taking into account pg because svld1 will set inactive lanes to 0
sum3 = svdot_u32(sum3, abs_diff, abs_diff);
Expand Down
3 changes: 2 additions & 1 deletion src/VecSim/spaces/L2/L2_SVE_UINT8.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ float UINT8_L2SqrSIMD_SVE(const void *pVect1v, const void *pVect2v, size_t dimen
svuint8_t v1_ui8 = svld1_u8(pg, pVect1 + offset); // Load uint8 vectors from pVect1
svuint8_t v2_ui8 = svld1_u8(pg, pVect2 + offset); // Load uint8 vectors from pVect2

svuint8_t abs_diff = svabd_u8_x(pg, v1_ui8, v2_ui8);
svuint8_t abs_diff = svabd_u8_x(all, v1_ui8, v2_ui8);

// Can sum with taking into account pg because svld1 will set inactive lanes to 0
sum3 = svdot_u32(sum3, abs_diff, abs_diff);
}

Expand Down
Loading