This is an automated email from the ASF dual-hosted git repository.

MasterJH5574 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-ffi.git


The following commit(s) were added to refs/heads/main by this push:
     new 59da4c0  [TEST] Relax test_shared_dag_hash_scaling_not_exponential 
ratio to 4x (#612)
59da4c0 is described below

commit 59da4c0b82af0d499dae34bd89ef010f64d3ff45
Author: Tianqi Chen <[email protected]>
AuthorDate: Sat Jun 6 10:03:14 2026 -0400

    [TEST] Relax test_shared_dag_hash_scaling_not_exponential ratio to 4x (#612)
    
    The timing-based assertion `t19 <= t18 * 2.0` was flaky at microsecond
    scales. CI frequently measures t18~4μs and t19~8μs; at that resolution
    any clock jitter can double the reading, pushing t19 over a 2x ceiling
    without any algorithmic regression.
    
    Raising the threshold to 4x removes the false-positive noise while still
    catching true exponential blow-up: without memoization the ratio
    compounds
    far past 4x within a few depth steps, so the test retains its intended
    diagnostic value.
    
    Failing CI example:
    AssertionError: Unexpected super-linear scaling: d18=0.000004s
    d19=0.000008s
---
 tests/python/test_dataclass_hash.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/python/test_dataclass_hash.py 
b/tests/python/test_dataclass_hash.py
index a79c519..c3504cc 100644
--- a/tests/python/test_dataclass_hash.py
+++ b/tests/python/test_dataclass_hash.py
@@ -862,8 +862,12 @@ def test_shared_dag_hash_scaling_not_exponential() -> None:
         RecursiveHash(d19)
     t19 = (time.perf_counter() - t0) / repeats
 
-    # With memoization this ratio should stay close to 1x; 1.6x leaves buffer 
for noise.
-    assert t19 <= t18 * 2.0, f"Unexpected super-linear scaling: d18={t18:.6f}s 
d19={t19:.6f}s"
+    # With memoization this ratio should stay close to 1x. Threshold 4x leaves
+    # buffer for microsecond-scale measurement noise (CI runs frequently see
+    # t18~4us, t19~8us where small jitter blows past a 2x ceiling) while
+    # still catching true exponential blowup, which compounds far past 4x
+    # within a few depth steps.
+    assert t19 <= t18 * 4.0, f"Unexpected super-linear scaling: d18={t18:.6f}s 
d19={t19:.6f}s"
 
 
 # ---------------------------------------------------------------------------

Reply via email to