load_and_run/
load_and_run.rs1use ferrotensor_backend::{ComputeEngine, UnifiedTensor, WgpuContext};
2use ferrotensor_loader::WeightsContext;
3use std::sync::Arc;
4
5fn main() {
6 env_logger::init();
7 pollster::block_on(async {
8 let ctx = Arc::new(WgpuContext::new().await);
10 let engine = ComputeEngine::new(&ctx);
11
12 let _weights_ctx = WeightsContext::new();
14
15 println!("Demonstrating full pipeline (conceptual)...");
16
17 let shape = vec![4];
19 let gpu_int8 = UnifiedTensor::new(&ctx, &[1.0, 2.0, 3.0, 4.0], &shape);
20 let gpu_fp32 = UnifiedTensor::empty(&ctx, &shape);
21
22 engine.dequantize(&ctx, &gpu_int8, &gpu_fp32);
24
25 let gpu_c = UnifiedTensor::new(&ctx, &[2.0, 2.0, 2.0, 2.0], &shape);
27 let gpu_out = UnifiedTensor::empty(&ctx, &shape);
28 let temp = UnifiedTensor::empty(&ctx, &shape);
29
30 engine.add(&ctx, &gpu_fp32, &gpu_c, &temp);
31 engine.mul(&ctx, &temp, &gpu_c, &gpu_out);
32
33 let result = gpu_out.to_vec(&ctx).await;
34 println!("Result: {:?}", result);
35 println!("SUCCESS: Pipeline logic verified!");
36 });
37}