Skip to content

Commit 599f94e

Browse files
xuhancnpytorchmergebot
authored andcommitted
[AOTI] add Windows file ext to package loader. (#158578)
Add `object` and `extension` file type for Windows Pull Request resolved: #158578 Approved by: https://github.com/angelayi
1 parent 04ac258 commit 599f94e

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

torch/csrc/inductor/aoti_package/model_package_loader.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,22 @@ std::string create_temp_dir() {
9393
return temp_dir;
9494
#endif
9595
}
96+
97+
const char* object_file_ext() {
98+
#ifdef _WIN32
99+
return ".obj";
100+
#else
101+
return ".o";
102+
#endif
103+
}
104+
105+
const char* extension_file_ext() {
106+
#ifdef _WIN32
107+
return ".pyd";
108+
#else
109+
return ".so";
110+
#endif
111+
}
96112
} // namespace
97113

98114
namespace torch::inductor {
@@ -515,9 +531,9 @@ AOTIModelPackageLoader::AOTIModelPackageLoader(
515531
std::string filename_extension = output_path_str.substr(extension_idx);
516532
if (filename_extension == ".cpp") {
517533
cpp_filename = output_path_str;
518-
} else if (filename_extension == ".o") {
534+
} else if (filename_extension == object_file_ext()) {
519535
obj_filenames.push_back(output_path_str);
520-
} else if (filename_extension == ".so") {
536+
} else if (filename_extension == extension_file_ext()) {
521537
so_filename = output_path_str;
522538
}
523539
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy