From 8e822d49a28e0c1e93df9cbd4b240bc1f6dfa8b3 Mon Sep 17 00:00:00 2001 From: autocommit Date: Tue, 19 May 2026 21:24:51 -0700 Subject: [PATCH] =?UTF-8?q?feat(gpu):=20=E2=9C=A8=20Optimize=20AI=20simula?= =?UTF-8?q?tor=20GPU=20structures=20for=2012-player=20capacity=20with=20pe?= =?UTF-8?q?rsonality=20priors=20and=20relation=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- src/simulator/crates/mc-ai/src/gpu/inner.rs | 6 +++--- .../crates/mc-ai/tests/budget_enforcement.rs | 4 ++-- .../crates/mc-ai/tests/gpu_tree_integration.rs | 9 ++++----- .../crates/mc-ai/tests/gpu_walltime.rs | 18 +++++++++++------- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/simulator/crates/mc-ai/src/gpu/inner.rs b/src/simulator/crates/mc-ai/src/gpu/inner.rs index e273b9ea..0126890d 100644 --- a/src/simulator/crates/mc-ai/src/gpu/inner.rs +++ b/src/simulator/crates/mc-ai/src/gpu/inner.rs @@ -624,7 +624,7 @@ mod tests { fn iron_vs_bh() -> [PersonalityPriors; MAX_PLAYERS] { let iron = ironhold_priors(); let bh = blackhammer_priors(); - [iron, bh, iron, bh, iron] + [iron, bh, iron, bh, iron, bh, iron, bh, iron, bh, iron, bh] } fn make_entry() -> AbstractRolloutState { @@ -632,8 +632,8 @@ mod tests { pod.players[0].gold = 100; pod.players[0].pop_total = 5; pod.players[0].city_count = 1; - pod.players[0].force_rel = [0, 20, 0, 0, 0]; - pod.players[0].relations = [0, -1, 0, 0, 0]; + pod.players[0].force_rel = [0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + pod.players[0].relations = [0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; pod.players[0].rng_state = 0xAAAA_BBBB_CCCC_DDDD; pod.players[0].turn = 1; pod.players[1].gold = 50; diff --git a/src/simulator/crates/mc-ai/tests/budget_enforcement.rs b/src/simulator/crates/mc-ai/tests/budget_enforcement.rs index 3dcad190..0500e1e9 100644 --- a/src/simulator/crates/mc-ai/tests/budget_enforcement.rs +++ b/src/simulator/crates/mc-ai/tests/budget_enforcement.rs @@ -64,8 +64,8 @@ fn make_root_state() -> GameRolloutState { pod.players[0].gold = 100; pod.players[0].pop_total = 5; pod.players[0].city_count = 1; - pod.players[0].force_rel = [0, 20, 0, 0]; - pod.players[0].relations = [0, -1, 0, 0]; + pod.players[0].force_rel = [0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + pod.players[0].relations = [0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; pod.players[0].rng_state = 0xAAAA_BBBB_CCCC_DDDD; pod.players[0].turn = 1; pod.players[1].gold = 50; diff --git a/src/simulator/crates/mc-ai/tests/gpu_tree_integration.rs b/src/simulator/crates/mc-ai/tests/gpu_tree_integration.rs index 53dced32..103cccc1 100644 --- a/src/simulator/crates/mc-ai/tests/gpu_tree_integration.rs +++ b/src/simulator/crates/mc-ai/tests/gpu_tree_integration.rs @@ -43,7 +43,6 @@ fn ironhold_priors() -> PersonalityPriors { promotion_offense_weight: 1.0, promotion_defense_weight: 1.0, promotion_mobility_weight: 1.0, - building_priors: mc_ai::tactical::state::BuildingPriors::default(), ..PersonalityPriors::default() } } @@ -59,7 +58,6 @@ fn blackhammer_priors() -> PersonalityPriors { promotion_offense_weight: 1.0, promotion_defense_weight: 1.0, promotion_mobility_weight: 1.0, - building_priors: mc_ai::tactical::state::BuildingPriors::default(), ..PersonalityPriors::default() } } @@ -69,8 +67,8 @@ fn make_root_state() -> GameRolloutState { pod.players[0].gold = 100; pod.players[0].pop_total = 5; pod.players[0].city_count = 1; - pod.players[0].force_rel = [0, 20, 0, 0]; - pod.players[0].relations = [0, -1, 0, 0]; + pod.players[0].force_rel = [0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + pod.players[0].relations = [0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; pod.players[0].rng_state = 0xAAAA_BBBB_CCCC_DDDD; pod.players[0].turn = 1; pod.players[1].gold = 50; @@ -80,7 +78,8 @@ fn make_root_state() -> GameRolloutState { let iron = ironhold_priors(); let bh = blackhammer_priors(); - let priors: [PersonalityPriors; MAX_PLAYERS] = [iron, bh, iron, bh, iron]; + let priors: [PersonalityPriors; MAX_PLAYERS] = + [iron, bh, iron, bh, iron, bh, iron, bh, iron, bh, iron, bh]; GameRolloutState::new(pod, priors) } diff --git a/src/simulator/crates/mc-ai/tests/gpu_walltime.rs b/src/simulator/crates/mc-ai/tests/gpu_walltime.rs index a827fc25..0d24bc2c 100644 --- a/src/simulator/crates/mc-ai/tests/gpu_walltime.rs +++ b/src/simulator/crates/mc-ai/tests/gpu_walltime.rs @@ -61,15 +61,19 @@ fn make_inputs() -> (Vec, Vec<[PersonalityPriors; MAX_PLAY _pad_uc: 0, happiness_pool: ((i as i16 % 20) - 10), _pad0: 0, - force_rel: [ - ((i * 17) as u16) ^ 0x3000, - ((i * 19) as u16) ^ 0x4000, - ((i * 23) as u16) ^ 0x5000, - ((i * 29) as u16) ^ 0x6000, - ], + force_rel: { + let mut fr = [0u16; MAX_PLAYERS]; + fr[0] = ((i * 17) as u16) ^ 0x3000; + fr[1] = ((i * 19) as u16) ^ 0x4000; + fr[2] = ((i * 23) as u16) ^ 0x5000; + fr[3] = ((i * 29) as u16) ^ 0x6000; + fr + }, axes: [5, 5, 5, 5, 0, 0, 0, 0], - relations: [0, 0, 0, 0], + relations: [0; MAX_PLAYERS], + _pad_rel: [0; 4], formation_strength: [128, 96, 64, 32], + _pad_fs: [0; 4], rng_state: SEED.wrapping_add((i as u64) << 32).wrapping_add(p as u64), turn: 50 + (i as u32 % 100), _pad2: [0; 4],