Skip to content

Commit

Permalink
Reverted names i.e., mlir_offload.hpp to fuse_mlir.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
ravil-mobile committed Sep 4, 2023
1 parent 7164e3f commit 7fbd297
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
15 changes: 7 additions & 8 deletions src/targets/gpu/fuse_mlir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "migraphx/shape.hpp"
#include <migraphx/gpu/mlir_offload.hpp>
#include <migraphx/gpu/fuse_mlir.hpp>
#include <migraphx/gpu/mlir.hpp>
#include <migraphx/matcher.hpp>
#include <migraphx/pass_manager.hpp>
Expand Down Expand Up @@ -327,11 +326,11 @@ struct find_mlir_standalone_convolution_op
};

MIGRAPHX_DECLARE_ENV_VAR(MIGRAPHX_MLIR_ENABLE_OPS);
bool is_self_decide() { return env(MIGRAPHX_MLIR_ENABLE_OPS::value()).empty(); }
bool is_self_decide() { return string_value_of(MIGRAPHX_MLIR_ENABLE_OPS{}, "").empty(); }

bool is_requested(std::string_view option)
{
assert(enabled(MIGRAPHX_MLIR_ENABLE_OPS{}));
assert(not is_self_decide());
auto string_value = string_value_of(MIGRAPHX_MLIR_ENABLE_OPS{}, "");
static const char delim{','};
string_value.push_back(delim);
Expand All @@ -351,18 +350,18 @@ bool is_fusion_enabled()

bool is_standalone_convs_enabled(const std::string& gfx_name)
{
const std::string navi_family{"gfx110"};
if(is_self_decide() and starts_with(gfx_name, navi_family))
if(is_self_decide())
{
return true;
const std::string navi_family{"gfx110"};
return starts_with(gfx_name, navi_family);
}
return is_requested("conv");
}
} // namespace

#endif // MIGRAPHX_MLIR

void mlir_offload::apply(module_pass_manager& mpm) const
void fuse_mlir::apply(module_pass_manager& mpm) const
{
#ifdef MIGRAPHX_MLIR
if(is_fusion_enabled())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MIGRAPHX_GUARD_GPU_MLIR_OFFLOAD_HPP
#define MIGRAPHX_GUARD_GPU_MLIR_OFFLOAD_HPP
#ifndef MIGRAPHX_GUARD_GPU_FUSE_MLIR_HPP
#define MIGRAPHX_GUARD_GPU_FUSE_MLIR_HPP

#include <migraphx/gpu/context.hpp>

Expand All @@ -35,15 +35,15 @@ namespace gpu {

MIGRAPHX_GPU_EXPORT bool mlir_enabled();

struct MIGRAPHX_GPU_EXPORT mlir_offload
struct MIGRAPHX_GPU_EXPORT fuse_mlir
{
context* ctx = nullptr;
std::string name() const { return "gpu::mlir_offload"; }
std::string name() const { return "gpu::fuse_mlir"; }
void apply(module_pass_manager& mpm) const;
};

} // namespace gpu

} // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx
#endif // MIGRAPHX_GUARD_GPU_MLIR_OFFLOAD_HPP
#endif // MIGRAPHX_GUARD_GPU_FUSE_MLIR_HPP
4 changes: 2 additions & 2 deletions src/targets/gpu/target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#include <migraphx/gpu/context.hpp>
#include <migraphx/gpu/device_name.hpp>
#include <migraphx/gpu/fuse_ck.hpp>
#include <migraphx/gpu/mlir_offload.hpp>
#include <migraphx/gpu/fuse_mlir.hpp>
#include <migraphx/gpu/fuse_ops.hpp>
#include <migraphx/gpu/prefuse_ops.hpp>
#include <migraphx/gpu/lowering.hpp>
Expand Down Expand Up @@ -142,7 +142,7 @@ std::vector<pass> target::get_passes(migraphx::context& gctx, const compile_opti
enable_pass(enabled(MIGRAPHX_ENABLE_CK{}), fuse_ck{}),
#endif
dead_code_elimination{},
enable_pass(mlir_enabled(), mlir_offload{&ctx}),
enable_pass(mlir_enabled(), fuse_mlir{&ctx}),
dead_code_elimination{},
lowering{&ctx, options.offload_copy},
eliminate_contiguous{"gpu::contiguous"},
Expand Down
4 changes: 2 additions & 2 deletions test/gpu/fuse_mlir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
#include <migraphx/dead_code_elimination.hpp>
#include <migraphx/gpu/mlir_offload.hpp>
#include <migraphx/gpu/fuse_mlir.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/pass_manager.hpp>
#include <migraphx/program.hpp>
Expand All @@ -34,7 +34,7 @@

void run_pass(migraphx::program& p)
{
migraphx::run_passes(p, {migraphx::gpu::mlir_offload{}, migraphx::dead_code_elimination{}});
migraphx::run_passes(p, {migraphx::gpu::fuse_mlir{}, migraphx::dead_code_elimination{}});
}

template <class F>
Expand Down
2 changes: 1 addition & 1 deletion test/gpu/quantization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
#include <iostream>
#include <vector>
#include <migraphx/gpu/mlir_offload.hpp>
#include <migraphx/gpu/fuse_mlir.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/quantization.hpp>
Expand Down

0 comments on commit 7fbd297

Please sign in to comment.