Fix ONNX Runtime CPU memory arena configuration (#25003)

* Fix CPU memory arena option on ONNX Runtime sessions

* Limit CPU arena correction to CPU enrichment sessions

* Retain default arena in GPU runner integration regression

* Preserve native detector session-options contract
This commit is contained in:
Rmdev.pro
2026-11-18 15:36:11 -07:00
committed by GitHub
parent 6c09629783
commit 3c122150ae
4 changed files with 18 additions and 16 deletions
+10 -2
View File
@@ -59,10 +59,18 @@ class TestGetOrtSessionOptions(unittest.TestCase):
ort.GraphOptimizationLevel.ORT_ENABLE_ALL,
)
def test_only_cpu_enrichment_models_disable_the_cpu_arena(self):
for model_type in EnrichmentModelTypeEnum:
for cpu in [False, True]:
with self.subTest(model_type=model_type, cpu=cpu):
options = get_ort_session_options(model_type.value, cpu=cpu)
self.assertEqual(options.enable_cpu_mem_arena, not cpu)
def test_detector_models_use_defaults(self):
for model_type in [None, ModelTypeEnum.rfdetr.value]:
with self.subTest(model_type=model_type):
self.assertIsNone(get_ort_session_options(model_type, cpu=True))
for cpu in [False, True]:
with self.subTest(model_type=model_type, cpu=cpu):
self.assertIsNone(get_ort_session_options(model_type, cpu=cpu))
class TestCudaGraphRunner(unittest.TestCase):
+4 -1
View File
@@ -140,6 +140,9 @@ class TestLoadRegistry(unittest.TestCase):
spinning = None
self.assertEqual(spinning, expected)
self.assertEqual(
options.enable_cpu_mem_arena, provider != "CPUExecutionProvider"
)
class TestLoadedDeviceSnapshot(unittest.TestCase):
@@ -560,4 +563,4 @@ class TestMIGraphX(unittest.TestCase):
providers, options = model_util.get_ort_providers()
self.assertEqual(providers, ["CPUExecutionProvider"])
self.assertEqual(options, [{"enable_cpu_mem_arena": False}])
self.assertEqual(options, [{}])