Use default value on empty llvm_code_path (#72758)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72758

Bug: FLAGS_output_llvm option was introduced recently to specify LLVM assembly code file. Without previously default value, now the llvm code is not being saved to a file if asmfile input is not specified and is resulting in making the compiled output unusable.

Fix: Use default value if output_llvm/asmfile input is not specified.

Test Plan: Verified that output is saved to deafult .ll file path

Reviewed By: IvanKobzarev

Differential Revision: D34189107

fbshipit-source-id: ee51e8c17de92d3045690ca871fb9569fc3164d6
(cherry picked from commit 46352d446b3e9d7df0eddf0a29790de6f7757d26)
This commit is contained in:
Priya Ramani
2022-02-11 16:25:45 -08:00
committed by PyTorch MergeBot
parent dce84b9c83
commit 444191de56

View File

@ -97,6 +97,10 @@ int main(int argc, char** argv) {
split(';', FLAGS_input_dims).size() ==
split(';', FLAGS_input_types).size(),
"Number of input_dims and input_types should be the same");
if (FLAGS_output_llvm.empty()) {
FLAGS_output_llvm =
FLAGS_model.substr(0, FLAGS_model.find('.')) + ".compiled.ll";
}
std::string output_model_name = FLAGS_output_model;
if (output_model_name.empty()) {