Skip to content

Commit

Permalink
fix: Fix L0_request_cancellation and L0_backend_output_detail byte si…
Browse files Browse the repository at this point in the history
…ze checks (#363)
  • Loading branch information
rmccorm4 authored Jun 1, 2024
1 parent bbcd781 commit c26629f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
14 changes: 9 additions & 5 deletions src/test/backend_output_detail_test.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// Copyright 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -183,24 +183,28 @@ class BackendOutputDetailTest : public ::testing::Test {

std::vector<int64_t> input0_shape({16});
std::vector<int64_t> input1_shape({16});

const auto input0_byte_size = sizeof(input0_data_[0]) * input0_data_.size();
const auto input1_byte_size = sizeof(input1_data_[0]) * input1_data_.size();

FAIL_TEST_IF_ERR(
TRITONSERVER_InferenceRequestAddInput(
irequest_, "INPUT0", TRITONSERVER_TYPE_FP32, &input0_shape[0],
irequest_, "INPUT0", TRITONSERVER_TYPE_FP32, input0_shape.data(),
input0_shape.size()),
"setting input0 for the request");
FAIL_TEST_IF_ERR(
TRITONSERVER_InferenceRequestAppendInputData(
irequest_, "INPUT0", &input0_data_[0], input0_data_.size(),
irequest_, "INPUT0", input0_data_.data(), input0_byte_size,
TRITONSERVER_MEMORY_CPU, 0),
"assigning INPUT data");
FAIL_TEST_IF_ERR(
TRITONSERVER_InferenceRequestAddInput(
irequest_, "INPUT1", TRITONSERVER_TYPE_FP32, &input1_shape[0],
irequest_, "INPUT1", TRITONSERVER_TYPE_FP32, input1_shape.data(),
input1_shape.size()),
"setting input1 for the request");
FAIL_TEST_IF_ERR(
TRITONSERVER_InferenceRequestAppendInputData(
irequest_, "INPUT1", &input1_data_[0], input1_data_.size(),
irequest_, "INPUT1", input1_data_.data(), input1_byte_size,
TRITONSERVER_MEMORY_CPU, 0),
"assigning INPUT1 data");
}
Expand Down
10 changes: 6 additions & 4 deletions src/test/request_cancellation_test.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// Copyright 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -155,10 +155,12 @@ class RequestCancellationTest : public ::testing::Test {

std::vector<int64_t> input0_shape({1, 1000});
FAIL_TEST_IF_ERR(TRITONSERVER_InferenceRequestAddInput(
irequest_, "INPUT0", TRITONSERVER_TYPE_INT32, &input0_shape[0],
irequest_, "INPUT0", TRITONSERVER_TYPE_INT32, input0_shape.data(),
input0_shape.size()));

const auto input0_byte_size = sizeof(input0_data_[0]) * input0_data_.size();
FAIL_TEST_IF_ERR(TRITONSERVER_InferenceRequestAppendInputData(
irequest_, "INPUT0", &input0_data_[0], input0_data_.size(),
irequest_, "INPUT0", input0_data_.data(), input0_byte_size,
TRITONSERVER_MEMORY_CPU, 0));
}

Expand All @@ -175,7 +177,7 @@ class RequestCancellationTest : public ::testing::Test {
};

TRITONSERVER_Server* RequestCancellationTest::server_ = nullptr;
std::vector<int32_t> RequestCancellationTest::input0_data_(16, 1);
std::vector<int32_t> RequestCancellationTest::input0_data_(1000, 1);

TEST_F(RequestCancellationTest, Cancellation)
{
Expand Down

0 comments on commit c26629f

Please sign in to comment.