Skip to main content

build_gpu_pattern_set

Function build_gpu_pattern_set 

Source
pub fn build_gpu_pattern_set(ac_literals: &[String]) -> Option<PatternSet>
Expand description

Build a complete PatternSet containing ALL patterns (AC regexes + fallback regexes) for GPU matching. Falls back to None if compilation fails (e.g., overly complex regexes). Build a GPU PatternSet from AC LITERAL prefixes (not regexes).

The GPU shader runs an AC automaton on wgpu compute cores — pattern count is irrelevant because all patterns are evaluated in parallel. Uses .literal() which builds an AC trie (no DFA state explosion).

The regex-based .regex() builder uses regex-automata DFA internally which explodes at >100 patterns. We NEVER use that for GPU.