Skip to content

Commit

Permalink
Merge pull request PaddlePaddle#30 from mthreads/cmakelist
Browse files Browse the repository at this point in the history
[MTAI-484] fix(build): enable -Werror in CMakelist.txt
  • Loading branch information
caizhi-mt authored and mt-robot committed Aug 10, 2023
2 parents 7180366 + 502d524 commit 53539d2
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions cmake/flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ if(NOT WIN32)
-fPIC
-fno-omit-frame-pointer
-Wall
-Werror
-Wextra
-Wno-unused-parameter
-Wno-unused-function
Expand Down
17 changes: 17 additions & 0 deletions cmake/musa.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@ include_directories(/usr/lib/llvm-11/include/openmp/)
#endmacro()
#find_musa_version(${MUSA_PATH}/version.h)

list(APPEND MUSA_MCC_FLAGS -Wno-unknown-warning-option)
list(APPEND MUSA_MCC_FLAGS -Wno-macro-redefined)
list(APPEND MUSA_MCC_FLAGS -Wno-unused-variable)
list(APPEND MUSA_MCC_FLAGS -Wno-return-type)
list(APPEND MUSA_MCC_FLAGS -Wno-sign-compare)
list(APPEND MUSA_MCC_FLAGS -Wno-mismatched-tags)
list(APPEND MUSA_MCC_FLAGS -Wno-pessimizing-move)
list(APPEND MUSA_MCC_FLAGS -Wno-unused-but-set-variable)
list(APPEND MUSA_MCC_FLAGS -Wno-bitwise-instead-of-logical)
list(APPEND MUSA_MCC_FLAGS -Wno-format)
list(APPEND MUSA_MCC_FLAGS -Wno-unused-local-typedef)
list(APPEND MUSA_MCC_FLAGS -Wno-reorder-ctor)
list(APPEND MUSA_MCC_FLAGS -Wno-braced-scalar-init)
list(APPEND MUSA_MCC_FLAGS -Wno-pass-failed)
list(APPEND MUSA_MCC_FLAGS -Wno-missing-braces)
list(APPEND MUSA_MCC_FLAGS -Wno-dangling-gsl)

if(WITH_CINN)
list(APPEND MUSA_MCC_FLAGS -std=c++14)
else()
Expand Down
4 changes: 2 additions & 2 deletions paddle/fluid/platform/dynload/musa_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extern bool HasCUDADriver();
/**
* include all needed musa driver functions
**/
#define MUSA_ROUTINE_EACH(__macro) \
#define PLATFORM_MUSA_ROUTINE_EACH(__macro) \
__macro(muInit); \
__macro(muDriverGetVersion); \
__macro(muGetErrorString); \
Expand All @@ -49,7 +49,7 @@ extern bool HasCUDADriver();
__macro(muDeviceGetAttribute); \
__macro(muDeviceGet)

MUSA_ROUTINE_EACH(PLATFORM_DECLARE_DYNAMIC_LOAD_MUSA_WRAP);
PLATFORM_MUSA_ROUTINE_EACH(PLATFORM_DECLARE_DYNAMIC_LOAD_MUSA_WRAP);

#undef PLATFORM_DECLARE_DYNAMIC_LOAD_MUSA_WRAP

Expand Down
3 changes: 3 additions & 0 deletions paddle/phi/backends/device_code.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ void GPUDeviceCode::CheckAvailableStatus() {
if (CheckCUDADriverResult(dynload::hipGetDeviceCount(&count),
"hipGetDeviceCount")) {
#elif defined(PADDLE_WITH_MUSA)
(void)count;
// TODO(@caizhi): enable dynload module
// if (CheckCUDADriverResult(dynload::muDeviceGetCount(&count),
// "muDeviceGetCount")) {
Expand Down Expand Up @@ -472,6 +473,8 @@ void GPUDeviceCode::Launch(const size_t n, std::vector<void*>* args) const {
errors::External("Fail to launch kernel %s (in hipModuleLaunchKernel.)",
name_.c_str()));
#elif defined(PADDLE_WITH_MUSA)
(void)num_blocks;
(void)dev_ctx;
// TODO(@caizhi): enable dynload module
// PADDLE_ENFORCE_EQ(
// dynload::muLaunchKernel(function_,
Expand Down
3 changes: 1 addition & 2 deletions paddle/phi/backends/gpu/gpu_resources.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,9 @@ void InitGpuProperties(Place place,
*driver_version = backends::gpu::GetGPUDriverVersion(place.GetDeviceId());
*runtime_version = backends::gpu::GetGPURuntimeVersion(place.GetDeviceId());

#ifdef PADDLE_WITH_CUDA
const gpuDeviceProp& prop =
backends::gpu::GetDeviceProperties(place.GetDeviceId());

#ifdef PADDLE_WITH_CUDA
static const std::set<int> compiled_archs{CUDA_REAL_ARCHS};
// Make sure compiled cuda arch is as same as runtime cuda arch.
if (compiled_archs.find(*compute_capability) == compiled_archs.cend() &&
Expand Down
1 change: 1 addition & 0 deletions paddle/phi/kernels/impl/matmul_kernel_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,7 @@ void MatmulWithFlattenKernel(const Context& dev_ctx,

auto blas = phi::funcs::GetBlas<Context, T>(dev_ctx);

(void)blas;
// TODO(@caizhi): enable it
//blas.MatMul(x_matrix, y_matrix, out);
if (z_dim.size() != 2) {
Expand Down

0 comments on commit 53539d2

Please sign in to comment.