CPU Inductor freezing can produce tiny numeric differences in Detectron2 mask logits. Those differences are thresholded into boolean pred_masks, so exact bool equality is too strict for these segmentation outputs. The benchmark harness already has an IoU-based bool mask comparator for this class of model, but torch._dynamo.utils.same() dropped use_iou_for_bool and iou_threshold when recursing through Detectron2 Instances objects. As a result, Instances.pred_masks still used exact equality and the affected Mask R-CNN models remained fail_accuracy under freezing.
Propagate the bool-mask IoU options through the object and numpy recursive same() paths, enable the existing IoU comparator for the two affected Detectron2 Mask R-CNN models, and update the CPU freezing expected-accuracy files to pass.
Fixes #127073
Generated by my agent
Test Plan:
python test/dynamo/test_utils.py -k TestUtils.test_same_iou_for_bool_propagates_to_instances
python -m unittest benchmarks.dynamo.test.TestDynamoBenchmark.test_detectron2_maskrcnn_uses_iou_for_bool_masks
Local Detectron2 benchmark workaround for detectron2_maskrcnn_r_101_fpn and detectron2_maskrcnn_r_50_c4 with --accuracy --inference --device cpu --inductor --freezing reported pass
git diff --check
lintrunner -a (fails on unrelated existing Pyrefly error in torch/autograd/graph.py for torch._C._remove_obj_from_tls)
Pull Request resolved: #186441
Approved by: https://github.com/eellison, https://github.com/mlazos
SOCIAL SHARE CARD GENERATOR