iowo/crates/executor/src/lib.rs
MultisampledNight 7fa84d3bc0
feat(ir): replace Rpl with GraphIr
Semi-broken as atm the CLI just does nothing except printing the parsed
IR, instead of actually executing it.
2024-01-20 14:00:00 +01:00

38 lines
1.1 KiB
Rust

use ir::instruction::Kind;
use value::Dynamic;
mod debug;
mod value;
/// The available executors
/// unused in early dev.
#[derive(Debug, Clone, Copy, clap::ValueEnum)]
pub enum Executors {
/// the debug executor is single threaded and really, *really* slow. And unstable. Don't use. Unless you're a dev working on this.
Debug,
/// the CPU executor primarily uses the CPU. Most likely most feature complete, and the fallback.
Cpu,
/// the Vulkan executor (obviously) uses vulkan. there's a good chance this isn't implemented yet as you're reading this.
Vulkan,
}
trait Executor {
fn execute(instruction: Kind, input: Option<Dynamic>) -> Option<Dynamic>;
}
pub fn execute_all(instructions: Vec<Kind>) {
let mut tmp = None;
for instruction in instructions {
tmp = debug::Executor::execute(instruction, tmp);
}
}
// scratchpad lol:
// execution structure:
// 1. take in rpl
// 2. analyse/validate structure against allowed executors
// 3. assign executors to instructions
// 4. optimize
// 5. prepare memory management patterns
// 6. run