Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Paddle Inference]cutlass kernel compile optimization #64641

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
16 changes: 16 additions & 0 deletions paddle/phi/kernels/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,22 @@ if(DEFINED REDUCE_INFERENCE_LIB_SIZE)
endif()

if(WITH_CUTLASS)
message(
STATUS
"kai===================================================== WITH_CUTLASS")
add_custom_target(
gemm_epilogue_compile_script ALL
COMMAND bash compile.sh
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
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/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ gpu_cc="80"

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 -j10
Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里的线程数待定,可能是$(nproc)/4 之类的。如果线程少了,会出现paddle都编完了,cutlass算子动态库还在编的尴尬情况。

cd -
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ execute_process(
find_package(CUDA)

set(CUDA_NVCC_FLAGS
-gencode arch=compute_${COMPUTE_CAPABILITY},code=sm_${COMPUTE_CAPABILITY};)
-std=c++17 -gencode
arch=compute_${COMPUTE_CAPABILITY},code=sm_${COMPUTE_CAPABILITY};)
#set(CMAKE_CXX_FLAGS -fvisibility=hidden)
set(CMAKE_BUILD_TYPE "Release")
file(GLOB all_cutlass_gemm_epilogue_cu
Expand Down
2 changes: 1 addition & 1 deletion paddle/phi/kernels/fusion/cutlass/gemm_epilogue/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ gpu_cc="80"

cd $build_directory
cmake .. -DPYTHON_EXECUTABLE=$python_exe_path -DCUDA_TOOLKIT_ROOT_DIR=$cuda_root_path -DCOMPUTE_CAPABILITY=$gpu_cc
make -j
make -j10
cd -