-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Autogen dummy _REFERENCE_LAZY_BACKEND library when LTC is disabled
- Loading branch information
Showing
3 changed files
with
69 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
python/torch_mlir/csrc/reference_lazy_backend/gen_dummy_lib.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# When LTC is disabled in Torch-MLIR build, we will generate a dummy module to | ||
# ensure that no import errors occur. | ||
|
||
import sys | ||
import os | ||
|
||
if __name__ == '__main__': | ||
path = sys.argv[1] # dummy script path | ||
file_name = sys.argv[2] # dummy script | ||
|
||
contents = ''' | ||
# This file was automatically generated due to LTC being disabled in build. | ||
class LazyTensorCoreTestConfig: | ||
def __init__(self): | ||
assert False, "LTC is not enabled. Check the value of `TORCH_MLIR_ENABLE_LTC`" | ||
''' | ||
|
||
if not os.path.exists(path): | ||
os.makedirs(path) | ||
|
||
with open(os.path.join(path, file_name + '.py'), 'w') as file: | ||
file.write(contents) |