-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[gemini] add GeminiMemoryManger #832
Conversation
colossalai/gemini/tensorful_state.py
Outdated
else: | ||
# when from_state is FREE, the tensor is new to manager | ||
# we should add its memory | ||
manager.total_mem[device_type] += 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.
How do you know the tensor is new to manager.
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.
Now, every payload holds its own memory.
colossalai/gemini/tensorful_state.py
Outdated
del self._payload | ||
|
||
# record new payload | ||
StatefulTensor.trans_state_update(tensor, TensorState.FREE, self.state) |
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.
We must call this function when the payload is newed or deleted.
Therefore trans_state_update is coupled with reset_payload and move_to.
Here are some negative effects.
First, it is not applicable to the other place. Because you have to keep in mind that the tensor is exactly allocated or deleted.
Or some others should not use the function. It is dangerous and will mess up your plan.
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.
I'm gonna change them to private functions.
* refactor StatefulTensor, tensor utilities * add unitest for GeminiMemoryManager
refactor StatefulTensor, tensor utilities
add unitest for GeminiMemoryManager