"...en/git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "b9d52fca1da019d7088a887aaf2c661be94132ce"
Commit e80fbbdd authored by Chao Liu's avatar Chao Liu
Browse files

refactor build, clean up

parent 28354a0f
...@@ -28,9 +28,9 @@ template <unsigned GridSize, ...@@ -28,9 +28,9 @@ template <unsigned GridSize,
unsigned WeiBlockCopyThreadPerDim0, unsigned WeiBlockCopyThreadPerDim0,
unsigned WeiBlockCopyThreadPerDim1> unsigned WeiBlockCopyThreadPerDim1>
__global__ void gridwise_implicit_gemm_convolution_1_chwn_csrk_khwn_padded_lds_pipeline( __global__ void gridwise_implicit_gemm_convolution_1_chwn_csrk_khwn_padded_lds_pipeline(
Float* const __restrict__ p_in_global, const Float* const __restrict__ p_in_global,
Float* const __restrict__ p_wei_global, const Float* const __restrict__ p_wei_global,
Float* __restrict__ p_out_global) Float* const __restrict__ p_out_global)
{ {
// NPerThread == NPerBlock, because the format of input in LDS [C,Hi,Wi,N] // NPerThread == NPerBlock, because the format of input in LDS [C,Hi,Wi,N]
// for GEMM trans([C,K]) * [C,Wo*N], we need a thread to do all the "N" // for GEMM trans([C,K]) * [C,Wo*N], we need a thread to do all the "N"
...@@ -220,7 +220,7 @@ __global__ void gridwise_implicit_gemm_convolution_1_chwn_csrk_khwn_padded_lds_p ...@@ -220,7 +220,7 @@ __global__ void gridwise_implicit_gemm_convolution_1_chwn_csrk_khwn_padded_lds_p
// set threadwise output tensor to 0 // set threadwise output tensor to 0
threadwise_4d_tensor_set_zero(out_hkwn_thread_desc, p_out_thread); threadwise_4d_tensor_set_zero(out_hkwn_thread_desc, p_out_thread);
Float* p_wei_global_block_begin = const Float* p_wei_global_block_begin =
p_wei_global + wei_ek_global_desc.Get1dIndex(0, k_block_data_begin); p_wei_global + wei_ek_global_desc.Get1dIndex(0, k_block_data_begin);
// prelog: load data // prelog: load data
......
...@@ -22,12 +22,9 @@ template <unsigned GridSize, ...@@ -22,12 +22,9 @@ template <unsigned GridSize,
unsigned HoPerThread, unsigned HoPerThread,
unsigned WoPerThread> unsigned WoPerThread>
__global__ void __global__ void
gridwise_implicit_gemm_convolution_1_nchw_kcsr(InGlobalDesc, gridwise_implicit_gemm_convolution_1_nchw_kcsr_nkhw(const Float* const __restrict__ p_in_global,
Float* const __restrict__ p_in_global, const Float* const __restrict__ p_wei_global,
WeiGlobalDesc, Float* const __restrict__ p_out_global)
Float* const __restrict__ p_wei_global,
OutGlobalDesc,
Float* __restrict__ p_out_global)
{ {
// NPerThread == NPerBlock, because the format of input in LDS [C,Hi,Wi,N] // NPerThread == NPerBlock, because the format of input in LDS [C,Hi,Wi,N]
// for GEMM trans([C,K]) * [C,Wo*N], we need a thread to do all the "N" // for GEMM trans([C,K]) * [C,Wo*N], we need a thread to do all the "N"
......
...@@ -23,12 +23,9 @@ template <unsigned GridSize, ...@@ -23,12 +23,9 @@ template <unsigned GridSize,
unsigned HoPerThread, unsigned HoPerThread,
unsigned WoPerThread> unsigned WoPerThread>
__global__ void __global__ void
gridwise_implicit_gemm_convolution_1_nchw_srck_nkhw(InGlobalDesc, gridwise_implicit_gemm_convolution_1_nchw_srck_nkhw(const Float* const __restrict__ p_in_global,
Float* const __restrict__ p_in_global, const Float* const __restrict__ p_wei_global,
WeiGlobalDesc, Float* const __restrict__ p_out_global)
Float* const __restrict__ p_wei_global,
OutGlobalDesc,
Float* __restrict__ p_out_global)
{ {
// NPerThread == NPerBlock, because the format of input in LDS [C,Hi,Wi,N] // NPerThread == NPerBlock, because the format of input in LDS [C,Hi,Wi,N]
// for GEMM trans([C,K]) * [C,Wo*N], we need a thread to do all the "N" // for GEMM trans([C,K]) * [C,Wo*N], we need a thread to do all the "N"
......
...@@ -35,11 +35,8 @@ template <unsigned GridSize, ...@@ -35,11 +35,8 @@ template <unsigned GridSize,
unsigned InBlockCopyDataPerRead, unsigned InBlockCopyDataPerRead,
unsigned WeiBlockCopyDataPerRead> unsigned WeiBlockCopyDataPerRead>
__global__ void __global__ void
gridwise_implicit_gemm_convolution_2_cnhw_csrk_knhw(InGlobalDesc, gridwise_implicit_gemm_convolution_2_cnhw_csrk_knhw(const Float* const __restrict__ p_in_global,
const Float* const __restrict__ p_in_global,
WeiGlobalDesc,
const Float* const __restrict__ p_wei_global, const Float* const __restrict__ p_wei_global,
OutGlobalDesc,
Float* const __restrict__ p_out_global) Float* const __restrict__ p_out_global)
{ {
constexpr auto I0 = Number<0>{}; constexpr auto I0 = Number<0>{};
......
...@@ -35,12 +35,9 @@ template <unsigned GridSize, ...@@ -35,12 +35,9 @@ template <unsigned GridSize,
unsigned InBlockCopyDataPerRead, unsigned InBlockCopyDataPerRead,
unsigned WeiBlockCopyDataPerRead> unsigned WeiBlockCopyDataPerRead>
__global__ void gridwise_implicit_gemm_convolution_2_cnhw_csrk_knhw_lds_double_buffer( __global__ void gridwise_implicit_gemm_convolution_2_cnhw_csrk_knhw_lds_double_buffer(
InGlobalDesc, const Float* const __restrict__ p_in_global,
Float* const __restrict__ p_in_global, const Float* const __restrict__ p_wei_global,
WeiGlobalDesc, Float* const __restrict__ p_out_global)
Float* const __restrict__ p_wei_global,
OutGlobalDesc,
Float* __restrict__ p_out_global)
{ {
constexpr auto I0 = Number<0>{}; constexpr auto I0 = Number<0>{};
constexpr auto I1 = Number<1>{}; constexpr auto I1 = Number<1>{};
......
...@@ -25,12 +25,9 @@ template <unsigned GridSize, ...@@ -25,12 +25,9 @@ template <unsigned GridSize,
unsigned InBlockCopyThreadPerDim0, unsigned InBlockCopyThreadPerDim0,
unsigned InBlockCopyThreadPerDim1> unsigned InBlockCopyThreadPerDim1>
__global__ void __global__ void
gridwise_implicit_gemm_convolution_2_cnhw_srck_knhw(InGlobalDesc, gridwise_implicit_gemm_convolution_2_cnhw_srck_knhw(const Float* const __restrict__ p_in_global,
Float* const __restrict__ p_in_global, const Float* const __restrict__ p_wei_global,
WeiGlobalDesc, Float* const __restrict__ p_out_global)
Float* const __restrict__ p_wei_global,
OutGlobalDesc,
Float* __restrict__ p_out_global)
{ {
constexpr auto I0 = Number<0>{}; constexpr auto I0 = Number<0>{};
constexpr auto I1 = Number<1>{}; constexpr auto I1 = Number<1>{};
...@@ -174,10 +171,10 @@ gridwise_implicit_gemm_convolution_2_cnhw_srck_knhw(InGlobalDesc, ...@@ -174,10 +171,10 @@ gridwise_implicit_gemm_convolution_2_cnhw_srck_knhw(InGlobalDesc,
// set threadwise output tensor to 0 // set threadwise output tensor to 0
threadwise_2d_tensor_set_zero(out_kb_thread_desc, p_out_thread); threadwise_2d_tensor_set_zero(out_kb_thread_desc, p_out_thread);
Float* p_in_global_block_offset = const Float* p_in_global_block_offset =
p_in_global + in_cb_global_desc.Get1dIndex(0, b_block_data_begin); p_in_global + in_cb_global_desc.Get1dIndex(0, b_block_data_begin);
Float* p_wei_global_block_offset = const Float* p_wei_global_block_offset =
p_wei_global + wei_srck_global_desc.Get1dIndex(0, 0, 0, k_block_data_begin); p_wei_global + wei_srck_global_desc.Get1dIndex(0, 0, 0, k_block_data_begin);
for(unsigned c_block_data_begin = 0; c_block_data_begin < C; c_block_data_begin += CPerBlock, for(unsigned c_block_data_begin = 0; c_block_data_begin < C; c_block_data_begin += CPerBlock,
......
...@@ -25,12 +25,9 @@ template <unsigned GridSize, ...@@ -25,12 +25,9 @@ template <unsigned GridSize,
unsigned InBlockCopyThreadPerDim0, unsigned InBlockCopyThreadPerDim0,
unsigned InBlockCopyThreadPerDim1> unsigned InBlockCopyThreadPerDim1>
__global__ void gridwise_implicit_gemm_convolution_2_cnhw_srck_knhw_lds_pipeline( __global__ void gridwise_implicit_gemm_convolution_2_cnhw_srck_knhw_lds_pipeline(
InGlobalDesc, const Float* const __restrict__ p_in_global,
Float* const __restrict__ p_in_global, const Float* const __restrict__ p_wei_global,
WeiGlobalDesc, Float* const __restrict__ p_out_global)
Float* const __restrict__ p_wei_global,
OutGlobalDesc,
Float* __restrict__ p_out_global)
{ {
constexpr auto I0 = Number<0>{}; constexpr auto I0 = Number<0>{};
constexpr auto I1 = Number<1>{}; constexpr auto I1 = Number<1>{};
......
...@@ -19,12 +19,9 @@ template <class Float, ...@@ -19,12 +19,9 @@ template <class Float,
unsigned CPerThread, unsigned CPerThread,
unsigned BlockSize, unsigned BlockSize,
unsigned GridSize> unsigned GridSize>
__global__ void gridwise_winograd_convolution(InGlobalDesc, __global__ void gridwise_winograd_convolution(const Float* const __restrict__ p_in_global,
Float* const __restrict__ p_in_global, const Float* const __restrict__ p_wei_global,
WeiGlobalDesc, Float* const __restrict__ p_out_global)
Float* const __restrict__ p_wei_global,
OutGlobalDesc,
Float* __restrict__ p_out_global)
{ {
constexpr auto I0 = Number<0>{}; constexpr auto I0 = Number<0>{};
constexpr auto I1 = Number<1>{}; constexpr auto I1 = Number<1>{};
...@@ -228,4 +225,4 @@ __global__ void gridwise_winograd_convolution(InGlobalDesc, ...@@ -228,4 +225,4 @@ __global__ void gridwise_winograd_convolution(InGlobalDesc,
k_block_data_begin + k_thread_data_begin, k_block_data_begin + k_thread_data_begin,
ho_block_data_begin + y_thread_data_begin * OutTileSizeH, ho_block_data_begin + y_thread_data_begin * OutTileSizeH,
wo_block_data_begin + x_thread_data_begin * OutTileSizeW)); wo_block_data_begin + x_thread_data_begin * OutTileSizeW));
} }
\ No newline at end of file
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
#include <utility> #include <utility>
#include <cassert> #include <cassert>
#include <iostream> #include <iostream>
#include "cuda_runtime.h"
#include "helper_cuda.h"
template <class Range> template <class Range>
std::ostream& LogRange(std::ostream& os, Range&& r, std::string delim) std::ostream& LogRange(std::ostream& os, Range&& r, std::string delim)
...@@ -108,33 +106,6 @@ struct TensorDescriptor ...@@ -108,33 +106,6 @@ struct TensorDescriptor
std::vector<std::size_t> mStrides; std::vector<std::size_t> mStrides;
}; };
struct DeviceMem
{
DeviceMem() = delete;
DeviceMem(std::size_t mem_size) : mMemSize(mem_size)
{
cudaMalloc(static_cast<void**>(&mpDeviceBuf), mMemSize);
}
void* GetDeviceBuffer() { return mpDeviceBuf; }
int ToDevice(const void* p)
{
return static_cast<int>(
cudaMemcpy(mpDeviceBuf, const_cast<void*>(p), mMemSize, cudaMemcpyHostToDevice));
}
int FromDevice(void* p)
{
return static_cast<int>(cudaMemcpy(p, mpDeviceBuf, mMemSize, cudaMemcpyDeviceToHost));
}
~DeviceMem() { cudaFree(mpDeviceBuf); }
void* mpDeviceBuf;
std::size_t mMemSize;
};
struct joinable_thread : std::thread struct joinable_thread : std::thread
{ {
template <class... Xs> template <class... Xs>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment