# Fixed-point solving ## Discussion notes https://hackmd.io/@salsa/rk3KZHsaR ## 2024-12-18 * implemented lazy cycle stuff which worked for SINGLE threaded tests * but MULTI threaded is harder * ## 2024-11-06 question: when doing verification, if we hit a cycle, what do we do? ```rust /// x = 0; y = 0; loop { x = y + 0; y = x + 0 } #[test] fn multi_symbol_cycle_converges_then_diverges() { let mut db = salsa::DatabaseImpl::new(); let defx0 = Definition::new(&db, None, 0); let defy0 = Definition::new(&db, None, 0); let defx1 = Definition::new(&db, None, 0); let defy1 = Definition::new(&db, None, 0); let use_x = Use::new(&db, vec![defx0, defx1]); let use_y = Use::new(&db, vec![defy0, defy1]); defx1.set_base(&mut db).to(Some(use_y)); defy1.set_base(&mut db).to(Some(use_x)); // Both symbols converge on 0 assert_eq!(infer_use(&db, use_x), Type::Values(Box::from([0]))); assert_eq!(infer_use(&db, use_y), Type::Values(Box::from([0]))); // Set the increment on x from 0 to 1. defx1.set_increment(&mut db).to(1); // Now the loop diverges and we fall back to Top. assert_eq!(infer_use(&db, use_x), Type::Top); assert_eq!(infer_use(&db, use_y), Type::Top); } ``` chain will look like * infer_use(use_x) * infer_def(defx0), returns 0 * infer_def(defx1) * read(defx1.base) * infer_use(use_y) <-- flag green * infer_def(defy0), returns 0 * infer_def(defy1) * read(defy1.base) * infer_use(use_x), cycle interim value bottom * read(defx1.increment) // <-- flag change here ## 2024-10-23 Hit trouble with moving prov value to the sync state Managing the ownership was a pain, it's an owned user value and we need to be able to hand out references and clones Will hopefully have something working! :tada: ## 2024-10-09 Node states... * in-progress * complete in-progress state is likely stored in the sync-state https://github.com/salsa-rs/salsa/blob/a20b894cc2318c5a6077659e2d8aef7c784c38e7/src/table/sync.rs#L21 complete would be a memo with add'l data can rip out the older fallback system