-
Notifications
You must be signed in to change notification settings - Fork 57
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
Feature/refactor noodle masked load (WIP) #216
base: develop
Are you sure you want to change the base?
Changes from 1 commit
d4fde85
9f66822
476cefb
5f65b9f
0e2f6c1
5814d32
db3b0e9
f866b72
de66c74
9a53b19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,15 +86,21 @@ hwlm_error_t scanSingleMain(const struct noodTable *n, const u8 *buf, | |
DEBUG_PRINTF("d - d0: %ld \n", d - d0); | ||
#if defined(HAVE_MASKED_LOADS) | ||
uint8_t l = d - d0; | ||
typename SuperVector<S>::comparemask_type mask = ~SuperVector<S>::single_load_mask(l); | ||
typename SuperVector<S>::comparemask_type mask = ~SuperVector<S>::load_mask(l); | ||
SuperVector<S> chars = SuperVector<S>::loadu_maskz(d0, mask) & caseMask; | ||
typename SuperVector<S>::comparemask_type z = mask1.eqmask(chars); | ||
DEBUG_PRINTF("mask: %08llx\n", mask); | ||
hwlm_error_t rv = single_zscan<S>(n, d0, buf, z, len, cbi); | ||
#else | ||
uint8_t l = d0 + S - d; | ||
DEBUG_PRINTF("l: %d \n", l); | ||
SuperVector<S> chars = SuperVector<S>::loadu_maskz(d, l) & caseMask; | ||
chars.print8("chars"); | ||
typename SuperVector<S>::comparemask_type z = mask1.eqmask(chars); | ||
DEBUG_PRINTF("z: %08llx\n", (u64a) z); | ||
z = SuperVector<S>::iteration_mask(z); | ||
DEBUG_PRINTF("z: %08llx\n", (u64a) z); | ||
|
||
hwlm_error_t rv = single_zscan<S>(n, d, buf, z, len, cbi); | ||
#endif | ||
chars.print32("chars"); | ||
markos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
@@ -125,6 +131,8 @@ hwlm_error_t scanSingleMain(const struct noodTable *n, const u8 *buf, | |
uint8_t l = buf_end - d; | ||
SuperVector<S> chars = SuperVector<S>::loadu_maskz(d, l) & caseMask; | ||
typename SuperVector<S>::comparemask_type z = mask1.eqmask(chars); | ||
z = SuperVector<S>::iteration_mask(z); | ||
|
||
hwlm_error_t rv = single_zscan<S>(n, d, buf, z, len, cbi); | ||
RETURN_IF_TERMINATED(rv); | ||
} | ||
|
@@ -160,12 +168,12 @@ hwlm_error_t scanDoubleMain(const struct noodTable *n, const u8 *buf, | |
const u8 *d0 = ROUNDDOWN_PTR(d, S); | ||
#if defined(HAVE_MASKED_LOADS) | ||
uint8_t l = d - d0; | ||
typename SuperVector<S>::comparemask_type mask = ~SuperVector<S>::double_load_mask(l); | ||
typename SuperVector<S>::comparemask_type mask = ~SuperVector<S>::load_mask(l); | ||
SuperVector<S> chars = SuperVector<S>::loadu_maskz(d0, mask) & caseMask; | ||
typename SuperVector<S>::comparemask_type z1 = mask1.eqmask(chars); | ||
typename SuperVector<S>::comparemask_type z2 = mask2.eqmask(chars); | ||
typename SuperVector<S>::comparemask_type z = (z1 << SuperVector<S>::mask_width()) & z2; | ||
DEBUG_PRINTF("z: %0llx\n", z); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why deleting the debug print here? when you added more of the likes for the scanSingle function There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. z has a different type in each architecture, this DEBUG_PRINTF fails to compile on some architectures, so I need to make it work and compile on all architectures. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What confuse me is that in the previous function, you added There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, that's what I did locally after I realized I could just cast it :) |
||
z = SuperVector<S>::iteration_mask(z); | ||
lastz1 = z1 >> (S - 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this assume |
||
|
||
DEBUG_PRINTF("mask: %08llx\n", mask); | ||
|
@@ -176,8 +184,9 @@ hwlm_error_t scanDoubleMain(const struct noodTable *n, const u8 *buf, | |
chars.print8("chars"); | ||
markos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
typename SuperVector<S>::comparemask_type z1 = mask1.eqmask(chars); | ||
typename SuperVector<S>::comparemask_type z2 = mask2.eqmask(chars); | ||
|
||
typename SuperVector<S>::comparemask_type z = (z1 << SuperVector<S>::mask_width()) & z2; | ||
z = SuperVector<S>::iteration_mask(z); | ||
|
||
hwlm_error_t rv = double_zscan<S>(n, d, buf, z, len, cbi); | ||
lastz1 = z1 >> (l - 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same issue with mask_width() |
||
#endif | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -525,11 +525,26 @@ really_inline SuperVector<16> SuperVector<16>::load(void const *ptr) | |
template <> | ||
really_inline SuperVector<16> SuperVector<16>::loadu_maskz(void const *ptr, uint8_t const len) | ||
{ | ||
SuperVector mask = Ones_vshr(16 -len); | ||
SuperVector<16> v = loadu(ptr); | ||
SuperVector mask = Ones_vshr(16 - len); | ||
SuperVector v = loadu(ptr); | ||
return mask & v; | ||
} | ||
|
||
template <> | ||
really_inline SuperVector<16> SuperVector<16>::loadu_maskz(void const *ptr, typename base_type::comparemask_type const mask) | ||
{ | ||
DEBUG_PRINTF("mask = %08llx\n", mask); | ||
SuperVector v = loadu(ptr); | ||
(void)mask; | ||
return v; // FIXME: & mask | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FIXME |
||
} | ||
|
||
template<> | ||
really_inline typename SuperVector<16>::comparemask_type SuperVector<16>::findLSB(typename SuperVector<16>::comparemask_type &z) | ||
{ | ||
return findAndClearLSB_64(&z) >> 2; | ||
} | ||
|
||
template<> | ||
really_inline SuperVector<16> SuperVector<16>::alignr(SuperVector<16> &other, int8_t offset) | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debug print?