Skip to content

Commit

Permalink
[HOTFIX] Fix build error due to missing Miir.h when MIOPEN_USE_MLIR…
Browse files Browse the repository at this point in the history
…=0 and MLIR library is not available (#909)

Co-authored-by: Artem Tamazov <[email protected]>
  • Loading branch information
jerryyin and atamazov authored May 8, 2021
1 parent 46fbbbf commit 3e470a5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
3 changes: 1 addition & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ set( MIOpen_Source
conv/invokers/gen_x_w_y_pad.cpp
conv/invokers/ocl_wrw_rdc.cpp
conv/invokers/impl_gemm.cpp
conv/invokers/mlir_impl_gemm.cpp
conv/invokers/impl_gemm_dynamic.cpp
invoker_cache.cpp
tensor.cpp
Expand Down Expand Up @@ -585,7 +584,7 @@ if(MIOPEN_USE_COMGR)
endif()

if(MIOPEN_USE_MLIR)
list(APPEND MIOpen_Source mlir_build.cpp)
list(APPEND MIOpen_Source mlir_build.cpp conv/invokers/mlir_impl_gemm.cpp)
endif()

# build library
Expand Down
19 changes: 1 addition & 18 deletions src/conv/invokers/mlir_impl_gemm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ namespace miopen {
namespace conv {

namespace {
#if MIOPEN_USE_MLIR
struct MlirConvArgs
{
StridedMemRef5D filter;
Expand Down Expand Up @@ -164,7 +163,7 @@ void SetMlirConvArgsPtr(ConstData_t in, ConstData_t out, ConstData_t w, MlirConv
// NOLINTNEXTLINE (cppcoreguidelines-pro-type-const-cast)
input = const_cast<void*>(in);
// NOLINTNEXTLINE (cppcoreguidelines-pro-type-const-cast)
output = const_cast<void*>(out);
output = const_cast<void*>(out);
#endif

if((filter == nullptr) || (input == nullptr) || (output == nullptr))
Expand All @@ -177,12 +176,10 @@ void SetMlirConvArgsPtr(ConstData_t in, ConstData_t out, ConstData_t w, MlirConv
args.output.basePtr = output;
args.output.data = output;
}
#endif
} // Anonymous namespace

InvokerFactory MakeMlirFwdInvokerFactory(const ConvolutionContext& ctx)
{
#if MIOPEN_USE_MLIR
assert((ctx.direction.IsForward()));

std::vector<size_t> in_dims, in_strides;
Expand All @@ -209,15 +206,10 @@ InvokerFactory MakeMlirFwdInvokerFactory(const ConvolutionContext& ctx)
handle.Run(kernels[0])(args);
};
};
#else
std::ignore = ctx;
return {};
#endif
}

InvokerFactory MakeMlirBwdInvokerFactory(const ConvolutionContext& ctx)
{
#if MIOPEN_USE_MLIR
assert(ctx.direction.IsBackwardData());

std::vector<size_t> in_dims, in_strides;
Expand Down Expand Up @@ -269,15 +261,10 @@ InvokerFactory MakeMlirBwdInvokerFactory(const ConvolutionContext& ctx)
}
};
};
#else
std::ignore = ctx;
return {};
#endif
}

InvokerFactory MakeMlirWrWInvokerFactory(const ConvolutionContext& ctx)
{
#if MIOPEN_USE_MLIR
assert((ctx.direction.IsBackwardWrW()));

std::vector<size_t> in_dims, in_strides;
Expand All @@ -302,10 +289,6 @@ InvokerFactory MakeMlirWrWInvokerFactory(const ConvolutionContext& ctx)
handle.Run(kernels[0])(args);
};
};
#else
std::ignore = ctx;
return {};
#endif
}

} // namespace conv
Expand Down

0 comments on commit 3e470a5

Please sign in to comment.