CUTLASS 3.5.1 (#1623)

* CUTLASS 3.5.1

* updates, optimizations, fixes
This commit is contained in:
Vijay Thakkar
2024-07-29 08:46:24 -04:00
committed by GitHub
parent 56b46e2d13
commit be60a0b272
312 changed files with 19793 additions and 6775 deletions
+20 -8
View File
@@ -43,6 +43,7 @@
#include "cutlass.h"
#include "cutlass/cuda_host_adapter.hpp"
namespace cutlass {
/////////////////////////////////////////////////////////////////////////////////////////////////
@@ -51,7 +52,7 @@ static constexpr int MinWorkspaceAlignment = 16;
#if !defined(__CUDACC_RTC__)
static Status
zero_workspace(void* workspace, size_t workspace_size, cudaStream_t stream = nullptr) {
zero_workspace(void* workspace, size_t workspace_size, cudaStream_t stream = nullptr, CudaHostAdapter *cuda_adapter = nullptr) {
if (workspace_size > 0) {
if (workspace == nullptr) {
CUTLASS_TRACE_HOST(" error: device workspace must not be null");
@@ -59,12 +60,28 @@ zero_workspace(void* workspace, size_t workspace_size, cudaStream_t stream = nul
}
CUTLASS_TRACE_HOST(" clearing workspace");
#if defined(CUTLASS_ENABLE_CUDA_HOST_ADAPTER) && CUTLASS_ENABLE_CUDA_HOST_ADAPTER
//
// Use the cuda host adapter
//
CUTLASS_ASSERT(cuda_adapter);
if (cuda_adapter) {
if (Status::kSuccess != cuda_adapter->memsetDevice(workspace, static_cast<uint8_t>(0), workspace_size, stream)) {
return Status::kErrorInternal;
}
}
else {
return Status::kErrorInternal;
}
#else
cudaError_t result = cudaMemsetAsync(workspace, 0, workspace_size, stream);
if (cudaSuccess != result) {
result = cudaGetLastError(); // to clear the error bit
CUTLASS_TRACE_HOST(" cudaMemsetAsync() returned error " << cudaGetErrorString(result));
return Status::kErrorInternal;
}
#endif
}
return Status::kSuccess;
@@ -83,20 +100,14 @@ fill_workspace(void* workspace, T fill_value, size_t fill_count, cudaStream_t st
}
CUTLASS_TRACE_HOST(" filling workspace");
CUdeviceptr d_workspace = reinterpret_cast<CUdeviceptr>(workspace);
#if defined(CUTLASS_ENABLE_CUDA_HOST_ADAPTER) && CUTLASS_ENABLE_CUDA_HOST_ADAPTER
//
// Use the cuda host adapter
//
CUTLASS_ASSERT(cuda_adapter);
if (cuda_adapter) {
Status status = Status::kErrorInternal;
status = cuda_adapter->memsetDevice(workspace, fill_value, fill_count, stream);
if (status!=Status::kSuccess) {
if (Status::kSuccess != cuda_adapter->memsetDevice(workspace, fill_value, fill_count, stream)) {
return Status::kErrorInternal;
}
}
@@ -104,6 +115,7 @@ fill_workspace(void* workspace, T fill_value, size_t fill_count, cudaStream_t st
return Status::kErrorInternal;
}
#else
CUdeviceptr d_workspace = reinterpret_cast<CUdeviceptr>(workspace);
CUresult result = CUDA_SUCCESS;
if (sizeof(T) == 4) {
result = cuMemsetD32Async(d_workspace, reinterpret_cast<uint32_t&>(fill_value), fill_count, stream);