Skip to content

Commit

Permalink
Fix nvbug: get-json-obj get incorrect result on some GPUs(H100, V100)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chong Gao committed Apr 9, 2024
1 parent 5e315f9 commit ff2db7e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/main/cpp/src/get_json_object.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ rmm::device_uvector<path_instruction> construct_path_commands(
* @param out_buf_size Size of the output buffer
* @returns A pair containing the result code and the output buffer.
*/
__device__ thrust::pair<bool, size_t> get_json_object_single(
__device__ thrust::pair<bool, json_generator> get_json_object_single(
char const* input,
cudf::size_type input_len,
path_instruction const* path_commands_ptr,
Expand All @@ -1180,7 +1180,7 @@ __device__ thrust::pair<bool, size_t> get_json_object_single(

j_parser.next_token();
// JSON validation check
if (json_token::ERROR == j_parser.get_current_token()) { return {false, 0}; }
if (json_token::ERROR == j_parser.get_current_token()) { return {false, generator}; }

if (nullptr == out_buf) {
// First step: preprocess sizes
Expand All @@ -1193,12 +1193,12 @@ __device__ thrust::pair<bool, size_t> get_json_object_single(
// set output as zero to tell second step
generator.set_output_len_zero();
}
return {success, generator.get_output_len()};
return {success, generator};
} else {
// Second step: writes output
bool success = evaluate_path(
j_parser, generator, write_style::raw_style, path_commands_ptr, path_commands_size);
return {success, generator.get_output_len()};
return {success, generator};
}
}

Expand Down Expand Up @@ -1245,8 +1245,11 @@ __launch_bounds__(block_size) CUDF_KERNEL
out_buf != nullptr ? output_offsets[tid + 1] - output_offsets[tid] : 0;

// process one single row
auto [result, output_size] = get_json_object_single(
bool result;
json_generator generator;
thrust::tie(result, generator) = get_json_object_single(
str.data(), str.size_bytes(), path_commands_ptr, path_commands_size, dst, dst_size);
output_size = generator.get_output_len();
if (result) { is_valid = true; }
}

Expand Down
1 change: 1 addition & 0 deletions src/main/cpp/src/get_json_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once

#include "json_parser.cuh"

Expand Down

0 comments on commit ff2db7e

Please sign in to comment.