-
-
Notifications
You must be signed in to change notification settings - Fork 826
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
Improve memory allocation performance #1343
Conversation
c241f49
to
a13db44
Compare
jenkins, test this please. |
Jenkins CI test (for commit 6752a44) failed with status FAILURE. |
jenkins, test this please. |
Jenkins CI test (for commit 6752a44) failed with status FAILURE. |
jenkins, test this please. |
Jenkins CI test (for commit 6752a44, target branch master) failed with status FAILURE. |
jenkins, test this please. |
Jenkins CI test (for commit 0d89993, target branch master) succeeded! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except for a minor comment.
@@ -166,10 +167,11 @@ cdef class _Chunk: | |||
|
|||
def __init__(self, *args): | |||
# For debug | |||
self._init(*args) | |||
mem, offset, size, stream_ptr = args |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you directly write __init__(self, mem, offset, size, stream_ptr)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, it looks this method is only used for debugging. Is it related to the performance improvement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to avoid compile error because _init
is a cdef
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, ok, understood.
@@ -617,13 +665,12 @@ cdef class SingleDeviceMemoryPool: | |||
|
|||
cpdef Py_ssize_t _round_size(self, Py_ssize_t size): | |||
"""Rounds up the memory size to fit memory alignment of cudaMalloc.""" | |||
unit = self._allocation_unit_size | |||
cdef Py_ssize_t unit = self._allocation_unit_size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Memo: this annotation is needed to let Cython avoid inferring the type of unit
as Python int.
LGTM |
Improve memory allocation performance
rel #1340.