This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
fix a bug in sparse batch loader when batch size is extremely large #8922
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cjolivier01
reviewed
Dec 5, 2017
// tensor buffer sizes | ||
std::vector<size_t> buff_sizes(total_size, 0); | ||
dtypes_.resize(total_size); | ||
out_.data.resize(total_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 big can total_size get?
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.
at most 6
int64_t unit_size = 0; | ||
out_.inst_index[top] = d.index; | ||
for (size_t i = 0; i < d.data.size(); ++i) { | ||
if (!IsIndPtr(i)) { |
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 big can d.data.size() get?
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.
usually at most 6
cjolivier01
approved these changes
Dec 5, 2017
Closing it for now until the test is fixed |
7 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The previous implementation of sparse batch loader waits for the number of data instances reaches
batch_size
before allocating the buffer for copy (unlike dense batch loader, we don't know the actual buffer size to allocate since the number of non-zeros varies). However, such delayed allocate is buggy when batch size is extremely large, because theDataInst
returned bybase_
is only a reference to the data. By the time copy happens, the referenced data might already be updated by the parser.This PR modifies the sparse batch loader to be almost the same as batch loader, except that:
@cjolivier01 @reminisce @anirudh2290 @ZiyueHuang
Checklist
Essentials
make lint
)Changes
Comments