File size: 1,521 Bytes
8e645df
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
//! Rust FFI bindings to `cosmic_gpu.dll` (ZERO PyTorch, ZERO external crates!).
//! Cosmic v0.6: Active-Brain Sparse Cosmic + Cosmic Optimizer v4 + Cosmic Compression!

#[cfg(feature = "gpu")]
extern "C" {
    pub fn cosmic_gpu_init(
        v: i32,
        b: i32,
        t: i32,
        l: i32,
        d: i32,
        f: i32,
        kn_d: i32,
        e: i32,
        top_k: i32,
        out_vram_mb: *mut f64,
        out_opt_mb: *mut f64,
        out_active_params: *mut u64,
    ) -> u64;
    pub fn cosmic_gpu_free();
    pub fn cosmic_gpu_causality_qa(out_past_diff: *mut f32, out_fut_diff: *mut f32);
    pub fn cosmic_gpu_train_micro_step(
        h_idx: *const u16,
        h_tgt: *const u16,
        lr: f32,
        wd: f32,
        micro_idx: i32,
        accum_steps: i32,
        out_recalls: *mut i32,
        out_wipes: *mut i32,
    ) -> f32;
    pub fn cosmic_gpu_eval_batch(h_idx: *const u16, h_tgt: *const u16) -> f32;
    pub fn cosmic_gpu_sample(
        prompt: *const u16,
        prompt_len: i32,
        out_buf: *mut u16,
        max_new: i32,
        temp: f32,
        seed: u64,
    );
    pub fn cosmic_gpu_save_ckpt(path: *const std::os::raw::c_char) -> i32;
    pub fn cosmic_gpu_load_ckpt(path: *const std::os::raw::c_char) -> i32;
    pub fn cosmic_gpu_export_codebook(
        path: *const std::os::raw::c_char,
        bits: i32,
        out_rmse: *mut f64,
        out_mb: *mut f64,
    ) -> i32;
    pub fn cosmic_gpu_load_codebook(path: *const std::os::raw::c_char) -> i32;
}