bench_depth.rs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //! Depth-suite phase of `sm121 bench`: a second, scenario-free perf pass
  2. //! that maps decode throughput across context depths.
  3. //!
  4. //! The campaign perf phase covers 0/8K (with the quality run); long-context
  5. //! decode is a lane-defining characteristic (vLLM vs sglang flattening the
  6. //! 256K cliff) and used to need a manual slope sweep to observe. The suite
  7. //! runs it at both stream counts with 2 repeats per point — operator
  8. //! convention 2026-09-29: "16K/64K/128K/256K at c2, 2 runs"; extended the
  9. //! same day after the first suites came back c2-only: c1 is the reference
  10. //! (stays flat) and shows what the c2 collapse costs.
  11. /// Context depths of the suite (0/8K excluded — covered by the main run).
  12. pub const DEPTHS: &str = "16384,65536,131072,262144";
  13. /// Stream counts: the same pair the campaign perf phase records (c1 baseline
  14. /// + c2 — the long-context collapse only shows at c2, so both are needed).
  15. pub const CONCURRENCY: &str = "1,2";
  16. /// Repeats per depth point (kept at 2 to bound the wall time).
  17. pub const RUNS: &str = "2";
  18. /// `tool-eval-bench` args for the depth sweep (perf-only, no scenarios).
  19. ///
  20. /// pp/tg match the campaign convention so the rows land under the same
  21. /// `pp2048 tg128 @ dNN` names the report's Throughput table already parses.
  22. pub fn depth_args(
  23. base_url: &str,
  24. model: &str,
  25. seed: u64,
  26. tokenizer: Option<&String>,
  27. ) -> Vec<String> {
  28. let mut args = vec![
  29. "--base-url".into(),
  30. base_url.to_string(),
  31. "--model".into(),
  32. model.to_string(),
  33. "--seed".into(),
  34. seed.to_string(),
  35. "--perf-only".into(),
  36. "--skip-tool-eval".into(),
  37. "--pp".into(),
  38. "2048".into(),
  39. "--tg".into(),
  40. "128".into(),
  41. "--depth".into(),
  42. DEPTHS.to_string(),
  43. "--concurrency".into(),
  44. CONCURRENCY.to_string(),
  45. "--benchy-runs".into(),
  46. RUNS.to_string(),
  47. ];
  48. if let Some(tok) = tokenizer {
  49. args.push("--tokenizer".into());
  50. args.push(tok.clone());
  51. }
  52. args
  53. }
  54. #[cfg(test)]
  55. mod tests {
  56. use super::*;
  57. /// The suite must be scenario-free and pinned to the campaign pp/tg —
  58. /// rows named differently would not match the report's perf parser.
  59. #[test]
  60. fn depth_args_are_perf_only_with_campaign_pp_tg() {
  61. let a = depth_args("http://h:3000/v1", "m", 42, None);
  62. let joined = a.join(" ");
  63. assert!(joined.contains("--perf-only"), "{joined}");
  64. assert!(joined.contains("--skip-tool-eval"), "{joined}");
  65. assert!(joined.contains("--pp 2048"), "{joined}");
  66. assert!(joined.contains("--tg 128"), "{joined}");
  67. assert!(joined.contains(&format!("--depth {DEPTHS}")), "{joined}");
  68. assert!(
  69. joined.contains(&format!("--concurrency {CONCURRENCY}")),
  70. "{joined}"
  71. );
  72. assert!(
  73. joined.contains(&format!("--benchy-runs {RUNS}")),
  74. "{joined}"
  75. );
  76. assert!(!joined.contains("--tokenizer"), "{joined}");
  77. }
  78. #[test]
  79. fn depths_exclude_the_covered_points() {
  80. let depths: Vec<u32> = DEPTHS.split(',').map(|d| d.parse().unwrap()).collect();
  81. assert_eq!(depths, vec![16384, 65536, 131072, 262144]);
  82. assert!(!depths.contains(&0) && !depths.contains(&8192));
  83. }
  84. #[test]
  85. fn tokenizer_forwarded_when_given() {
  86. let a = depth_args("u", "m", 42, Some(&"/tmp/tok".to_string()));
  87. assert!(a.contains(&"--tokenizer".to_string()));
  88. assert!(a.contains(&"/tmp/tok".to_string()));
  89. }
  90. }