Skip to main content

compile_npu/
compile_npu.rs

1//! Compile the bundled native XDNA copy kernel without opening a device.
2//! Usage: compile_npu [packets], where each packet is 4096 bytes.
3use hrx::{
4    Result, Target,
5    loom::{Compiler, ReportMode, Specialization},
6};
7fn main() -> Result<()> {
8    let packets = std::env::args().nth(1).unwrap_or_else(|| "256".into());
9    let artifact = Compiler::for_target(None, &Target::xdna())?
10        .module(include_str!("../tests/kernels/copy.xdna.loom"))
11        .compile(
12            &Specialization::new("copy")
13                .with_config("copy.packets", packets)
14                .with_report(ReportMode::Summary),
15        )?;
16    println!("{}", artifact.path().display());
17    Ok(())
18}