Crates.io | rivi-loader |
lib.rs | rivi-loader |
version | 0.1.5 |
source | src |
created_at | 2021-09-16 16:47:22.855426 |
updated_at | 2022-03-07 15:17:14.323988 |
description | Vulkan compute loader |
homepage | https://github.com/periferia-labs/rivi-loader |
repository | https://github.com/periferia-labs/rivi-loader |
max_upload_size | |
id | 452347 |
size | 83,983 |
[dependencies]
rivi-loader = "0.1.5"
rivi-loader is a Vulkan-based program loader for GPGPU applications. Roughly speaking, if you have input(s) and an output it will run a SPIR-V kernel on those values. This way, the long days of wondering how Vulkan works can be forgotten / skipped. That being said, the library does not help you in writing SPIR-V or any other shading language. It neither helps you in scheduling. What it does do is help you to setup the Vulkan instance, attach debug layers on it, query compute capable logical devices, expose fences and compute-capable queue families and queues, manage memory and command buffers, and deal with shader creation with specialization constant support. There is also a keen interest in making sure that the command buffers can be queued and polled in parallel on the CPU side.
fn main() {
let a = vec![1.0f32; 64];
let input = &vec![vec![a]];
let mut output = vec![0.0f32; 1];
let vk = rivi_loader::new(DebugOption::None).unwrap();
let mut cursor = std::io::Cursor::new(&include_bytes!("./reduce/reduce.spv")[..]);
let shader = vk.load_shader(&mut cursor, Some(vec![vec![2]])).unwrap();
vk.compute(input, &mut output, &shader).unwrap();
println!("Result: {:?}", output);
}
cargo run --example reduce
.To understand what is happening in the lib.rs
, consider a blog post series about graphics applications.
Periferia Labs is an ad-hoc group of friends tinkering with GPGPU. See our other projects: