1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
//! # vyre — GPU bytecode condition engine
//!
//! The first GPU-native rule condition evaluator. Compiles boolean conditions
//! to bytecode, uploads to GPU compute shaders, and evaluates millions of
//! rules against file data in parallel.
//!
//! vyre is the execution engine. It does not parse rules — frontends like
//! [`yaragpu`](https://crates.io/crates/yaragpu) (YARA) or `surgec` (SURGE)
//! compile their respective languages to `vyre::Program` bytecode.
//!
//! # Architecture
//!
//! ```text
//! ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
//! │ YARA / SURGE │────▶│ Bytecode │────▶│ GPU Shader │
//! │ Frontend │ │ Programs │ │ Evaluation │
//! └──────────────┘ └──────────────┘ └──────────────┘
//! │ │
//! vyre::Program vyre::evaluate()
//! ```
//!
//! # Example
//!
//! ```rust,no_run
//! use vyre::{Program, FileContext, evaluate};
//!
//! // Programs are compiled by a frontend (yaragpu, surgec)
//! let programs: Vec<Program> = vec![/* ... */];
//! let matches: Vec<matchkit::Match> = vec![/* pattern matches */];
//! let file_ctx = FileContext::default();
//!
//! // Evaluate all rule conditions on GPU
//! let results: Vec<bool> = evaluate(&programs, &matches, file_ctx)?;
//! # Ok::<(), vyre::Error>(())
//! ```
//!
//! # GPU Only
//!
//! vyre requires a GPU. There is no CPU fallback by design — if you need
//! CPU rule evaluation, use the YARA library directly. vyre exists because
//! GPU evaluation is 1000x faster at scale.
/// Bytecode instruction set, opcodes, and program serialization.
/// Error types for bytecode validation and GPU operations.
/// GPU pipeline: shader compilation, buffer management, dispatch.
/// WGSL compute shader generation for the bytecode ISA.
pub use ;
pub use ;
pub use FileContext;
/// Maximum iterations for `for` loops in bytecode evaluation.
/// Shared between GPU shader and any future execution backend
/// to guarantee identical behavior.
pub const MAX_FOR_ITERATIONS: u32 = 4096;
/// Low-level GPU evaluation entry point.
///
/// For most users, the `yaragpu` or `surgec` frontends provide
/// a higher-level API that handles program compilation and match
/// orchestration. Use this directly only when building a custom frontend.
///
/// # Errors
///
/// Returns [`Error::Gpu`] if no GPU adapter is available or the
/// shader dispatch fails.
pub use execute_gpu as evaluate_raw;
pub use cached_device;