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:
Konstantinos Margaritis
2025-05-30 21:08:55 +03:00
committed by GitHub
parent 7b505226ed
commit 7737104585
7 changed files with 18 additions and 8 deletions

View File

@@ -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) {
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};
#endif
ue2::CompileContext *cc = new ue2::CompileContext(false, false, ue2::target_t(plat_info), *g);
ue2::ReportManager *rm = new ue2::ReportManager(*g);
ue2::Report *report = new ue2::Report(ue2::EXTERNAL_CALLBACK, 0);
@@ -522,7 +526,7 @@ TEST(Sheng32, std_compile_header) {
}
#endif
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::ReportManager *rm = new ue2::ReportManager(*g);
ue2::Report *report = new ue2::Report(ue2::EXTERNAL_CALLBACK, 0);
@@ -713,4 +717,4 @@ TEST(Sheng32, history_run_Q2) {
}
#endif /* defined(HAVE_AVX512VBMI) || defined(HAVE_SVE) */
} /* namespace */
} /* namespace */