Fix a backend test by using local backend (#19230)

The decomposition pass (e.g., converting torch.add to aten.add) in DORT
no longer exists. Therefore, we have to use `use_aot_autograd=True` to
enable Dynamo's built-in operator decomposition. I think we need to add
the decomposition pass back to DORT or remove `use_aot_autograd` (remove
because it will always be `true`).
This commit is contained in:
Wei-Sheng Chin 2024-01-23 14:57:30 -08:00 committed by GitHub
parent f53068446e
commit 532f8c642c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -216,7 +216,12 @@ class TestTorchDynamoOrt(unittest.TestCase):
tensor_q = tensor_p.relu()
return tensor_q
local_backend = make_local_backend(dynamic=True, use_aot_autograd=False)
# TODO: Set use_aot_autograd=False. In order to decompose torch
# function calls to aten ops, we need to set
# user_aot_autograd=True because there is no decomposition in DORT
# anymore. A long-term fix will be brining # decomposition pass back
# into DORT.
local_backend = make_local_backend(dynamic=True, use_aot_autograd=True)
optimized_elementwise_model = torch.compile(elementwise_model, backend=local_backend, dynamic=True)
def run(fun, list_x):