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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
//! omni-ffi — zero-cost cxx bridge between the Rust orchestrator and the
//! OmniPulse Module-I WST math engine.
//!
//! On the default (CPU) build the bridge calls `cpu_wst_forward()` from
//! `cpu_wst_engine.h`: a real Radix-2 Cooley-Tukey FFT + analytic Morlet
//! filter bank + depth-m scattering cascade. No mocks.
//!
//! When the `cuda` feature is enabled the bridge links `cudart` and `cufft`
//! and (in the GPU build) dispatches to the templated
//! `WSTEngine<HopperTag, J, Q>` defined in `wst_kernel.cuh`.
//!
//! ## Memory ownership
//!
//! [`run_wst_pipeline`](ffi::run_wst_pipeline) returns a [`WSTResult`] whose
//! `fingerprint_ptr` owns either:
//! * a `new float[]` heap allocation (CPU build), or
//! * a `cudaMalloc` device allocation (CUDA build).
//!
//! The Rust caller MUST release it by calling
//! [`free_wst_result`](ffi::free_wst_result) exactly once. Forgetting to do
//! so leaks heap or VRAM. Calling it twice is undefined behavior.
pub use WSTResult;
/// Convenience wrapper that runs a single-batch, depth-2, plain-WST pass.
///
/// # Safety
///
/// `plasma_id` must satisfy the same invariants as
/// [`ffi::run_wst_pipeline::input_plasma_ptr`](ffi::run_wst_pipeline): a
/// live, contiguous `f32[signal_len]` Apache Arrow Plasma mmap base
/// address. See the [`ffi::run_wst_pipeline`] docs for the full contract.
///
/// The returned [`WSTResult`] owns an allocation that must be released
/// exactly once via [`free_fingerprint`].
pub unsafe
/// Release the tensor allocation backing a [`WSTResult`].
///
/// # Safety
///
/// `result` must have come from [`execute_fingerprint_pass`] (or
/// [`ffi::run_wst_pipeline`] directly) on this process and must not have
/// been passed here already. See [`ffi::free_wst_result`] for the full
/// contract.
pub unsafe