Skip to content

Commit

Permalink
Revert "add cusparseLt 0.4 to speed up ffn1,ffn2,qkvo multiplication,…
Browse files Browse the repository at this point in the history
…speed up…" (#109)
  • Loading branch information
qingshui authored Jan 16, 2024
1 parent ae56e86 commit 8888367
Show file tree
Hide file tree
Showing 30 changed files with 461 additions and 2,255 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ option(WITH_ASCEND_CL "Compile PaddlePaddle with ASCEND CL" ${WITH_ASCEND})
option(WITH_ASCEND_CXX11 "Compile PaddlePaddle with ASCEND and CXX11 ABI" OFF)
option(WITH_ONNXRUNTIME "Compile PaddlePaddle with ONNXRUNTIME" OFF)
option(WITH_CUSPARSELT "Compile PaddlePaddle with CUSPARSELT" OFF)
option(WITH_CUSPARSELT4 "Compile PaddlePaddle with CUSPARSELT version 0.4" ON)
# Note(zhouwei): It use option above, so put here
include(init)
include(generic) # simplify cmake module
Expand Down
61 changes: 0 additions & 61 deletions cmake/external/cusparselt4.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion cmake/inference_lib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function(copy_part_of_thrid_party TARGET DST)
DSTS ${dst_dir} ${dst_dir})
endif()

if(WITH_SPARSELT OR WITH_SPARSELT4)
if(WITH_SPARSELT)
set(dst_dir "${DST}/third_party/install/cusparselt")
copy(
${TARGET}
Expand Down
5 changes: 0 additions & 5 deletions cmake/third_party.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -491,11 +491,6 @@ if(WITH_CUSPARSELT)
list(APPEND third_party_deps extern_cusparselt)
endif()

if(WITH_CUSPARSELT4)
include(external/cusparselt4) # download, build, install cusparselt 0.4
list(APPEND third_party_deps extern_cusparselt)
endif()

if(WITH_GPU
AND NOT WITH_ARM
AND NOT WIN32
Expand Down
7 changes: 0 additions & 7 deletions paddle/fluid/inference/api/analysis_predictor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
#include "paddle/fluid/inference/utils/model_utils.h"
#include "paddle/fluid/inference/utils/singleton.h"
#include "paddle/fluid/memory/memcpy.h"
#include "paddle/fluid/operators/fused/cusparseLt.h"
#include "paddle/fluid/platform/cpu_helper.h"
#include "paddle/fluid/platform/device/gpu/gpu_info.h"
#include "paddle/fluid/platform/device_context.h"
Expand Down Expand Up @@ -436,8 +435,6 @@ void AnalysisPredictor::InitDeviceContexts() {
gpu_context->SetSolverHandle(
gpu_resource->GetSolverDnHandleCreator());
gpu_context->SetSparseHandle(gpu_resource->GetSparseHandleCreator());
gpu_context->SetSparseLtHandle(
gpu_resource->GetSparseLtHandleCreator());
gpu_context->SetEigenDevice(gpu_resource->GetGpuEigenDeviceCreator());
gpu_context->SetComputeCapability(
gpu_resource->GetGpuComputeCapability());
Expand All @@ -450,10 +447,6 @@ void AnalysisPredictor::InitDeviceContexts() {
gpu_resource->GetGPUMultiProcessors());
gpu_context->SetDriverVersion(gpu_resource->GetGpuDriverVersion());
gpu_context->SetRuntimeVersion(gpu_resource->GetGpuRuntimeVersion());
paddle::operators::WeightCache::Instance().init(
place_,
phi::Stream(
reinterpret_cast<phi::StreamId>(gpu_resource->GetStream())));
VLOG(1) << "thread id is " << std::this_thread::get_id()
<< ", stream id is "
<< reinterpret_cast<void *>(gpu_resource->GetStream())
Expand Down
1 change: 0 additions & 1 deletion paddle/fluid/inference/api/infer_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class InferGPUContext : public phi::GPUContext {
using phi::GPUContext::SetEigenDevice;
using phi::GPUContext::SetSolverHandle;
using phi::GPUContext::SetSparseHandle;
using phi::GPUContext::SetSparseLtHandle;
using phi::GPUContext::SetStream;
// using phi::GPUContext::SetDnnWorkspaceHandle;
using phi::GPUContext::SetComputeCapability;
Expand Down
23 changes: 0 additions & 23 deletions paddle/fluid/inference/api/resource_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ void GPUContextResource::DestroyGPUResource() {
DestroyBlasLtHandle();
DestroySolverHandle();
DestroySparseHandle();
DestroySparseLtHandle();
}

void GPUContextResource::InitGpuProperties() {
Expand Down Expand Up @@ -229,20 +228,6 @@ void GPUContextResource::DestroySparseHandle() {
phi::DestroySparseHandle(sparse_handle_);
}

void GPUContextResource::InitSparseLtHandle() {
if (sparselt_handle_ == nullptr) {
sparselt_handle_ = &sparselt_ori_handle_;
phi::InitSparseLtHandle(sparselt_handle_);
}
}

void GPUContextResource::DestroySparseLtHandle() {
if (sparselt_handle_ != nullptr) {
phi::DestroySparseLtHandle(sparselt_handle_);
sparselt_handle_ = nullptr;
}
}

phi::Place GPUContextResource::Place() const { return place_; }

gpuStream_t GPUContextResource::GetStream() const { return stream_; }
Expand Down Expand Up @@ -337,14 +322,6 @@ GPUContextResource::GetSparseHandleCreator() {
};
}

std::function<cusparseLtHandle_t*()>
GPUContextResource::GetSparseLtHandleCreator() {
return [&]() {
InitSparseLtHandle();
return sparselt_handle_;
};
}

Eigen::GpuDevice* GPUContextResource::GetGpuEigenDevice() const {
return gpu_eigen_device_.get();
}
Expand Down
5 changes: 0 additions & 5 deletions paddle/fluid/inference/api/resource_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class GPUContextResource {
std::function<phi::blasLtHandle_t()> GetBlasLtHandleCreator();
std::function<phi::solverHandle_t()> GetSolverDnHandleCreator();
std::function<phi::sparseHandle_t()> GetSparseHandleCreator();
std::function<cusparseLtHandle_t*()> GetSparseLtHandleCreator();
std::function<Eigen::GpuDevice*()> GetGpuEigenDeviceCreator();

gpuStream_t GetStream() const;
Expand Down Expand Up @@ -107,8 +106,6 @@ class GPUContextResource {
void DestroySolverHandle();
void InitSparseHandle();
void DestroySparseHandle();
void InitSparseLtHandle();
void DestroySparseLtHandle();

private:
phi::Place place_;
Expand All @@ -133,8 +130,6 @@ class GPUContextResource {
dnnHandle_t dnn_handle_{nullptr};
phi::solverHandle_t solver_handle_{nullptr};
phi::sparseHandle_t sparse_handle_{nullptr};
cusparseLtHandle_t* sparselt_handle_{nullptr};
cusparseLtHandle_t sparselt_ori_handle_;
// DnnWorkspaceHandle
};
#endif
Expand Down
Loading

0 comments on commit 8888367

Please sign in to comment.