Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/targets/gpu/compile_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ struct compile_manager
par_compile(cps.size(), [&](auto i) { cps[i].update_config(exhaustive); });
}

void compile(module& m)
void compile(module& m, bool is_root)
{
std::vector<std::function<void()>> compiles;
for(auto& cp : cps)
Expand Down Expand Up @@ -558,7 +558,11 @@ struct compile_manager
}
}

if(dump_mxr)
// Only throw on the root module so that submodules (which are processed
// first by the pass manager and may legitimately have no precompile ops
// or no multi-solution candidates) don't abort compilation before the
// root module has had a chance to dump its benchmark MXR files.
if(dump_mxr and is_root)
{
MIGRAPHX_THROW(
"Benchmark MXR files dumped to " + mxr_path +
Expand All @@ -573,8 +577,10 @@ struct compile_manager
}
};

void compile_ops::apply(module& m) const
void compile_ops::apply(module_pass_manager& mpm) const
{
bool is_root = &mpm.get_module() == mpm.get_root_module();
auto& m = mpm.get_module();
compile_manager cm;
Comment thread
ahsan-ca marked this conversation as resolved.
cm.exhaustive = exhaustive_tune;
// Find all precompile ops
Expand All @@ -586,9 +592,9 @@ void compile_ops::apply(module& m) const
cm.add_plan(ctx, preop, ins, &m);
}
cm.update_configs();
cm.compile(m);
cm.compile(m, is_root);
// Compile already tuned configs
cm.compile(m);
cm.compile(m, is_root);
assert(cm.cps.empty());
}

Expand Down
6 changes: 3 additions & 3 deletions src/targets/gpu/include/migraphx/gpu/compile_ops.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -30,7 +30,7 @@
namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {

struct module;
struct module_pass_manager;

namespace gpu {

Expand All @@ -41,7 +41,7 @@ struct MIGRAPHX_GPU_EXPORT compile_ops
context* ctx = nullptr;
bool exhaustive_tune = false;
std::string name() const { return "gpu::compile_ops"; }
void apply(module& m) const;
void apply(module_pass_manager& mpm) const;
};

} // namespace gpu
Expand Down
Loading