Skip to content
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

fix: Fix L0_request_cancellation and L0_backend_output_detail byte size checks #363

Merged
merged 3 commits into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 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 @@ -181,26 +181,30 @@ class BackendOutputDetailTest : public ::testing::Test {
nullptr /* request_release_userp */),
"setting request release callback");

std::vector<int64_t> input0_shape({16});
std::vector<int64_t> input1_shape({16});
std::vector<int64_t> input0_shape({1, 16});
std::vector<int64_t> input1_shape({1, 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);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: What's the point of changing it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has to match the std::vector<int64_t> input0_shape({1, 1000}); , which is also the shape specified in the config.pbtxt of the model being used for testing

TEST_F(RequestCancellationTest, Cancellation)
{
Expand Down
Loading