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

patch for cusparseLt 0.6.1 #8074

Merged
merged 51 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
2397a60
patch for cusparselt5
Jan 1, 2024
164d678
fix typo (ata -> data)
Jan 1, 2024
fecd642
fix the bug around cusparseLtSplitKMode_t
Jan 2, 2024
636d541
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Jan 16, 2024
7e05cf3
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Jan 23, 2024
1f7e3eb
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Jan 27, 2024
f5495d8
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Jan 28, 2024
6bbe98f
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Jan 31, 2024
6e8e0c6
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Feb 8, 2024
cb6a11a
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Feb 12, 2024
3762080
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Feb 13, 2024
5099081
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Feb 15, 2024
0bf9e1f
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Feb 15, 2024
91693d6
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Feb 15, 2024
71ee5f9
Merge branch 'cupy:main' into devcusparselt5
gdaisukesuzuki Feb 16, 2024
665886e
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Feb 18, 2024
c018e6e
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Feb 22, 2024
531a4c2
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Feb 26, 2024
e5daf04
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Mar 1, 2024
29186e0
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Mar 8, 2024
48f3bc6
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Mar 14, 2024
4c97c4f
cusparselt060
Mar 21, 2024
9375b59
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Mar 21, 2024
38b8e91
Updated format by inserting CR.
Mar 22, 2024
a416090
amend via comment on github
Mar 24, 2024
31de442
slightly changed
Mar 24, 2024
8be3a17
amended
Mar 24, 2024
a23625d
indent typo
Mar 24, 2024
4378cbb
fix typo
Mar 24, 2024
935f335
amended
Mar 25, 2024
3f11e85
set type of parameter data to any
Mar 25, 2024
902097a
fixed cusparselt.pxd
Mar 27, 2024
a43f1b8
lint check and amend type of parameter data
Mar 27, 2024
0cb5b0e
apply the patch recomended in static-checkes
Mar 27, 2024
1c46f98
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Mar 27, 2024
bf4e577
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Mar 29, 2024
d017b30
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Apr 1, 2024
3223829
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Apr 2, 2024
2b4ac34
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Apr 3, 2024
f1cb7a2
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Apr 8, 2024
7670a21
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Apr 11, 2024
541f037
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Apr 17, 2024
72de318
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Apr 26, 2024
3d04f49
Merge branch 'main' into devcusparselt5
gdaisukesuzuki May 5, 2024
56483ab
Merge branch 'main' into devcusparselt5
gdaisukesuzuki May 10, 2024
b08e43e
Merge branch 'main' into devcusparselt5
gdaisukesuzuki May 16, 2024
0d28d10
Merge branch 'main' into devcusparselt5
gdaisukesuzuki May 27, 2024
995917b
Merge branch 'main' into devcusparselt5
gdaisukesuzuki Jun 4, 2024
eceaa1a
add cusparseLt 0.6.1 to CI variant
kmaehashi Jun 5, 2024
8924855
regenerate
kmaehashi Jun 5, 2024
d5ae19b
Merge branch 'add-cusparselt-0.6.1-ci' into devcusparselt5
kmaehashi Jun 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 16 additions & 6 deletions cupy_backends/cuda/libs/cusparselt.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@ cpdef enum:
CUSPARSELT_MAT_BATCH_STRIDE = 1 # READ/WRITE

# cusparseComputeType
CUSPARSE_COMPUTE_16F = 0
CUSPARSE_COMPUTE_32I = 1
CUSPARSE_COMPUTE_TF32 = 2
CUSPARSE_COMPUTE_TF32_FAST = 3
CUSPARSE_COMPUTE_32I = 0
CUSPARSE_COMPUTE_16F = 1
CUSPARSE_COMPUTE_32F = 2

# cusparseLtMatmulDescAttribute_t
CUSPARSELT_MATMUL_ACTIVATION_RELU = 0 # READ/WRITE
CUSPARSELT_MATMUL_ACTIVATION_RELU_UPPERBOUND = 1 # READ/WRITE
CUSPARSELT_MATMUL_ACTIVATION_RELU_THRESHOLD = 2 # READ/WRITE
CUSPARSELT_MATMUL_ACTIVATION_GELU = 3 # READ/WRITE
CUSPARSELT_MATMUL_BIAS_STRIDE = 4 # READ/WRITE
CUSPARSELT_MATMUL_BIAS_POINTER = 5 # READ/WRITE
CUSPARSELT_MATMUL_ACTIVATION_GELU_SCALING = 4 # READ/WRITE
CUSPARSELT_MATMUL_ALPHA_VECTOR_SCALING = 5 # READ/WRITE
CUSPARSELT_MATMUL_BETA_VECTOR_SCALING = 6 # READ/WRITE
CUSPARSELT_MATMUL_BIAS_POINTER = 7 # READ/WRITE
CUSPARSELT_MATMUL_BIAS_STRIDE = 8 # READ/WRITE
gdaisukesuzuki marked this conversation as resolved.
Show resolved Hide resolved

# cusparseLtMatmulAlg_t
CUSPARSELT_MATMUL_ALG_DEFAULT = 0
Expand All @@ -33,6 +35,14 @@ cpdef enum:
CUSPARSELT_MATMUL_ALG_CONFIG_ID = 0 # NOQA, READ/WRITE
CUSPARSELT_MATMUL_ALG_CONFIG_MAX_ID = 1 # NOQA, READ-ONLY
CUSPARSELT_MATMUL_SEARCH_ITERATIONS = 2 # NOQA, READ/WRITE
CUSPARSELT_MATMUL_SPLIT_K = 3 # NOQA, READ/WRITE
CUSPARSELT_MATMUL_SPLIT_K_MODE =4 # NOQA, READ/WRITE
CUSPARSELT_MATMUL_SPLIT_K_BUFFERS=5 # NOQA, READ/WRITE

# cusparseLtSplitKMode_t
CUSPARSELT_INVALID_MODE = 0
CUSPARSELT_SPLIT_K_MODE_ONE_KERNEL = 1
CUSPARSELT_SPLIT_K_MODE_TWO_KERNELS = 2

# cusparseLtPruneAlg_t
CUSPARSELT_PRUNE_SPMMA_TILE = 0
Expand Down
140 changes: 96 additions & 44 deletions cupy_backends/cuda/libs/cusparselt.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ from cupy_backends.cuda.api cimport runtime
from cupy_backends.cuda.libs import cusparse as _cusparse


###############################################################################
# Types
###############################################################################
cdef extern from *:
ctypedef void* LibraryPropertyType 'libraryPropertyType_t'


cdef extern from '../../cupy_cusparselt.h' nogil:
ctypedef int cusparseStatus_t 'cusparseStatus_t'
ctypedef int cusparseOrder_t 'cusparseOrder_t'
Expand All @@ -36,11 +43,14 @@ cdef extern from '../../cupy_cusparselt.h' nogil:
ctypedef int cusparseOperation_t 'cusparseOperation_t'
ctypedef int cusparseLtMatmulAlg_t 'cusparseLtMatmulAlg_t'
ctypedef int cusparseLtMatmulAlgAttribute_t 'cusparseLtMatmulAlgAttribute_t' # NOQA
ctypedef int cusparseLtSplitKMode_t 'cusparseLtSplitKMode_t'
ctypedef int cusparseLtPruneAlg_t 'cusparseLtPruneAlg_t'

# Management Functions
cusparseStatus_t cusparseLtInit(cusparseLtHandle_t* handle)
cusparseStatus_t cusparseLtDestroy(const cusparseLtHandle_t* handle)
cusparseStatus_t cusparseLtGetVersion(const cusparseLtHandle_t* handle, int* version)
cusparseStatus_t cusparseLtGetProperty(LibraryPropertyType propertyType, int* value)

# Matmul Functions
cusparseStatus_t cusparseLtDenseDescriptorInit(
Expand All @@ -66,6 +76,11 @@ cdef extern from '../../cupy_cusparselt.h' nogil:
const cusparseLtMatDescriptor_t* matDescr,
cusparseLtMatDescAttribute_t matAttribute,
void* data, size_t dataSize)
cusparseStatus_t cusparseLtMatDescSetAttribute(
const cusparseLtHandle_t* handle,
const cusparseLtMatDescriptor_t* matDescr,
cusparseLtMatDescAttribute_t matAttribute,
void* data, size_t dataSize)
cusparseStatus_t cusparseLtMatmulDescriptorInit(
const cusparseLtHandle_t* handle,
cusparseLtMatmulDescriptor_t* matMulDescr,
Expand Down Expand Up @@ -95,24 +110,33 @@ cdef extern from '../../cupy_cusparselt.h' nogil:
const cusparseLtHandle_t* handle,
cusparseLtMatmulAlgSelection_t* algSelection,
cusparseLtMatmulAlgAttribute_t attribute,
const void* data, size_t ataSize)
cusparseStatus_t cusparseLtMatmulGetWorkspace(
const void* data, size_t dataSize)
cusparseStatus_t cusparseLtMatmulAlgGetAttribute(
const cusparseLtHandle_t* handle,
const cusparseLtMatmulAlgSelection_t* algSelection,
cusparseLtMatmulAlgAttribute_t attribute,
void* data, size_t dataSize)
cusparseStatus_t cusparseLtMatmulGetWorkspace(
const cusparseLtHandle_t* handle,
const cusparseLtMatmulPlan_t* plan,
size_t* workspaceSize)
cusparseStatus_t cusparseLtMatmulPlanInit(
const cusparseLtHandle_t* handle,
cusparseLtMatmulPlan_t* plan,
const cusparseLtMatmulDescriptor_t* matmulDescr,
const cusparseLtMatmulAlgSelection_t* algSelection,
size_t workspaceSize)
const cusparseLtMatmulAlgSelection_t* algSelection)
cusparseStatus_t cusparseLtMatmulPlanDestroy(
const cusparseLtMatmulPlan_t* plan)
cusparseStatus_t cusparseLtMatmul(
const cusparseLtHandle_t* handle, const cusparseLtMatmulPlan_t* plan,
const void* alpha, const void* d_A, const void* d_B,
const void* beta, const void* d_C, void* d_D,
void* workspace, runtime.Stream* streams, int32_t numStreams)
cusparseStatus_t cusparseLtMatmulSearch(
const cusparseLtHandle_t* handle, cusparseLtMatmulPlan_t* plan,
const void* alpha, const void* d_A, const void* d_B,
const void* beta, const void* d_C, void* d_D,
void* workspace, runtime.Stream* streams, int32_t numStreams)

# Helper Functions
cusparseStatus_t cusparseLtSpMMAPrune(
Expand All @@ -123,7 +147,7 @@ cdef extern from '../../cupy_cusparselt.h' nogil:
cusparseStatus_t cusparseLtSpMMAPruneCheck(
const cusparseLtHandle_t* handle,
const cusparseLtMatmulDescriptor_t* matmulDescr,
const void* d_in, int* valid, runtime.Stream stream)
const void* d_in, int* d_valid, runtime.Stream stream)
cusparseStatus_t cusparseLtSpMMAPrune2(
const cusparseLtHandle_t* handle,
const cusparseLtMatDescriptor_t* sparseMatDescr,
Expand All @@ -136,19 +160,22 @@ cdef extern from '../../cupy_cusparselt.h' nogil:
runtime.Stream stream)
cusparseStatus_t cusparseLtSpMMACompressedSize(
const cusparseLtHandle_t* handle, const cusparseLtMatmulPlan_t* plan,
size_t* compressedSize)
size_t* compressedSize,
size_t* compressBufferSize)
cusparseStatus_t cusparseLtSpMMACompress(
const cusparseLtHandle_t* handle, const cusparseLtMatmulPlan_t* plan,
const void* d_dense, void* d_compressed, runtime.Stream stream)
const void* d_dense, void* d_compressed, void* d_compressed_buffer,
runtime.Stream stream)
cusparseStatus_t cusparseLtSpMMACompressedSize2(
const cusparseLtHandle_t* handle,
const cusparseLtMatDescriptor_t* sparseMatDescr,
size_t* compressedSize)
size_t* compressedSize,
size_t* compressBufferSize)
cusparseStatus_t cusparseLtSpMMACompress2(
const cusparseLtHandle_t* handle,
const cusparseLtMatDescriptor_t* sparseMatDescr,
int isSparseA, cusparseOperation_t op, const void* d_dense,
void* d_compressed, runtime.Stream stream)
void* d_compressed, void* d_compressed_buffer, runtime.Stream stream)

# Build-time version
int CUSPARSELT_VERSION
Expand Down Expand Up @@ -233,6 +260,7 @@ cdef class MatmulPlan:
return <intptr_t>self._ptr



###############################################################################
# Error handling
###############################################################################
Expand Down Expand Up @@ -290,23 +318,23 @@ cpdef matDescriptorDestroy(MatDescriptor matDescr):
check_status(status)

cpdef matDescSetAttribute(Handle handle, MatDescriptor matDescr,
matAttribute, size_t data, size_t dataSize):
matAttribute, data, size_t dataSize):
gdaisukesuzuki marked this conversation as resolved.
Show resolved Hide resolved
"""Sets the attribute related to matrix descriptor."""
status = cusparseLtMatDescSetAttribute(
<const cusparseLtHandle_t*> handle._ptr,
<cusparseLtMatDescriptor_t*> matDescr._ptr,
<cusparseLtMatDescAttribute_t> matAttribute,
<const void*> data, dataSize)
<const void*> data, <size_t> dataSize)
check_status(status)

cpdef matDescGetAttribute(Handle handle, MatDescriptor matDescr,
matAttribute, size_t data, size_t dataSize):
matAttribute, data, size_t dataSize):
"""Gets the attribute related to matrix descriptor."""
status = cusparseLtMatDescGetAttribute(
<const cusparseLtHandle_t*> handle._ptr,
<const cusparseLtMatDescriptor_t*> matDescr._ptr,
<cusparseLtMatDescAttribute_t> matAttribute,
<void*> data, dataSize)
<void*> data, <size_t> dataSize)
check_status(status)

cpdef matmulDescriptorInit(Handle handle,
Expand All @@ -331,23 +359,23 @@ cpdef matmulDescriptorInit(Handle handle,
check_status(status)

cpdef matmulDescSetAttribute(Handle handle, MatmulDescriptor matmulDescr,
matmulAttribute, size_t data, size_t dataSize):
matmulAttribute, data, size_t dataSize):
"""Sets the attribute related to matmul descriptor."""
status = cusparseLtMatmulDescSetAttribute(
<const cusparseLtHandle_t*> handle._ptr,
<cusparseLtMatmulDescriptor_t*> matmulDescr._ptr,
<cusparseLtMatmulDescAttribute_t> matmulAttribute,
<const void*> data, dataSize)
<const void*> data, <size_t> dataSize)
check_status(status)

cpdef matmulDescGetAttribute(Handle handle, MatmulDescriptor matmulDescr,
matmulAttribute, size_t data, size_t dataSize):
matmulAttribute, data, size_t dataSize):
gdaisukesuzuki marked this conversation as resolved.
Show resolved Hide resolved
"""Gets the attribute related to matmul descriptor."""
status = cusparseLtMatmulDescGetAttribute(
<const cusparseLtHandle_t*> handle._ptr,
<const cusparseLtMatmulDescriptor_t*> matmulDescr._ptr,
<cusparseLtMatmulDescAttribute_t> matmulAttribute,
<void*> data, dataSize)
<void*> data, <size_t> dataSize)
check_status(status)

cpdef matmulAlgSelectionInit(Handle handle, MatmulAlgSelection algSelection,
Expand All @@ -361,7 +389,8 @@ cpdef matmulAlgSelectionInit(Handle handle, MatmulAlgSelection algSelection,
check_status(status)

cpdef matmulAlgSetAttribute(Handle handle, MatmulAlgSelection algSelection,
attribute, size_t data, size_t dataSize):
attribute,
data, size_t dataSize):
gdaisukesuzuki marked this conversation as resolved.
Show resolved Hide resolved
"""Sets the attribute related to algorithm selection descriptor."""
status = cusparseLtMatmulAlgSetAttribute(
<const cusparseLtHandle_t*> handle._ptr,
Expand All @@ -370,28 +399,37 @@ cpdef matmulAlgSetAttribute(Handle handle, MatmulAlgSelection algSelection,
<const void*> data, <size_t> dataSize)
check_status(status)

cpdef matmulAlgGetAttribute(Handle handle, MatmulAlgSelection algSelection,
attribute,
data, size_t dataSize):
gdaisukesuzuki marked this conversation as resolved.
Show resolved Hide resolved
"""Gets the attribute related to algorithm selection descriptor."""
status = cusparseLtMatmulAlgGetAttribute(
<const cusparseLtHandle_t*> handle._ptr,
<const cusparseLtMatmulAlgSelection_t*> algSelection._ptr,
<cusparseLtMatmulAlgAttribute_t> attribute,
<void*> data, <size_t> dataSize)
check_status(status)

cpdef size_t matmulGetWorkspace(Handle handle,
MatmulAlgSelection algSelection):
MatmulPlan plan):
"""Determines the required workspace size"""
cdef size_t workspaceSize
status = cusparseLtMatmulGetWorkspace(
<const cusparseLtHandle_t*> handle._ptr,
<const cusparseLtMatmulAlgSelection_t*> algSelection._ptr,
&workspaceSize)
<const cusparseLtMatmulPlan_t*> plan._ptr,
<size_t*> &workspaceSize)
check_status(status)
return workspaceSize

cpdef matmulPlanInit(Handle handle, MatmulPlan plan,
MatmulDescriptor matmulDescr,
MatmulAlgSelection algSelection,
size_t workspaceSize):
MatmulAlgSelection algSelection):
"""Initializes the plan."""
status = cusparseLtMatmulPlanInit(
<const cusparseLtHandle_t*> handle._ptr,
<cusparseLtMatmulPlan_t*> plan._ptr,
<const cusparseLtMatmulDescriptor_t*> matmulDescr._ptr,
<const cusparseLtMatmulAlgSelection_t*> algSelection._ptr,
<size_t> workspaceSize)
<const cusparseLtMatmulAlgSelection_t*> algSelection._ptr)
check_status(status)

cpdef matmulPlanDestroy(MatmulPlan plan):
Expand All @@ -412,7 +450,19 @@ cpdef matmul(Handle handle, MatmulPlan plan,
<void*> workspace, <runtime.Stream*> NULL, <int32_t> 0)
check_status(status)

###############################################################################
cpdef matmulSearch(Handle handle, MatmulPlan plan,
size_t alpha, size_t d_A, size_t d_B,
size_t beta, size_t d_C, size_t d_D, size_t workspace):
gdaisukesuzuki marked this conversation as resolved.
Show resolved Hide resolved
"""Evaluates all available algorithms for the matrix multiplication"""
status = cusparseLtMatmulSearch(
<const cusparseLtHandle_t*> handle._ptr,
<cusparseLtMatmulPlan_t*> plan._ptr,
<const void*> alpha, <const void*> d_A, <const void*> d_B,
<const void*> beta, <const void*> d_C, <void*> d_D,
<void*> workspace, <runtime.Stream*> NULL, <int32_t> 0)
check_status(status)

############<void*> ###################################################################
gdaisukesuzuki marked this conversation as resolved.
Show resolved Hide resolved
# cuSPARSELt: Helper Functions
###############################################################################

Expand All @@ -428,16 +478,16 @@ cpdef spMMAPrune(Handle handle, MatmulDescriptor matmulDescr,
check_status(status)

cpdef spMMAPruneCheck(Handle handle, MatmulDescriptor matmulDescr,
size_t d_in, size_t valid):
size_t d_in, size_t d_valid):
"""Checks the correctness of the pruning structure"""
cdef intptr_t stream = stream_module.get_current_stream_ptr()
status = cusparseLtSpMMAPruneCheck(
<const cusparseLtHandle_t*> handle._ptr,
<const cusparseLtMatmulDescriptor_t*> matmulDescr._ptr,
<const void*> d_in, <int*> valid, <runtime.Stream> stream)
<const void*> d_in, <int*> d_valid, <runtime.Stream> stream)
check_status(status)

cpdef spMMAPrune2(Handle handle, MatDescriptor sparseMatDescr, isSparseA,
cpdef spMMAPrune2(Handle handle, MatDescriptor sparseMatDescr, int isSparseA,
op, size_t d_in, size_t d_out, pruneAlg):
"""Prunes a dense matrix d_in"""
cdef intptr_t stream = stream_module.get_current_stream_ptr()
Expand All @@ -460,47 +510,49 @@ cpdef spMMAPruneCheck2(Handle handle, MatDescriptor sparseMatDescr, isSparseA,
<int*> d_valid, <runtime.Stream> stream)
check_status(status)

cpdef size_t spMMACompressedSize(Handle handle, MatmulPlan plan):
cpdef spMMACompressedSize(Handle handle, MatmulPlan plan):
"""Provides the size of the compressed matrix"""
cdef size_t compressedSize
cdef size_t compressedSize, compressBufferSize
status = cusparseLtSpMMACompressedSize(
<const cusparseLtHandle_t*> handle._ptr,
<const cusparseLtMatmulPlan_t*> plan._ptr,
&compressedSize)
<size_t*> &compressedSize, <size_t*> &compressBufferSize)
check_status(status)
return compressedSize
return compressedSize, compressBufferSize

cpdef spMMACompress(Handle handle, MatmulPlan plan,
size_t d_dense, size_t d_compressed):
cpdef spMMACompress(Handle handle, MatmulPlan plan, size_t d_dense,
size_t d_compressed, size_t d_compressed_buffer):
gdaisukesuzuki marked this conversation as resolved.
Show resolved Hide resolved
"""Compresses a dense matrix d_dense."""
cdef intptr_t stream = stream_module.get_current_stream_ptr()
status = cusparseLtSpMMACompress(
<const cusparseLtHandle_t*> handle._ptr,
<const cusparseLtMatmulPlan_t*> plan._ptr,
<const void*> d_dense, <void*> d_compressed, <runtime.Stream> stream)
<const cusparseLtMatmulPlan_t*> plan._ptr, <const void*> d_dense,
<void*> d_compressed, <void*> d_compressed_buffer,
<runtime.Stream> stream)
check_status(status)

cpdef size_t spMMACompressedSize2(Handle handle, MatDescriptor sparseMatDescr):
cpdef spMMACompressedSize2(Handle handle, MatDescriptor sparseMatDescr):
"""Provides the size of the compressed matrix"""
cdef size_t compressedSize
cdef size_t compressedSize, compressBufferSize
status = cusparseLtSpMMACompressedSize2(
<const cusparseLtHandle_t*> handle._ptr,
<const cusparseLtMatDescriptor_t*> sparseMatDescr._ptr,
&compressedSize)
<size_t*> &compressedSize, <size_t*> &compressBufferSize)
check_status(status)
return compressedSize
return compressedSize, compressBufferSize

cpdef spMMACompress2(Handle handle, MatDescriptor sparseMatDescr,
isSparseA, op, size_t d_dense, size_t d_compressed):
isSparseA, op, size_t d_dense,
size_t d_compressed, size_t d_compressed_buffer):
gdaisukesuzuki marked this conversation as resolved.
Show resolved Hide resolved
"""Compresses a dense matrix d_dense."""
cdef intptr_t stream = stream_module.get_current_stream_ptr()
status = cusparseLtSpMMACompress2(
<const cusparseLtHandle_t*> handle._ptr,
<const cusparseLtMatDescriptor_t*> sparseMatDescr._ptr,
<int> isSparseA, <cusparseOperation_t> op, <const void*> d_dense,
<void*> d_compressed, <runtime.Stream> stream)
<void*> d_compressed, <void*> d_compressed_buffer,
<runtime.Stream> stream)
check_status(status)


def get_build_version():
return CUSPARSELT_VERSION