Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions paddle/phi/kernels/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ if(DEFINED REDUCE_INFERENCE_LIB_SIZE)
endif()

if(WITH_CUTLASS)
add_custom_target(
gemm_epilogue_compile_script ALL
COMMAND bash compile.sh "${PYTHON_EXECUTABLE}" "${CUDA_TOOLKIT_ROOT_DIR}"
"${NVCC_ARCH_BIN}"
WORKING_DIRECTORY
${PADDLE_SOURCE_DIR}/paddle/phi/kernels/fusion/cutlass/gemm_epilogue
COMMENT "GemmEpilogue compile script")
add_custom_target(
fused_conv2d_add_act_compile_script ALL
COMMAND bash compile.sh "${PYTHON_EXECUTABLE}" "${CUDA_TOOLKIT_ROOT_DIR}"
"${NVCC_ARCH_BIN}"
WORKING_DIRECTORY
${PADDLE_SOURCE_DIR}/paddle/phi/kernels/fusion/cutlass/conv2d
COMMENT "FusedConv2dAddAct compile script")

execute_process(
COMMAND
${PYTHON_EXECUTABLE}
Expand Down
2 changes: 1 addition & 1 deletion paddle/phi/kernels/fusion/cutlass/conv2d/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.23)
cmake_minimum_required(VERSION 3.18)

if(NOT DEFINED PYTHON_EXECUTABLE)
message(
Expand Down
26 changes: 18 additions & 8 deletions paddle/phi/kernels/fusion/cutlass/conv2d/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,31 @@
# limitations under the License.
set -e

build_directory="build"
if [ ! -d "$build_directory" ]; then
mkdir $build_directory
fi

libname="$build_directory/libCutlassConv2d.so"
if [ -e "$libname" ]; then
exit 0
fi

cutlass_repo_directory="cutlass"
if [ ! -d "$cutlass_repo_directory" ]; then
git clone --branch v3.0.0 https://github.com/NVIDIA/cutlass
fi

build_directory="build"
if [ ! -d "$build_directory" ]; then
mkdir $build_directory
fi

python_exe_path="python"
cuda_root_path="/usr/local/cuda"
gpu_cc="80"
default_python_exe_path="/usr/bin/python"
default_cuda_root_path="/usr/local/cuda"
default_gpu_cc="80"

python_exe_path="${1:-$default_python_exe_path}"
cuda_root_path="${2:-$default_cuda_root_path}"
gpu_cc="${3:-$default_gpu_cc}"

cd $build_directory
cmake .. -DPYTHON_EXECUTABLE=$python_exe_path -DCUDA_TOOLKIT_ROOT_DIR=$cuda_root_path -DCOMPUTE_CAPABILITY=$gpu_cc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是否应该用paddle里默认的cmake

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get!马上改。

make -j
make -j8
cd -
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.23)
cmake_minimum_required(VERSION 3.18)

if(NOT DEFINED PYTHON_EXECUTABLE)
message(
Expand Down
26 changes: 18 additions & 8 deletions paddle/phi/kernels/fusion/cutlass/gemm_epilogue/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,31 @@
# limitations under the License.
set -e

build_directory="build"
if [ ! -d "$build_directory" ]; then
mkdir $build_directory
fi

libname="$build_directory/libCutlassGemmEpilogue.so"
if [ -e "$libname" ]; then
exit 0
fi

cutlass_repo_directory="cutlass"
if [ ! -d "$cutlass_repo_directory" ]; then
git clone --branch v2.11.0 https://github.com/NVIDIA/cutlass
fi

build_directory="build"
if [ ! -d "$build_directory" ]; then
mkdir $build_directory
fi

python_exe_path="/usr/bin/python"
cuda_root_path="/usr/local/cuda"
gpu_cc="80"
default_python_exe_path="/usr/bin/python"
default_cuda_root_path="/usr/local/cuda"
default_gpu_cc="80"

python_exe_path="${1:-$default_python_exe_path}"
cuda_root_path="${2:-$default_cuda_root_path}"
gpu_cc="${3:-$default_gpu_cc}"

cd $build_directory
cmake .. -DPYTHON_EXECUTABLE=$python_exe_path -DCUDA_TOOLKIT_ROOT_DIR=$cuda_root_path -DCOMPUTE_CAPABILITY=$gpu_cc
make -j
make -j8
cd -
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.

#pragma once
#include <cuda_bf16.h>
#include <cuda_fp16.h>
#include <vector>

#include "paddle/phi/kernels/fusion/cutlass/gemm_epilogue/gemm_epilogue_decl.h"
Expand Down