Skip to content

Commit f68c382

Browse files
committed
feat(jitson_cranelift): wire noise kernel cache into JitEngine
Add noise_cache HashMap to JitEngine for compile_noise/get_noise lifecycle. Import CachedNoiseKernel from noise_jit module. https://claude.ai/code/session_01CdqyUTUfjKZuk8YGJzv6LB
1 parent ba336ec commit f68c382

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎src/hpc/jitson_cranelift/engine.rs‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use cranelift_module::{FuncId, Linkage, Module};
3232

3333
use super::detect::CpuCaps;
3434
use super::ir::{JitError, ScanParams};
35+
use super::noise_jit::CachedNoiseKernel;
3536
use super::scan_jit::ScanKernel;
3637

3738
/// Builder for creating a JIT engine with registered external functions.
@@ -103,7 +104,12 @@ impl JitEngineBuilder {
103104
let cache = LazyLock::new(empty_cache as fn() -> KernelCache);
104105
LazyLock::force(&cache);
105106

106-
Ok(JitEngine { module, caps, cache })
107+
Ok(JitEngine {
108+
module,
109+
caps,
110+
cache,
111+
noise_cache: HashMap::new(),
112+
})
107113
}
108114
}
109115

@@ -147,13 +153,16 @@ unsafe impl Sync for KernelCache {}
147153
pub struct JitEngine {
148154
/// Cranelift JIT module — owns the compiled code pages.
149155
/// Only accessed during BUILD phase (&mut self).
150-
module: JITModule,
156+
pub(crate) module: JITModule,
151157

152158
/// CPU capabilities detected at engine creation.
153159
pub caps: CpuCaps,
154160

155161
/// Kernel cache. Mutable during BUILD (via get_mut), frozen during RUN.
156162
cache: LazyLock<KernelCache>,
163+
164+
/// Noise kernel cache. Mutable during BUILD, read-only during RUN.
165+
pub(crate) noise_cache: HashMap<u64, CachedNoiseKernel>,
157166
}
158167

159168
// SAFETY: JITModule's compiled code pages are immutable after finalization.

0 commit comments

Comments
 (0)