MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / compile

Method compile

src/compile_src.cpp:36–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34inline namespace MIGRAPHX_INLINE_NS {
35
36std::vector<char> src_compiler::compile(const std::vector<src_file>& srcs) const
37{
38 assert(not srcs.empty());
39 tmp_dir td{"compile"};
40 std::vector<std::string> params{flags};
41
42 params.emplace_back("-I.");
43
44 auto out = output;
45
46 for(const auto& src : srcs)
47 {
48 fs::path full_path = td.path / src.path;
49 fs::path parent_path = full_path.parent_path();
50 fs::create_directories(parent_path);
51 write_buffer(full_path, src.content.data(), src.content.size());
52 if(src.path.extension().string() == ".cpp")
53 {
54 params.emplace_back(src.path.filename().string());
55 if(out.empty())
56 out = src.path.stem().string() + out_ext;
57 }
58 }
59
60 params.emplace_back("-o " + out);
61
62 std::vector<std::string> args;
63 if(not launcher.empty())
64 args.push_back(compiler.string());
65 args.insert(args.end(), params.begin(), params.end());
66 td.execute(launcher.empty() ? compiler : launcher, args);
67
68 auto out_path = td.path / out;
69 if(not fs::exists(out_path))
70 MIGRAPHX_THROW("Output file missing: " + out);
71
72 return read_buffer(out_path);
73}
74
75} // namespace MIGRAPHX_INLINE_NS
76} // namespace migraphx

Callers

nothing calls this directly

Calls 11

write_bufferFunction · 0.85
read_bufferFunction · 0.85
emplace_backMethod · 0.80
emptyMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected