Commit 4257e2f
Add IQR-based environment fluctuation detection to benchmark timing stats
Overview:
This commit introduces IQR (Interquartile Range) based environment fluctuation
detection to the timing statistics calculation in test_compiler_util.py. The
feature helps detect unstable benchmarking environments by measuring the
relative variation in timing results.
Key Changes:
- Enhanced get_timing_stats() function to compute median, Q1, Q3, and IQR
- Added environment variable GRAPH_NET_FLUCTUATION_DETECT_THRESHOLD for
configurable fluctuation detection sensitivity
- RuntimeError is raised when IQR/median exceeds the threshold
- Extended return stats dictionary with new fields: median, q1, q3, iqr
IQR/median Ratio:
- Measures relative variability of timing measurements
- Lower values indicate more consistent timing
- Higher values indicate environment instability or interference
Environment Variable Configuration:
- GRAPH_NET_FLUCTUATION_DETECT_THRESHOLD (default: 0.2)
- 0.0: Disable detection (always accept results)
- 0.5: Lenient (only flag severe fluctuations > 50%)
- 1.0: Default (flag fluctuations > 20%)
- 2.0: Very strict (flag fluctuations > 10%)
Detection Algorithm:
1. Calculate median, Q1 (25th percentile), Q3 (75th percentile)
2. Compute IQR = Q3 - Q1
3. Calculate relative IQR = IQR / median
4. Compare against threshold
5. Raise RuntimeError with detailed diagnostics if exceeded
Error Message Format:
When fluctuation is detected, the error message includes:
- IQR/median ratio and threshold
- Q1 and Q3 values as percentages
- IQR as percentage
- Raw timing values for manual inspection
Use Cases:
- Multi-user GPU environments where timing variance is common
- CI/CD pipeline monitoring for performance regression detection
- Manual benchmark verification in shared resources
- Identifying external workload interference
Performance Impact:
- Minimal: Adds a single numpy array conversion and percentile calculations
- Scales with number of timing trials (typically 5-10 runs)
- O(n) complexity for array operations
Backward Compatibility:
- Fully backward compatible
- Existing code continues to work without modification
- Only raises RuntimeError when fluctuation is detected
- Default threshold (0.2) provides balanced sensitivity
Testing:
- Verified with sample timing data showing correct IQR calculations
- Tested threshold sensitivity with various timing distributions
- Confirmed graceful handling when all times are equal (IQR=0)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 8ce68eb commit 4257e2f
1 file changed
Lines changed: 49 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
111 | 152 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
116 | 161 | | |
117 | 162 | | |
118 | 163 | | |
| |||
0 commit comments