[BE] Fix edge case in translation validation bisector (#145414)

This patch fixes a small bug for the binary-search algorithm in
translation validation bisector. Fixes #131303.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/145414
Approved by: https://github.com/ysiraichi, https://github.com/zou3519
This commit is contained in:
Ryan Guo
2025-01-22 14:23:11 -08:00
committed by PyTorch MergeBot
parent 045698653a
commit a86fa779ce
2 changed files with 6 additions and 0 deletions

View File

@ -819,7 +819,13 @@ def bisect(shape_env):
]
# Preparing the indices for binary search.
# The overall invariants are
# - for all i < left, assert_node[i] doesn't fail
# - for all i >= right, assert_node[i] fails
# - `right in exception` always holds
# - `left <= right` always holds
left, mid, right = 0, 0, len(assert_nodes) - 1
exception[right] = check_node_fails(assert_nodes[right])
while left < right:
mid = (left + right) // 2