-
Notifications
You must be signed in to change notification settings - Fork 917
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
Use make_strings_children in parse_data nested json reader #12382
Use make_strings_children in parse_data nested json reader #12382
Conversation
run benchmarks |
1 similar comment
run benchmarks |
Benchmark Resultsnested_json_gpu_parser[0] Quadro GV100
|
Codecov ReportBase: 86.58% // Head: 85.69% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## branch-23.02 #12382 +/- ##
================================================
- Coverage 86.58% 85.69% -0.89%
================================================
Files 155 155
Lines 24368 24803 +435
================================================
+ Hits 21098 21255 +157
- Misses 3270 3548 +278
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
} | ||
return out_it; | ||
return bytes; |
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.
When is bytes != num_chars_written
?
This function seems overly complex. Maybe I'm missing something?
constexpr size_type write_utf8_char(char_utf8 character, char*& out_it) {
auto const bytes = (out_it == nullptr) ? strings::detail::bytes_in_char_utf8(character) :
strings::detail::from_char_utf8(character, out_it);
out_it += bytes;
return bytes;
}
There does not seem to be a need for the template as well.
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 think, this is written to allow the compiler to unroll the loop.
I will change this to above suggestion.
col_size, | ||
std::move(offsets), | ||
std::move(chars), | ||
cudf::detail::null_count(static_cast<bitmask_type*>(null_mask.data()), 0, col_size, stream), |
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 was curious if this could be computed in the functor and if that would be faster than doing the null_count()
calculation here.
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.
null_count
method will be faster because it handles 32-bit per thread, while functor will handle 1 bit per thread, which will eventually lead to lesser atomicAdds to global memory too.
Besides, functor's shared memory is not in our control since we don't know threads per block. So, we can't use BlockReduce, which will increase no of atomicAdds to the global memory location.
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.
looks good, just some coding style suggestions.
return out_it; | ||
auto const bytes = (out_it == nullptr) ? strings::detail::bytes_in_char_utf8(character) | ||
: strings::detail::from_char_utf8(character, out_it); | ||
if (out_it) out_it += bytes; |
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.
if (out_it) out_it += bytes; | |
if (out_it != nullpt) { out_it += bytes; } |
__device__ void operator()(size_type idx) | ||
{ | ||
if (not bit_is_set(null_mask, idx)) { | ||
if (!d_chars) d_offsets[idx] = 0; |
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.
if (!d_chars) d_offsets[idx] = 0; | |
if (d_chars == nullptr) { d_offsets[idx] = 0; } |
|
||
// Check if the value corresponds to the null literal | ||
auto const is_null_literal = | ||
(!d_chars) && |
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.
(!d_chars) && | |
(d_chars == nullptr) && |
serialized_trie_contains(options.trie_na, {in_begin, static_cast<std::size_t>(num_in_chars)}); | ||
if (is_null_literal) { | ||
clear_bit(null_mask, idx); | ||
if (!d_chars) d_offsets[idx] = 0; |
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.
if (!d_chars) d_offsets[idx] = 0; | |
if (d_chars == nullptr) { d_offsets[idx] = 0; } |
auto str_process_info = process_string(in_begin, in_end, d_buffer, options); | ||
if (str_process_info.result != data_casting_result::PARSING_SUCCESS) { | ||
clear_bit(null_mask, idx); | ||
if (!d_chars) d_offsets[idx] = 0; |
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.
if (!d_chars) d_offsets[idx] = 0; | |
if (d_chars == nullptr) { d_offsets[idx] = 0; } |
clear_bit(null_mask, idx); | ||
if (!d_chars) d_offsets[idx] = 0; | ||
} else { | ||
if (!d_chars) d_offsets[idx] = str_process_info.bytes; |
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.
if (!d_chars) d_offsets[idx] = str_process_info.bytes; | |
if (d_chars == nullptr) { d_offsets[idx] = str_process_info.bytes; } |
String processing code is full of |
Well, I didn't follow the same style in my Not a big deal, this is probably a job for a tool to enforce/apply. |
\merge |
/merge |
Description
Use
make_strings_children
utility in parse_data nested json readerAddresses part of #12167
Checklist