awooter: fix multithreaded partitioning

This commit is contained in:
Lofty 2022-11-29 05:34:07 +00:00
parent d9161d9142
commit 290291cca6
3 changed files with 16 additions and 9 deletions

View File

@ -169,20 +169,25 @@ fn route(ctx: &mut npnr::Context) -> bool {
); );
let time = Instant::now() - start; let time = Instant::now() - start;
log_info!("Partitioning took {:.2}s\n", time.as_secs_f32()); log_info!("Partitioning took {:.2}s\n", time.as_secs_f32());
let start = Instant::now();
let mut router = route::Router::new(Coord::new(0, 0), Coord::new(x_part, y_part)); let mut router = route::Router::new(Coord::new(0, 0), Coord::new(x_part, y_part));
log_info!("Routing northeast arcs"); log_info!("Routing northeast arcs\n");
router.route(ctx, &nets, &ne); router.route(ctx, &nets, &ne);
log_info!("Routing southeast arcs"); log_info!("Routing southeast arcs\n");
router.route(ctx, &nets, &se); router.route(ctx, &nets, &se);
log_info!("Routing southwest arcs"); log_info!("Routing southwest arcs\n");
router.route(ctx, &nets, &sw); router.route(ctx, &nets, &sw);
log_info!("Routing northwest arcs"); log_info!("Routing northwest arcs\n");
router.route(ctx, &nets, &nw); router.route(ctx, &nets, &nw);
log_info!("Routing miscellaneous arcs"); log_info!("Routing miscellaneous arcs\n");
router.route(ctx, &nets, &misc); router.route(ctx, &nets, &misc);
let time = Instant::now() - start;
log_info!("Routing took {:.2}s\n", time.as_secs_f32());
//let mut router = route::Router::new(Coord::new(0, 0), Coord::new(x_part, y_part)); //let mut router = route::Router::new(Coord::new(0, 0), Coord::new(x_part, y_part));
/*log_info!("=== level 2 NE:\n"); /*log_info!("=== level 2 NE:\n");

View File

@ -1,5 +1,5 @@
use core::slice; use core::slice;
use std::{collections::HashMap, ffi::CStr, marker::PhantomData}; use std::{collections::HashMap, ffi::CStr, marker::PhantomData, sync::Mutex};
use libc::c_char; use libc::c_char;
@ -283,6 +283,8 @@ impl Context {
} }
pub fn name_of_wire(&self, wire: WireId) -> &CStr { pub fn name_of_wire(&self, wire: WireId) -> &CStr {
static MUTEX: Mutex<()> = Mutex::new(());
let lock = MUTEX.lock().unwrap();
unsafe { CStr::from_ptr(npnr_context_name_of_wire(self, wire)) } unsafe { CStr::from_ptr(npnr_context_name_of_wire(self, wire)) }
} }

View File

@ -360,9 +360,9 @@ fn partition<R: RangeBounds<i32>>(
let is_special_case = |arc: &Arc| { let is_special_case = |arc: &Arc| {
let src_wire = arc.get_source_wire(); let src_wire = arc.get_source_wire();
let dst_wire = arc.get_sink_wire(); //let dst_wire = arc.get_sink_wire();
let src_name = ctx.name_of_wire(arc.get_source_wire()).to_str().unwrap(); let src_name = ctx.name_of_wire(arc.get_source_wire()).to_str().unwrap();
let dst_name = ctx.name_of_wire(arc.get_sink_wire()).to_str().unwrap(); //let dst_name = ctx.name_of_wire(arc.get_sink_wire()).to_str().unwrap();
if src_name.contains("FCO_SLICE") { if src_name.contains("FCO_SLICE") {
return true; return true;