Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
co63oc committed Sep 17, 2024
2 parents e8a3d78 + ddd4f78 commit c7d1473
Show file tree
Hide file tree
Showing 1,124 changed files with 31,396 additions and 33,474 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,4 @@ paddle/phi/kernels/fusion/cutlass/conv2d/build
paddle/phi/kernels/fusion/cutlass/conv2d/cutlass
paddle/phi/kernels/fusion/cutlass/gemm_epilogue/build
paddle/phi/kernels/fusion/cutlass/gemm_epilogue/cutlass
python/paddle/_typing/libs/**/*.pyi
3 changes: 2 additions & 1 deletion cmake/ccache.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if(NOT WIN32)
find_program(CCACHE_PATH ccache)
if(CCACHE_PATH)
execute_process(COMMAND ccache -V OUTPUT_VARIABLE ccache_output)
execute_process(COMMAND ccache -s cache directory
execute_process(COMMAND ccache -v -s cache directory
OUTPUT_VARIABLE cache_directory)
string(REGEX MATCH "[0-9]+.[0-9]+" ccache_version ${ccache_output})
message(STATUS "ccache is founded, use ccache to speed up compile on Unix.")
Expand All @@ -14,6 +14,7 @@ if(NOT WIN32)
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PATH})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PATH})
set(CMAKE_CUDA_COMPILER_LAUNCHER ${CCACHE_PATH})
set(CMAKE_HIP_COMPILER_LAUNCHER ${CCACHE_PATH})
endif()
elseif("${CMAKE_GENERATOR}" STREQUAL "Ninja")
# (Note:zhouwei25) Only Ninja Generator can support sccache now
Expand Down
5 changes: 5 additions & 0 deletions cmake/cuda.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ function(select_nvcc_arch_flags out_variable out_arch_bin)
string(REPLACE ";" " " nvcc_archs_readable "${nvcc_archs_readable}")
string(REGEX MATCHALL "[0-9()]+" nvcc_archs_bin_list "${nvcc_archs_bin_list}")
string(JOIN "," nvcc_real_archs ${nvcc_archs_bin_list})

set(COMPILED_CUDA_ARCHS
"${nvcc_real_archs}"
CACHE STRING "Specify compiled cuda archs.")

set(${out_variable}
${nvcc_flags}
PARENT_SCOPE)
Expand Down
2 changes: 1 addition & 1 deletion cmake/external/afs_api.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if((NOT DEFINED AFSAPI_VER) OR (NOT DEFINED AFSAPI_URL))
"afs_api"
CACHE STRING "" FORCE)
set(AFSAPI_URL
"https://pslib.bj.bcebos.com/afs_api_so.tar.gz"
"https://fleet.bj.bcebos.com/heterps/afs_api.tar.gz"
CACHE STRING "" FORCE)
endif()
message(STATUS "AFSAPI_NAME: ${AFSAPI_NAME}, AFSAPI_URL: ${AFSAPI_URL}")
Expand Down
1 change: 1 addition & 0 deletions cmake/external/flashattn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ if(WITH_ROCM)
#BUILD_ALWAYS 1
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${ROCM_PATH}/bin/hipcc
-DAMDGPU_TARGETS=gfx928
-DCMAKE_CXX_COMPILER_LAUNCHER=${CCACHE_PATH}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS=${FLASHATTN_C_FLAGS}
-DCMAKE_C_FLAGS_DEBUG=${FLASHATTN_C_FLAGS_DEBUG}
Expand Down
24 changes: 7 additions & 17 deletions cmake/external/xpu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ if(NOT DEFINED XPU_XRE_BASE_VERSION)
set(XPU_XRE_BASE_VERSION "4.32.0.1")
endif()
if(NOT DEFINED XPU_XHPC_BASE_DATE)
set(XPU_XHPC_BASE_DATE "20240818")
set(XPU_XHPC_BASE_DATE "eb35/20240906")
endif()
set(XPU_XCCL_BASE_VERSION "1.2.9")
set(XPU_XCCL_BASE_VERSION "1.2.11c")
if(NOT DEFINED XPU_XFT_BASE_VERSION)
set(XPU_XFT_BASE_VERSION "20230602")
endif()
Expand Down Expand Up @@ -69,19 +69,9 @@ if(WITH_XPU_XRE5)
)
endif()

if(WITH_XCCL_RDMA)
set(XPU_XCCL_PREFIX "xccl_rdma-")
else()
set(XPU_XCCL_PREFIX "xccl_socket-")
# NOTE(lijin23): socket has not been supported for XPU3, so the xccl output name was changed.
if(WITH_XPU_XRE5)
set(XPU_XCCL_PREFIX "xccl_")
endif()
endif()

if(WITH_AARCH64)
set(XPU_XRE_DIR_NAME "xre-kylin_aarch64")
set(XPU_XCCL_DIR_NAME "${XPU_XCCL_PREFIX}kylin_aarch64")
set(XPU_XCCL_DIR_NAME "") # TODO: xccl has no kylin output now.
set(XPU_XFT_DIR_NAME "") # TODO: xft has no kylin output at now.
elseif(WITH_SUNWAY)
set(XPU_XRE_DIR_NAME "xre-deepin_sw6_64")
Expand All @@ -94,11 +84,11 @@ elseif(WITH_BDCENTOS)
else()
set(XPU_XRE_DIR_NAME "xre-bdcentos_x86_64")
endif()
set(XPU_XCCL_DIR_NAME "${XPU_XCCL_PREFIX}bdcentos_x86_64")
set(XPU_XCCL_DIR_NAME "xccl_bdcentos_x86_64")
set(XPU_XFT_DIR_NAME "xft_bdcentos6u3_x86_64_gcc82")
elseif(WITH_CENTOS)
set(XPU_XRE_DIR_NAME "xre-centos7_x86_64")
set(XPU_XCCL_DIR_NAME "${XPU_XCCL_PREFIX}bdcentos_x86_64")
set(XPU_XCCL_DIR_NAME "xccl_Linux_x86_64")
set(XPU_XFT_DIR_NAME "xft_bdcentos6u3_x86_64_gcc82")
else()
# Ubuntu as default
Expand All @@ -109,7 +99,7 @@ else()
set(XPU_XRE_DIR_NAME "xre-ubuntu_1604_x86_64")
set(XPU_XHPC_DIR_NAME "xhpc-ubuntu1604_x86_64")
endif()
set(XPU_XCCL_DIR_NAME "${XPU_XCCL_PREFIX}ubuntu_x86_64")
set(XPU_XCCL_DIR_NAME "xccl_Linux_x86_64")
set(XPU_XFT_DIR_NAME "xft_ubuntu1604_x86_64")
endif()

Expand All @@ -129,7 +119,7 @@ if(WITH_XPTI)
endif()

set(XPU_XHPC_URL
"https://klx-sdk-release-public.su.bcebos.com/xhpc/dev/${XPU_XHPC_BASE_DATE}/${XPU_XHPC_DIR_NAME}.tar.gz"
"https://klx-sdk-release-public.su.bcebos.com/xhpc/${XPU_XHPC_BASE_DATE}/${XPU_XHPC_DIR_NAME}.tar.gz"
CACHE STRING "" FORCE)

if(DEFINED XPU_BASE_URL)
Expand Down
45 changes: 33 additions & 12 deletions cmake/generic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -463,21 +463,35 @@ function(cc_test_run TARGET_NAME)
set(multiValueArgs COMMAND ARGS)
cmake_parse_arguments(cc_test "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})
string(REGEX MATCH "_deprecated$" DEPRECATED_TARGET_NAME "${TARGET_NAME}")

if(cc_test_DIR STREQUAL "")
set(cc_test_DIR ${CMAKE_CURRENT_BINARY_DIR})
endif()
add_test(
NAME ${TARGET_NAME}
COMMAND ${cc_test_COMMAND} ${cc_test_ARGS}
WORKING_DIRECTORY ${cc_test_DIR})
set_property(
TEST ${TARGET_NAME}
PROPERTY
ENVIRONMENT
FLAGS_init_allocated_mem=true
FLAGS_cudnn_deterministic=true
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${PADDLE_BINARY_DIR}/python/paddle/libs:${PADDLE_BINARY_DIR}/python/paddle/base
)
if(NOT "${DEPRECATED_TARGET_NAME}" STREQUAL "")
set_property(
TEST ${TARGET_NAME}
PROPERTY
ENVIRONMENT
FLAGS_init_allocated_mem=true
FLAGS_cudnn_deterministic=true
FLAGS_enable_pir_api=0
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${PADDLE_BINARY_DIR}/python/paddle/libs:${PADDLE_BINARY_DIR}/python/paddle/base
)
else()
set_property(
TEST ${TARGET_NAME}
PROPERTY
ENVIRONMENT
FLAGS_init_allocated_mem=true
FLAGS_cudnn_deterministic=true
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${PADDLE_BINARY_DIR}/python/paddle/libs:${PADDLE_BINARY_DIR}/python/paddle/base
)
endif()
# No unit test should exceed 2 minutes.
if(WIN32)
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT 150)
Expand Down Expand Up @@ -1147,14 +1161,21 @@ function(py_test TARGET_NAME)
cmake_parse_arguments(py_test "${options}" "${oneValueArgs}"
"${multiValueArgs}" ${ARGN})

string(REGEX MATCH "_deprecated\.py$" DEPRECATED_MODULES "${py_test_SRCS}")
string(REGEX MATCH "_deprecated$" DEPRECATED_TARGET_NAME "${TARGET_NAME}")
set(FLAGS_PIR_MODE "")
if((NOT "${DEPRECATED_MODULES}" STREQUAL "")
OR (NOT "${DEPRECATED_TARGET_NAME}" STREQUAL ""))
set(FLAGS_PIR_MODE FLAGS_enable_pir_api=0)
endif()
if(WITH_COVERAGE AND NOT (WITH_INCREMENTAL_COVERAGE
AND "$ENV{PADDLE_GIT_DIFF_PY_FILE}" STREQUAL ""))
add_test(
NAME ${TARGET_NAME}
COMMAND
${CMAKE_COMMAND} -E env FLAGS_init_allocated_mem=true
FLAGS_cudnn_deterministic=true PYTHONPATH=${PADDLE_BINARY_DIR}/python
${py_test_ENVS}
FLAGS_cudnn_deterministic=true ${FLAGS_PIR_MODE}
PYTHONPATH=${PADDLE_BINARY_DIR}/python ${py_test_ENVS}
COVERAGE_FILE=${PADDLE_BINARY_DIR}/python-coverage.data
${PYTHON_EXECUTABLE} -m coverage run --branch -p ${py_test_SRCS}
${py_test_ARGS}
Expand All @@ -1164,8 +1185,8 @@ function(py_test TARGET_NAME)
NAME ${TARGET_NAME}
COMMAND
${CMAKE_COMMAND} -E env FLAGS_init_allocated_mem=true
FLAGS_cudnn_deterministic=true ${py_test_ENVS} ${PYTHON_EXECUTABLE} -u
${py_test_SRCS} ${py_test_ARGS}
FLAGS_cudnn_deterministic=true ${FLAGS_PIR_MODE} ${py_test_ENVS}
${PYTHON_EXECUTABLE} -u ${py_test_SRCS} ${py_test_ARGS}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()

Expand Down
11 changes: 9 additions & 2 deletions cmake/hip.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ endmacro()

find_package_and_include(miopen)
find_package_and_include(rocblas)
find_package_and_include(hipblaslt)
find_package_and_include(hiprand)
find_package_and_include(rocrand)
find_package_and_include(rccl)
Expand All @@ -85,11 +86,16 @@ find_package_and_include(hipsparse)
find_package_and_include(rocsparse)
find_package_and_include(rocfft)

if(CCACHE_PATH)
set(HIP_HIPCC_EXECUTABLE ${CCACHE_PATH} ${HIP_HIPCC_EXECUTABLE})
endif()

# set CXX flags for HIP
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -D__HIP_PLATFORM_HCC__ -DROCM_NO_WRAPPER_HEADER_WARNING")
"${CMAKE_C_FLAGS} -D__HIP_PLATFORM_HCC__ -D__HIP_PLATFORM_AMD__ -DROCM_NO_WRAPPER_HEADER_WARNING"
)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -D__HIP_PLATFORM_HCC__ -DROCM_NO_WRAPPER_HEADER_WARNING"
"${CMAKE_CXX_FLAGS} -D__HIP_PLATFORM_HCC__ -D__HIP_PLATFORM_AMD__ -DROCM_NO_WRAPPER_HEADER_WARNING"
)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_HIP")
Expand All @@ -98,6 +104,7 @@ set(THRUST_DEVICE_SYSTEM THRUST_DEVICE_SYSTEM_HIP)
# define HIP_CXX_FLAGS
list(APPEND HIP_CXX_FLAGS -fPIC)
list(APPEND HIP_CXX_FLAGS -D__HIP_PLATFORM_HCC__=1)
list(APPEND HIP_CXX_FLAGS -D__HIP_PLATFORM_AMD__=1)
# Note(qili93): HIP has compile conflicts of float16.h as platform::float16 overload std::is_floating_point and std::is_integer
list(APPEND HIP_CXX_FLAGS -D__HIP_NO_HALF_CONVERSIONS__=1)
list(APPEND HIP_CXX_FLAGS -DROCM_NO_WRAPPER_HEADER_WARNING)
Expand Down
5 changes: 5 additions & 0 deletions cmake/inference_lib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,11 @@ copy(
SRCS ${PADDLE_SOURCE_DIR}/paddle/pir/include/dialect/shape/utils/*.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/pir/dialect/shape/utils/
)
copy(
inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/pir/include/dialect/shape/interface/infer_symbolic_shape/*.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/pir/dialect/shape/interface/infer_symbolic_shape/
)
copy(
inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/pir/include/pass/*.h
Expand Down
8 changes: 3 additions & 5 deletions cmake/third_party.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -521,11 +521,9 @@ if(WITH_PSCORE)

include(external/jemalloc) # download, build, install jemalloc
list(APPEND third_party_deps extern_jemalloc)
if(WITH_HETERPS)
include(external/afs_api)
list(APPEND third_party_deps extern_afs_api)
set(WITH_AFSAPI ON)
endif()

include(external/afs_api)
list(APPEND third_party_deps extern_afs_api)
endif()

if(WITH_RPC
Expand Down
16 changes: 8 additions & 8 deletions paddle/cinn/adt/equation_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,18 @@ EquationGraphTopoWalker<VT, FT> GetSubgraph(
};
const auto& VisitInputVariables =
[graph, IsSelected](FT function, const std::function<void(VT)>& Visit) {
PADDLE_ENFORCE_EQ(
IsSelected(function),
true,
phi::errors::PreconditionNotMet("The function must be selected."));
PADDLE_ENFORCE_EQ(IsSelected(function),
true,
::common::errors::PreconditionNotMet(
"The function must be selected."));
graph.VisitInputVariables(function, Visit);
};
const auto& VisitOutputVariables =
[graph, IsSelected](FT function, const std::function<void(VT)>& Visit) {
PADDLE_ENFORCE_EQ(
IsSelected(function),
true,
phi::errors::PreconditionNotMet("The function must be selected."));
PADDLE_ENFORCE_EQ(IsSelected(function),
true,
::common::errors::PreconditionNotMet(
"The function must be selected."));
graph.VisitOutputVariables(function, Visit);
};
return EquationGraphTopoWalker<VT, FT>(
Expand Down
4 changes: 2 additions & 2 deletions paddle/cinn/adt/m_ir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ std::unordered_map<Index, LoopIterators> GenerateAnchorIndex2LoopIterators(
PADDLE_ENFORCE_EQ(
anchor_index2loop_iters.emplace(anchor_index, anchor_loop_iters).second,
true,
phi::errors::AlreadyExists("The anchor index has already "
"been associated with loop iters."));
::common::errors::AlreadyExists("The anchor index has already "
"been associated with loop iters."));
}
return anchor_index2loop_iters;
}
Expand Down
24 changes: 12 additions & 12 deletions paddle/cinn/adt/naive_op_equation_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ class NaiveOpEquationContext final : public OpEquationContext {
}

void Equal(const IteratorTuple& lhs, const IteratorTuple& rhs) override {
PADDLE_ENFORCE_EQ(
lhs->size(),
rhs->size(),
phi::errors::InvalidArgument("The sizes of lhs and rhs must be equal. "
"lhs size: %d, rhs size: %d",
lhs->size(),
rhs->size()));
PADDLE_ENFORCE_EQ(lhs->size(),
rhs->size(),
::common::errors::InvalidArgument(
"The sizes of lhs and rhs must be equal. "
"lhs size: %d, rhs size: %d",
lhs->size(),
rhs->size()));
for (std::size_t i = 0; i < lhs->size(); ++i) {
this->Equal(lhs->at(i), rhs->at(i));
}
Expand Down Expand Up @@ -259,7 +259,7 @@ class NaiveOpEquationContext final : public OpEquationContext {
const auto& opt_expr = GetSymbolicInDim_(i, j);
PADDLE_ENFORCE_EQ(opt_expr.has_value(),
true,
phi::errors::InvalidArgument(
::common::errors::InvalidArgument(
"The optional expression must have a value."));
vec->at(i)->emplace_back(opt_expr.value());
}
Expand All @@ -274,7 +274,7 @@ class NaiveOpEquationContext final : public OpEquationContext {
const auto& opt_expr = GetSymbolicOutDim_(i, j);
PADDLE_ENFORCE_EQ(opt_expr.has_value(),
true,
phi::errors::InvalidArgument(
::common::errors::InvalidArgument(
"The optional expression must have a value at "
"tensor index %d and dimension index %d.",
i,
Expand All @@ -288,7 +288,7 @@ class NaiveOpEquationContext final : public OpEquationContext {
const DimTuple& dim_tuple) {
PADDLE_ENFORCE_EQ(iterator_tuple->size(),
dim_tuple->size(),
phi::errors::InvalidArgument(
::common::errors::InvalidArgument(
"The sizes of iterator_tuple and dim_tuple must be "
"equal. iterator_tuple size: %d, dim_tuple size: %d",
iterator_tuple->size(),
Expand Down Expand Up @@ -343,8 +343,8 @@ class NaiveOpEquationContext final : public OpEquationContext {
PADDLE_ENFORCE_EQ(
iter != attr_map_type_.end(),
true,
phi::errors::InvalidArgument("Can't find Attribute with this name: %s",
name.c_str()));
::common::errors::InvalidArgument(
"Can't find Attribute with this name: %s", name.c_str()));
return iter->second;
}

Expand Down
Loading

0 comments on commit c7d1473

Please sign in to comment.