mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
Bugfix/fix avx512vbmi regressions (#335)
Multiple AVX512VBMI-related fixes: src/nfa/mcsheng_compile.cpp: No need for an assert here, impl_id can be set to 0 src/nfa/nfa_api_queue.h: Make sure this compiles on both C++ and C src/nfagraph/ng_fuzzy.cpp: Fix compilation error when DEBUG_OUTPUT=on src/runtime.c: Fix crash when data == NULL unit/internal/sheng.cpp: Unit test has to enable AVX512VBMI manually as autodetection does not get trigger, this causes test to fail src/fdr/teddy_fat.cpp: AVX512 loads need to be 64-bit aligned, caused a crash on clang-18
This commit is contained in:
parent
689556d5f9
commit
f7d5546fe5
@ -100,7 +100,7 @@ const m512 *getDupMaskBase(const struct Teddy *teddy, u8 numMask) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const u8 ALIGN_AVX_DIRECTIVE p_mask_interleave[64] = {
|
const u8 ALIGN_CL_DIRECTIVE p_mask_interleave[64] = {
|
||||||
0, 32, 1, 33, 2, 34, 3, 35, 4, 36, 5, 37, 6, 38, 7, 39,
|
0, 32, 1, 33, 2, 34, 3, 35, 4, 36, 5, 37, 6, 38, 7, 39,
|
||||||
8, 40, 9, 41, 10, 42, 11, 43, 12, 44, 13, 45, 14, 46, 15, 47,
|
8, 40, 9, 41, 10, 42, 11, 43, 12, 44, 13, 45, 14, 46, 15, 47,
|
||||||
16, 48, 17, 49, 18, 50, 19, 51, 20, 52, 21, 53, 22, 54, 23, 55,
|
16, 48, 17, 49, 18, 50, 19, 51, 20, 52, 21, 53, 22, 54, 23, 55,
|
||||||
|
@ -610,7 +610,9 @@ dstate_id_t find_sheng_states(dfa_info &info,
|
|||||||
for (auto v : sheng_states) {
|
for (auto v : sheng_states) {
|
||||||
dstate_id_t s = g[v].index;
|
dstate_id_t s = g[v].index;
|
||||||
if (contains(accel_escape_info, s)) {
|
if (contains(accel_escape_info, s)) {
|
||||||
assert(!info.states[s].impl_id);
|
if (info.states[s].impl_id == 0) {
|
||||||
|
DEBUG_PRINTF("impl_id == 0!\n");
|
||||||
|
}
|
||||||
info.states[s].impl_id = sheng_end++;
|
info.states[s].impl_id = sheng_end++;
|
||||||
info.extra[s].sheng_id = info.states[s].impl_id - 1;
|
info.extra[s].sheng_id = info.states[s].impl_id - 1;
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,11 @@ void q_skip_forward_to(struct mq *q, s64a min_loc) {
|
|||||||
// Dump the contents of the given queue.
|
// Dump the contents of the given queue.
|
||||||
static never_inline UNUSED
|
static never_inline UNUSED
|
||||||
void debugQueue(const struct mq *q) {
|
void debugQueue(const struct mq *q) {
|
||||||
|
#ifdef __cplusplus
|
||||||
if (q == nullptr) {
|
if (q == nullptr) {
|
||||||
|
#else
|
||||||
|
if (q == NULL) {
|
||||||
|
#endif
|
||||||
DEBUG_PRINTF("q=NULL!\n");
|
DEBUG_PRINTF("q=NULL!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ vector<flat_set<NFAVertex>> gatherSuccessorsByDepth(const NGHolder &g,
|
|||||||
if (v == succr) {
|
if (v == succr) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
DEBUG_PRINTF("Node %zu depth %u\n", g[succ].index, d + 1);
|
DEBUG_PRINTF("Node %zu depth %u\n", g[succr].index, d + 1);
|
||||||
next.insert(succr);
|
next.insert(succr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ vector<flat_set<NFAVertex>> gatherPredecessorsByDepth(const NGHolder &g,
|
|||||||
if (v == predc) {
|
if (v == predc) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
DEBUG_PRINTF("Node %zu depth %u\n", g[pred].index, d + 1);
|
DEBUG_PRINTF("Node %zu depth %u\n", g[predc].index, d + 1);
|
||||||
next.insert(predc);
|
next.insert(predc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,8 +207,7 @@ vector<RoseLongLitHashEntry> buildHashTable(
|
|||||||
u32 lit_id = lit_offset.first;
|
u32 lit_id = lit_offset.first;
|
||||||
u32 offset = lit_offset.second;
|
u32 offset = lit_offset.second;
|
||||||
|
|
||||||
DEBUG_PRINTF("hash 0x%08x lit_id %u offset %u bucket %u\n", hash,
|
DEBUG_PRINTF("hash 0x%08x lit_id %u offset %u bucket %u\n", m.first, lit_id, offset, bucket);
|
||||||
lit_id, offset, bucket);
|
|
||||||
|
|
||||||
auto &entry = tab[bucket];
|
auto &entry = tab[bucket];
|
||||||
entry.str_offset = verify_u32(litToOffsetVal.at(lit_id));
|
entry.str_offset = verify_u32(litToOffsetVal.at(lit_id));
|
||||||
|
@ -1089,6 +1089,7 @@ hs_error_t HS_CDECL hs_stream_size(const hs_database_t *db,
|
|||||||
// perusal.
|
// perusal.
|
||||||
static UNUSED
|
static UNUSED
|
||||||
void dumpData(const char *data, size_t len) {
|
void dumpData(const char *data, size_t len) {
|
||||||
|
if (!data) return;
|
||||||
DEBUG_PRINTF("BUFFER:");
|
DEBUG_PRINTF("BUFFER:");
|
||||||
for (size_t i = 0; i < len; i++) {
|
for (size_t i = 0; i < len; i++) {
|
||||||
u8 c = data[i];
|
u8 c = data[i];
|
||||||
|
@ -198,7 +198,11 @@ typedef void (*init_raw_dfa_ptr)(struct ue2::raw_dfa*, const ReportID);
|
|||||||
|
|
||||||
static inline void init_nfa(struct NFA **out_nfa, sheng_compile_ptr compile_function, init_raw_dfa_ptr init_dfa_function) {
|
static inline void init_nfa(struct NFA **out_nfa, sheng_compile_ptr compile_function, init_raw_dfa_ptr init_dfa_function) {
|
||||||
ue2::Grey *g = new ue2::Grey();
|
ue2::Grey *g = new ue2::Grey();
|
||||||
|
#if defined(HAVE_AVX512VBMI)
|
||||||
|
hs_platform_info plat_info = {0, HS_CPU_FEATURES_AVX512VBMI, 0, 0};
|
||||||
|
#else
|
||||||
hs_platform_info plat_info = {0, 0, 0, 0};
|
hs_platform_info plat_info = {0, 0, 0, 0};
|
||||||
|
#endif
|
||||||
ue2::CompileContext *cc = new ue2::CompileContext(false, false, ue2::target_t(plat_info), *g);
|
ue2::CompileContext *cc = new ue2::CompileContext(false, false, ue2::target_t(plat_info), *g);
|
||||||
ue2::ReportManager *rm = new ue2::ReportManager(*g);
|
ue2::ReportManager *rm = new ue2::ReportManager(*g);
|
||||||
ue2::Report *report = new ue2::Report(ue2::EXTERNAL_CALLBACK, 0);
|
ue2::Report *report = new ue2::Report(ue2::EXTERNAL_CALLBACK, 0);
|
||||||
@ -522,7 +526,7 @@ TEST(Sheng32, std_compile_header) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
ue2::Grey *g = new ue2::Grey();
|
ue2::Grey *g = new ue2::Grey();
|
||||||
hs_platform_info plat_info = {0, 0, 0, 0};
|
hs_platform_info plat_info = {0, HS_CPU_FEATURES_AVX512VBMI, 0, 0};
|
||||||
ue2::CompileContext *cc = new ue2::CompileContext(false, false, ue2::target_t(plat_info), *g);
|
ue2::CompileContext *cc = new ue2::CompileContext(false, false, ue2::target_t(plat_info), *g);
|
||||||
ue2::ReportManager *rm = new ue2::ReportManager(*g);
|
ue2::ReportManager *rm = new ue2::ReportManager(*g);
|
||||||
ue2::Report *report = new ue2::Report(ue2::EXTERNAL_CALLBACK, 0);
|
ue2::Report *report = new ue2::Report(ue2::EXTERNAL_CALLBACK, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user