hsa: scale the data chunk threshold for echo client tput based on fifo size 35/42935/4
authorSemir Sionek <[email protected]>
Fri, 9 May 2025 12:16:54 +0000 (08:16 -0400)
committerFlorin Coras <[email protected]>
Fri, 9 May 2025 20:47:15 +0000 (20:47 +0000)
Type: improvement
Change-Id: I37636f4d4c3949c36ead71e602754ccdb07b9c7a
Signed-off-by: Semir Sionek <[email protected]>
src/plugins/hs_apps/echo_client.c

index 1c0e49c..54e806a 100644 (file)
@@ -653,8 +653,19 @@ ec_calc_tput (ec_main_t *ecm)
   ec_session_t *sess;
   f64 pacing_base;
   u64 bytes_paced_target;
-  /* periodic writes larger than this clog up the fifo */
-  const u64 target_size_threshold = 4344;
+  u64 target_size_threshold;
+
+  /* Choose an appropriate data size chunk threshold based on fifo size.
+     ~30k is fine for most scenarios, unless the fifo starts getting
+     smaller than 48k, where a slight curve is needed. */
+  if (PREDICT_TRUE (ecm->fifo_size > 49152))
+    target_size_threshold = 30720;
+  else if (ecm->fifo_size > 20480)
+    target_size_threshold = 12288;
+  else if (ecm->fifo_size > 10240)
+    target_size_threshold = 6144;
+  else
+    target_size_threshold = ecm->fifo_size;
 
   /* find a suitable pacing window length & data chunk size */
   bytes_paced_target =