Skip to content

Commit

Permalink
Merge branch 'develop' into masked_fill
Browse files Browse the repository at this point in the history
  • Loading branch information
AndSonder authored Oct 24, 2023
2 parents d6b7bd7 + 346ea5e commit bccd1f6
Show file tree
Hide file tree
Showing 473 changed files with 11,932 additions and 6,311 deletions.
2 changes: 1 addition & 1 deletion cmake/cinn/external/absl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set(ABSL_INSTALL_DIR ${THIRD_PARTY_PATH}/install/absl)
set(ABSL_PREFIX_DIR ${THIRD_PARTY_PATH}/absl)
set(ABSL_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})

set(ABSL_REPOSITORY "https://github.com/abseil/abseil-cpp.git")
set(ABSL_REPOSITORY "${GIT_URL}/abseil/abseil-cpp.git")
set(ABSL_TAG "20210324.2")

set(OPTIONAL_ARGS
Expand Down
2 changes: 1 addition & 1 deletion cmake/cinn/external/jitify.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include(ExternalProject)

# clone jitify to Paddle/third_party
set(JITIFY_SOURCE_DIR ${PADDLE_SOURCE_DIR}/third_party/jitify)
set(JITIFY_URL https://github.com/NVIDIA/jitify.git)
set(JITIFY_URL ${GIT_URL}/NVIDIA/jitify.git)
set(JITIFY_TAG 57de649139c866eb83acacfe50c92ad7c6278776)

ExternalProject_Add(
Expand Down
2 changes: 1 addition & 1 deletion cmake/external/brpc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ include_directories(${BRPC_INCLUDE_DIR})

# clone brpc to Paddle/third_party
set(BRPC_SOURCE_DIR ${PADDLE_SOURCE_DIR}/third_party/brpc)
set(BRPC_URL https://github.com/apache/brpc.git)
set(BRPC_URL ${GIT_URL}/apache/brpc.git)
set(BRPC_TAG 1.4.0)

# Reference https://stackoverflow.com/questions/45414507/pass-a-list-of-prefix-paths-to-externalproject-add-in-cmake-args
Expand Down
2 changes: 1 addition & 1 deletion cmake/external/cudnn-frontend.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if((NOT DEFINED CUDNN_FRONTEND_NAME) OR (NOT DEFINED CUDNN_FRONTEND_URL))
"cudnn-frontend"
CACHE STRING "" FORCE)
set(CUDNN_FRONTEND_URL
"https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/${CUDNN_FRONTEND_VER}.tar.gz"
"${GIT_URL}/NVIDIA/cudnn-frontend/archive/refs/tags/${CUDNN_FRONTEND_VER}.tar.gz"
CACHE STRING "" FORCE)
endif()
set(CUDNN_FRONTEND_CACHE_FILENAME "${CUDNN_FRONTEND_VER}.tar.gz")
Expand Down
2 changes: 1 addition & 1 deletion cmake/external/dirent.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if((NOT DEFINED DIRENT_NAME) OR (NOT DEFINED DIRENT_URL))
"dirent"
CACHE STRING "" FORCE)
set(DIRENT_URL
"https://github.com/tronkko/dirent/archive/refs/tags/1.23.2.tar.gz"
"${GIT_URL}/tronkko/dirent/archive/refs/tags/1.23.2.tar.gz"
CACHE STRING "" FORCE)
set(DIRENT_CACHE_FILENAME "1.23.2.tar.gz")
endif()
Expand Down
3 changes: 1 addition & 2 deletions cmake/external/jemalloc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ set(JEMALLOC_PROJECT "extern_jemalloc")
set(JEMALLOC_BUILD ${THIRD_PARTY_PATH}/jemalloc/src/extern_jemalloc)
set(JEMALLOC_PREFIX_DIR ${THIRD_PARTY_PATH}/jemalloc)
set(JEMALLOC_URL
https://github.com/jemalloc/jemalloc/releases/download/5.1.0/jemalloc-5.1.0.tar.bz2
)
${GIT_URL}/jemalloc/jemalloc/releases/download/5.1.0/jemalloc-5.1.0.tar.bz2)
set(JEMALLOC_INSTALL ${THIRD_PARTY_PATH}/install/jemalloc)
set(JEMALLOC_INCLUDE_DIR ${JEMALLOC_INSTALL}/include)

Expand Down
5 changes: 2 additions & 3 deletions cmake/external/libxsmm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ set(LIBXSMMNOBLAS_LIB "${LIBXSMM_LIBRARY_DIR}/libxsmmnoblas.a")
file(GLOB LIBXSMM_SOURCE_FILE_LIST ${LIBXSMM_SOURCE_DIR})
list(LENGTH LIBXSMM_SOURCE_FILE_LIST RES_LEN)
if(RES_LEN EQUAL 0)
execute_process(
COMMAND ${GIT_EXECUTABLE} clone -b ${LIBXSMM_TAG}
"https://github.com/hfp/libxsmm.git" ${LIBXSMM_SOURCE_DIR})
execute_process(COMMAND ${GIT_EXECUTABLE} clone -b ${LIBXSMM_TAG}
"${GIT_URL}/hfp/libxsmm.git" ${LIBXSMM_SOURCE_DIR})
else()
# check git tag
execute_process(
Expand Down
6 changes: 3 additions & 3 deletions cmake/external/onnxruntime.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ set(ONNXRUNTIME_DOWNLOAD_DIR

if(WIN32)
set(ONNXRUNTIME_URL
"https://github.com/microsoft/onnxruntime/releases/download/v${ONNXRUNTIME_VERSION}/onnxruntime-win-x64-${ONNXRUNTIME_VERSION}.zip"
"${GIT_URL}/microsoft/onnxruntime/releases/download/v${ONNXRUNTIME_VERSION}/onnxruntime-win-x64-${ONNXRUNTIME_VERSION}.zip"
)
set(ONNXRUNTIME_URL_MD5 f21d6bd1feef15935a5f4e1007797593)
set(ONNXRUNTIME_CACHE_EXTENSION "zip")
elseif(APPLE)
set(ONNXRUNTIME_URL
"https://github.com/microsoft/onnxruntime/releases/download/v${ONNXRUNTIME_VERSION}/onnxruntime-osx-x86_64-${ONNXRUNTIME_VERSION}.tgz"
"${GIT_URL}/microsoft/onnxruntime/releases/download/v${ONNXRUNTIME_VERSION}/onnxruntime-osx-x86_64-${ONNXRUNTIME_VERSION}.tgz"
)
set(ONNXRUNTIME_URL_MD5 6a6f6b7df97587da59976042f475d3f4)
set(ONNXRUNTIME_CACHE_EXTENSION "tgz")
else()
set(ONNXRUNTIME_URL
"https://github.com/microsoft/onnxruntime/releases/download/v${ONNXRUNTIME_VERSION}/onnxruntime-linux-x64-${ONNXRUNTIME_VERSION}.tgz"
"${GIT_URL}/microsoft/onnxruntime/releases/download/v${ONNXRUNTIME_VERSION}/onnxruntime-linux-x64-${ONNXRUNTIME_VERSION}.tgz"
)
set(ONNXRUNTIME_URL_MD5 ce3f2376854b3da4b483d6989666995a)
set(ONNXRUNTIME_CACHE_EXTENSION "tgz")
Expand Down
5 changes: 2 additions & 3 deletions cmake/external/openblas.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ endif()
file(GLOB CBLAS_SOURCE_FILE_LIST ${CBLAS_SOURCE_DIR})
list(LENGTH CBLAS_SOURCE_FILE_LIST RES_LEN)
if(RES_LEN EQUAL 0)
execute_process(
COMMAND ${GIT_EXECUTABLE} clone -b ${CBLAS_TAG}
"https://github.com/xianyi/OpenBLAS.git" ${CBLAS_SOURCE_DIR})
execute_process(COMMAND ${GIT_EXECUTABLE} clone -b ${CBLAS_TAG}
"${GIT_URL}/xianyi/OpenBLAS.git" ${CBLAS_SOURCE_DIR})
else()
# check git tag
execute_process(
Expand Down
6 changes: 3 additions & 3 deletions cmake/external/paddle2onnx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,19 @@ endif()

if(WIN32)
set(PADDLE2ONNX_URL
"https://github.com/PaddlePaddle/Paddle2ONNX/releases/download/v${PADDLE2ONNX_VERSION}/paddle2onnx-win-x64-${PADDLE2ONNX_VERSION}.zip"
"${GIT_URL}/PaddlePaddle/Paddle2ONNX/releases/download/v${PADDLE2ONNX_VERSION}/paddle2onnx-win-x64-${PADDLE2ONNX_VERSION}.zip"
)
set(PADDLE2ONNX_URL_MD5 "122b864cb57338191a7e9ef5f607c4ba")
set(PADDLE2ONNX_CACHE_EXTENSION "zip")
elseif(APPLE)
set(PADDLE2ONNX_URL
"https://github.com/PaddlePaddle/Paddle2ONNX/releases/download/v${PADDLE2ONNX_VERSION}/paddle2onnx-osx-x86_64-${PADDLE2ONNX_VERSION}.tgz"
"${GIT_URL}/PaddlePaddle/Paddle2ONNX/releases/download/v${PADDLE2ONNX_VERSION}/paddle2onnx-osx-x86_64-${PADDLE2ONNX_VERSION}.tgz"
)
set(PADDLE2ONNX_URL_MD5 "32a4381ff8441b69d58ef0fd6fd919eb")
set(PADDLE2ONNX_CACHE_EXTENSION "tgz")
else()
set(PADDLE2ONNX_URL
"https://github.com/PaddlePaddle/Paddle2ONNX/releases/download/v${PADDLE2ONNX_VERSION}/paddle2onnx-linux-x64-${PADDLE2ONNX_VERSION}.tgz"
"${GIT_URL}/PaddlePaddle/Paddle2ONNX/releases/download/v${PADDLE2ONNX_VERSION}/paddle2onnx-linux-x64-${PADDLE2ONNX_VERSION}.tgz"
)
set(PADDLE2ONNX_URL_MD5 "3fbb074987ba241327797f76514e937f")
set(PADDLE2ONNX_CACHE_EXTENSION "tgz")
Expand Down
2 changes: 1 addition & 1 deletion cmake/external/protobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ function(build_protobuf TARGET_NAME BUILD_FOR_HOST)
set(PROTOBUF_TAG 01a05a53f40ca2ac5f0af10c6cc0810bee39b792)
else()
if(WITH_PSLIB)
set(PROTOBUF_REPOSITORY "https://github.com/google/protobuf.git")
set(PROTOBUF_REPOSITORY "${GIT_URL}/google/protobuf.git")
set(PROTOBUF_TAG "9f75c5aa851cd877fb0d93ccc31b8567a6706546")
else()
set(PROTOBUF_REPOSITORY ${GIT_URL}/protocolbuffers/protobuf.git)
Expand Down
15 changes: 9 additions & 6 deletions cmake/generic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -499,12 +499,15 @@ function(cc_test_run TARGET_NAME)
NAME ${TARGET_NAME}
COMMAND ${cc_test_COMMAND} ${cc_test_ARGS}
WORKING_DIRECTORY ${cc_test_DIR})
set_property(TEST ${TARGET_NAME} PROPERTY ENVIRONMENT
FLAGS_cpu_deterministic=true)
set_property(TEST ${TARGET_NAME} PROPERTY ENVIRONMENT
FLAGS_init_allocated_mem=true)
set_property(TEST ${TARGET_NAME} PROPERTY ENVIRONMENT
FLAGS_cudnn_deterministic=true)
set_property(
TEST ${TARGET_NAME}
PROPERTY
ENVIRONMENT
FLAGS_cpu_deterministic=true
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
)
# No unit test should exceed 2 minutes.
if(WIN32)
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT 150)
Expand Down
19 changes: 10 additions & 9 deletions paddle/cinn/auto_schedule/analysis/analyze_ir_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <sstream>
#include <vector>

#include "paddle/cinn/ast_gen_ius/tensor_group.h"
#include "paddle/cinn/common/context.h"
#include "paddle/cinn/ir/ir.h"
#include "paddle/cinn/ir/ir_base.h"
Expand Down Expand Up @@ -49,9 +50,9 @@ TEST(AnalyzeIr, AnalyzeScheduleBlockReadWriteBuffer_SimpleAssign) {
ir::Tensor B = lang::Compute(
{M, N}, [&](Var i, Var j) { return A(i, j); }, "B");

poly::StageMap stages = poly::CreateStages({A, B});
std::vector<ir::LoweredFunc> funcs = lang::LowerVec(
"SimpleAssign", stages, {A, B}, {}, {}, nullptr, target, true);
ast_gen_ius::TensorGroup tensor_group({A, B});
std::vector<ir::LoweredFunc> funcs =
lang::LowerToAstVec("SimpleAssign", {A, B}, &tensor_group, target);

ASSERT_FALSE(funcs.empty());
ir::Expr ast_expr = funcs[0]->body;
Expand Down Expand Up @@ -115,9 +116,9 @@ TEST(AnalyzeIr, AnalyzeScheduleBlockReadWriteBuffer_AddDiffShape) {
ir::Tensor C = lang::Compute(
{M, N}, [&](Var i, Var j) { return A(i) + B(j); }, "C");

poly::StageMap stages = poly::CreateStages({C});
std::vector<ir::LoweredFunc> funcs = lang::LowerVec(
"AddDiffShape", stages, {C}, {}, {}, nullptr, target, true);
ast_gen_ius::TensorGroup tensor_group({C});
std::vector<ir::LoweredFunc> funcs =
lang::LowerToAstVec("AddDiffShape", {C}, &tensor_group, target);

ir::Expr ast_expr = funcs[0]->body;
VLOG(6) << "Expr before MultiLevelTiling: ";
Expand Down Expand Up @@ -169,9 +170,9 @@ TEST(AnalyzeIr, ContainsNodeType) {
ir::Tensor B = lang::Compute(
{M, N}, [&](Var i, Var j) { return A(i, j); }, "B");

poly::StageMap stages = poly::CreateStages({A, B});
std::vector<ir::LoweredFunc> funcs = lang::LowerVec(
"SimpleAssign", stages, {A, B}, {}, {}, nullptr, target, true);
ast_gen_ius::TensorGroup tensor_group({A, B});
std::vector<ir::LoweredFunc> funcs =
lang::LowerToAstVec("SimpleAssign", {A, B}, &tensor_group, target);

ASSERT_FALSE(funcs.empty());
ir::Expr ast_expr = funcs[0]->body;
Expand Down
13 changes: 7 additions & 6 deletions paddle/cinn/auto_schedule/cost_model/feature_extractor_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <unordered_set>
#include <vector>

#include "paddle/cinn/ast_gen_ius/tensor_group.h"
#include "paddle/cinn/common/context.h"
#include "paddle/cinn/ir/ir.h"
#include "paddle/cinn/ir/ir_base.h"
Expand Down Expand Up @@ -48,9 +49,9 @@ TEST(FeatureExtractor, SimpleAssign) {
ir::Tensor B = lang::Compute(
{M, N}, [&](Var i, Var j) { return A(i, j); }, "B");

poly::StageMap stages = poly::CreateStages({A, B});
std::vector<ir::LoweredFunc> funcs = lang::LowerVec(
"SimpleAssign", stages, {A, B}, {}, {}, nullptr, target, true);
ast_gen_ius::TensorGroup tensor_group({A, B});
std::vector<ir::LoweredFunc> funcs =
lang::LowerToAstVec("SimpleAssign", {A, B}, &tensor_group, target);
ir::Expr ast_expr = funcs[0]->body;
VLOG(6) << "Expr to test: " << ast_expr;

Expand Down Expand Up @@ -109,9 +110,9 @@ TEST(FeatureExtractor, MatrixMultiply) {
[&](Var i, Var j) { return lang::ReduceSum(A(i, k) * B(k, j), {k}); },
"C");

poly::StageMap stages = poly::CreateStages({C});
std::vector<ir::LoweredFunc> funcs = lang::LowerVec(
"MatrixMultiply", stages, {C}, {}, {}, nullptr, target, true);
ast_gen_ius::TensorGroup tensor_group({C});
std::vector<ir::LoweredFunc> funcs =
lang::LowerToAstVec("SimpleAssign", {C}, &tensor_group, target);

std::vector<Expr> vec_ast{funcs[0]->body};
ir::ModuleExpr mod_expr(vec_ast);
Expand Down
5 changes: 3 additions & 2 deletions paddle/cinn/auto_schedule/database/jsonfile_database_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <fstream>
#include <vector>

#include "paddle/cinn/ast_gen_ius/tensor_group.h"
#include "paddle/cinn/auto_schedule/search_space/search_state.h"
#include "paddle/cinn/auto_schedule/task/task_registry.h"
#include "paddle/cinn/cinn.h"
Expand Down Expand Up @@ -47,8 +48,8 @@ std::vector<ir::LoweredFunc> LowerCompute(const std::vector<int>& shape,
C = Compute(
domain, [&B](Var i, Var j) { return B(i, j); }, "C");

return cinn::lang::LowerVec(
"test_func", CreateStages({A, B}), {A, B}, {}, {}, nullptr, target, true);
ast_gen_ius::TensorGroup tensor_group({A, B});
return cinn::lang::LowerToAstVec("test_func", {A, B}, &tensor_group, target);
}

// Create a new IRSchedule with copied ir::LoweredFunc AST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <iostream>
#include <vector>

#include "paddle/cinn/ast_gen_ius/tensor_group.h"
#include "paddle/cinn/auto_schedule/search_space/auto_gen_rule/auto_gen_rule.h"
#include "paddle/cinn/auto_schedule/search_space/auto_gen_rule/test_helper.h"
#include "paddle/cinn/cinn.h"
Expand Down Expand Up @@ -59,16 +60,13 @@ TEST(AutoInline, SingleLoopInline) {
ir::Tensor C = Compute(
{M}, [&](Var i) { return B(i) + ir::Expr(1.f); }, "C");

poly::StageMap stages = CreateStages({A, B, C});
ast_gen_ius::TensorGroup tensor_group({A, B, C});
std::vector<ir::LoweredFunc> funcs =
lang::LowerVec("TestAutoInline_SingleLoopInline",
stages,
{A, C},
{},
{},
nullptr,
target,
true);
lang::LowerToAstVec("TestAutoInline_SingleLoopInline",

{A, C},
&tensor_Group,
target);
VLOG(6) << "Expr after lowering:";
VLOG(6) << funcs[0]->body;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <glog/logging.h>
#include <gtest/gtest.h>

#include "paddle/cinn/ast_gen_ius/tensor_group.h"
#include "paddle/cinn/cinn.h"
#include "paddle/cinn/lang/lower.h"

Expand All @@ -38,9 +39,9 @@ TEST(AutoUnroll, Init) {
#else
Target target = common::DefaultHostTarget();
#endif
auto stages = CreateStages({C});
auto funcs = cinn::lang::LowerVec(
"test_init", stages, {A, B, C}, {}, {}, nullptr, target, true);
ast_gen_ius::TensorGroup tensor_group({C});
auto funcs =
cinn::lang::LowerToAstVec("test_init", {A, B, C}, &tensor_group, target);

auto ast_expr = funcs[0]->body;
ir::IRSchedule init_schedule(ir::ModuleExpr({ast_expr}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <iostream>
#include <vector>

#include "paddle/cinn/ast_gen_ius/tensor_group.h"
#include "paddle/cinn/auto_schedule/search_space/auto_gen_rule/auto_gen_rule.h"
#include "paddle/cinn/auto_schedule/search_space/auto_gen_rule/test_helper.h"
#include "paddle/cinn/cinn.h"
Expand Down Expand Up @@ -106,16 +107,9 @@ TEST(MultiLevelTile, SimpleLoops) {
ir::Tensor C = Compute(
{M, N}, [&](Var i, Var j) { return A(i) + B(j); }, "C");

poly::StageMap stages = CreateStages({C});
std::vector<ir::LoweredFunc> funcs =
lang::LowerVec("TestMultiLevelTile_SimpleLoops",
stages,
{C},
{},
{},
nullptr,
target,
true);
ast_gen_ius::TensorGroup tensor_group({C});
std::vector<ir::LoweredFunc> funcs = lang::LowerToAstVec(
"TestMultiLevelTile_SimpleLoops", {C}, &tensor_group, target);

ir::Expr ast_expr = funcs[0]->body;
VLOG(6) << "Expr before MultiLevelTiling: ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <iostream>
#include <vector>

#include "paddle/cinn/ast_gen_ius/tensor_group.h"
#include "paddle/cinn/auto_schedule/search_space/auto_gen_rule/auto_gen_rule.h"
#include "paddle/cinn/cinn.h"
#include "paddle/cinn/ir/ir.h"
Expand Down Expand Up @@ -52,9 +53,9 @@ TEST(SkipRule, Basic) {
ir::Tensor C = Compute(
{M, N}, [&](Var i, Var j) { return A(i) + B(j); }, "C");

poly::StageMap stages = CreateStages({C});
std::vector<ir::LoweredFunc> funcs = lang::LowerVec(
"TestSkipRule_Basic", stages, {C}, {}, {}, nullptr, target, true);
ast_gen_ius::TensorGroup tensor_group({C});
std::vector<ir::LoweredFunc> funcs =
lang::LowerToAstVec("TestSkipRule_Basic", {C}, &tensor_group, target);

ir::Expr ast_expr = funcs[0]->body;
VLOG(6) << "Expr before SkipRule: ";
Expand Down Expand Up @@ -101,9 +102,9 @@ TEST(SkipRule, ApplyOnSpecificBlock) {
ir::Tensor C = Compute(
{M, N}, [&](Var i, Var j) { return A(i) + B(j); }, "C");

poly::StageMap stages = CreateStages({C});
std::vector<ir::LoweredFunc> funcs = lang::LowerVec(
"TestSkipRule_Basic", stages, {C}, {}, {}, nullptr, target, true);
ast_gen_ius::TensorGroup tensor_group({C});
std::vector<ir::LoweredFunc> funcs =
lang::LowerToAstVec("TestSkipRule_Basic", {C}, &tensor_group, target);

ir::Expr ast_expr = funcs[0]->body;
VLOG(6) << "Expr before SkipRule: ";
Expand Down
Loading

0 comments on commit bccd1f6

Please sign in to comment.