From c15aba5d9641e1a905fd04326b61e373c0907ed8 Mon Sep 17 00:00:00 2001 From: ilgeco Date: Wed, 13 May 2026 15:05:17 +0200 Subject: [PATCH] pim-simulator removed useless comment --- .../pim/pim-simulator/src/lib/pimcore.rs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/backend-simulators/pim/pim-simulator/src/lib/pimcore.rs b/backend-simulators/pim/pim-simulator/src/lib/pimcore.rs index e3ca045..89a9866 100644 --- a/backend-simulators/pim/pim-simulator/src/lib/pimcore.rs +++ b/backend-simulators/pim/pim-simulator/src/lib/pimcore.rs @@ -206,24 +206,20 @@ fn check_cycle(cpu: &mut CPU, cores_instructions: &[CoreInstructions], send_recv enum CoreState { SendingTo(i32), ReceivingFrom(i32), - Working, // Doing math, etc. Not blocked. + Working, Halted, } - // 1. Snapshot the current state of every core let mut states = HashMap::new(); for core_inst in cores_instructions.iter() { if core_inst.program_counter >= core_inst.instructions.len() { - // Assuming we can derive core ID here. If `cores_instructions` doesn't - // give you the core ID easily, you might need to enumerate the loop. continue; } let Instruction { data, functor } = core_inst.instructions[core_inst.program_counter]; let functor_address = functor as usize; - // get_core_immcore() always seems to return (this_core, target_core) let (this_core, target_core) = data.get_core_immcore(); if isa_recv(functor_address) { @@ -231,38 +227,31 @@ fn check_cycle(cpu: &mut CPU, cores_instructions: &[CoreInstructions], send_recv } else if isa_send(functor_address) { states.insert(this_core, CoreState::SendingTo(target_core)); } else { - // Doing other stuff (add, sub, etc). It is NOT blocked. states.insert(this_core, CoreState::Working); } } - // 2. Build the Wait-For Graph let mut wait_for = HashMap::new(); for (&core_id, state) in states.iter() { match state { CoreState::SendingTo(target_core) => { let target_state = states.get(target_core).unwrap_or(&CoreState::Halted); - // We are blocked UNLESS the target is actively receiving from us right now if target_state != &CoreState::ReceivingFrom(core_id) { wait_for.insert(core_id, *target_core); } } CoreState::ReceivingFrom(target_core) => { let target_state = states.get(target_core).unwrap_or(&CoreState::Halted); - // We are blocked UNLESS the target is actively sending to us right now if target_state != &CoreState::SendingTo(core_id) { wait_for.insert(core_id, *target_core); } } CoreState::Working | CoreState::Halted => { - // A working core is not waiting for anyone. - // It has no outgoing edges, which naturally prevents false cycles! } } } - // 3. Detect Cycles strictly among blocked cores let mut visited = HashSet::new(); for &start_core in wait_for.keys() {