use std::path::Path;
use rlx_flow::CompileProfile;
use rlx_core::flow_bridge::profile_near_weights as load_profile_near_weights;
pub const SAM_PROFILE_FILE: &str = "sam.rlx.toml";
pub fn sam_profile_near_weights(weights: &Path) -> CompileProfile {
load_profile_near_weights(weights, SAM_PROFILE_FILE, CompileProfile::sam_encoder())
}
pub fn sam3_profile_near_weights(weights: &Path) -> CompileProfile {
load_profile_near_weights(weights, SAM_PROFILE_FILE, CompileProfile::sam3())
}
pub fn sam2_profile_near_weights(weights: &Path) -> CompileProfile {
load_profile_near_weights(weights, SAM_PROFILE_FILE, CompileProfile::sam2())
}
pub fn sam2_profile_default() -> CompileProfile {
CompileProfile::sam2()
}
pub fn sam_profile_default() -> CompileProfile {
CompileProfile::sam_encoder()
}
pub fn sam3_profile_default() -> CompileProfile {
CompileProfile::sam3()
}
#[cfg(test)]
mod tests {
use super::*;
use rlx_flow::FusionPolicyKind;
#[test]
fn sam_rlx_toml_loads_for_sam3() {
let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src/sam.rlx.toml");
let p = CompileProfile::from_toml_path(&path).unwrap();
assert_eq!(p.fusion.policy, FusionPolicyKind::Direct);
assert!(p.passes.dce);
assert!(p.backend.cpu.unfuse_regions);
}
}