Skip to content

Commit

Permalink
Remove uint type and rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
nv-hwoo committed Sep 27, 2023
1 parent f9bd696 commit 2064297
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 36 deletions.
15 changes: 6 additions & 9 deletions src/c++/perf_analyzer/command_line_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ CLParser::Usage(const std::string& msg)
"--request-parameter <name:value:type>: Specifies a custom "
"parameter that can be sent to a Triton backend as part of the "
"request. For example, providing '--request-parameter "
"max_tokens:256:uint' to the command line will set an additional "
"parameter 'max_tokens' of type 'uint' to 256 as part of the "
"max_tokens:256:int' to the command line will set an additional "
"parameter 'max_tokens' of type 'int' to 256 as part of the "
"request. The --request-parameter may be specified multiple times "
"for different custom parameters.",
18)
Expand Down Expand Up @@ -1538,7 +1538,7 @@ CLParser::ParseCommandLine(int argc, char** argv)
break;
}
case 59: {
params_->using_periodic_concurrency_range = true;
params_->is_using_periodic_concurrency_mode = true;
std::string arg = optarg;
std::vector<std::string> values{SplitString(arg)};
if (values.size() < 2) {
Expand Down Expand Up @@ -1605,9 +1605,6 @@ CLParser::ParseCommandLine(int argc, char** argv)
if (type == "bool") {
param.type = RequestParameterType::BOOL;
param.bool_value = value == "true" ? true : false;
} else if (type == "uint") {
param.type = RequestParameterType::UINT;
param.uint_value = std::stoull(value);
} else if (type == "int") {
param.type = RequestParameterType::INT;
param.int_value = std::stoll(value);
Expand Down Expand Up @@ -1780,7 +1777,7 @@ CLParser::VerifyOptions()
}

std::vector<bool> load_modes{
params_->using_periodic_concurrency_range,
params_->is_using_periodic_concurrency_mode,
params_->using_concurrency_range, params_->using_request_rate_range,
params_->using_custom_intervals};
if (std::count(load_modes.begin(), load_modes.end(), true) > 1) {
Expand All @@ -1791,13 +1788,13 @@ CLParser::VerifyOptions()
"--request-intervals.");
}

if (params_->using_periodic_concurrency_range && !params_->streaming) {
if (params_->is_using_periodic_concurrency_mode && !params_->streaming) {
Usage(
"The --periodic-concurrency-range option requires bi-directional gRPC "
"streaming.");
}

if (params_->using_periodic_concurrency_range &&
if (params_->is_using_periodic_concurrency_mode &&
(params_->profile_export_file == "")) {
Usage(
"Must provide --profile-export-file when using the "
Expand Down
6 changes: 1 addition & 5 deletions src/c++/perf_analyzer/command_line_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ struct PerfAnalyzerParameters {
uint64_t measurement_window_ms = 5000;
bool using_concurrency_range = false;
Range<uint64_t> concurrency_range{1, 1, 1};
bool using_periodic_concurrency_range = false;
Range<uint64_t> periodic_concurrency_range{1, 1, 1};
uint64_t request_period = 10;
std::unordered_map<std::string, RequestParameter> request_parameters;
uint64_t latency_threshold_ms = NO_LIMIT;
double stability_threshold = 0.1;
Expand Down Expand Up @@ -155,9 +152,8 @@ struct PerfAnalyzerParameters {
std::string profile_export_file{""};

bool is_using_periodic_concurrency_mode{false};

Range<uint64_t> periodic_concurrency_range{1, 1, 1};
uint64_t periodic_concurrency_request_period{10};
uint64_t request_period{10};
};

using PAParamsPtr = std::shared_ptr<PerfAnalyzerParameters>;
Expand Down
6 changes: 3 additions & 3 deletions src/c++/perf_analyzer/docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@ Default value is `10`.
#### `--request-parameter=<name:value:type>`

Specifies a custom parameter that can be sent to a Triton backend as part of
the request. For example, providing '--request-parameter max_tokens:256:uint'
the request. For example, providing '--request-parameter max_tokens:256:int'
to the command line will set an additional parameter 'max_tokens' of type
'uint' to 256 as part of the request. The --request-parameter may be specified
'int' to 256 as part of the request. The --request-parameter may be specified
multiple times for different custom parameters.

Valid `type` values are: `bool`, `int`, `uint`, and `string`.
Valid `type` values are: `bool`, `int`, and `string`.

> **NOTE**
>
Expand Down
10 changes: 1 addition & 9 deletions src/c++/perf_analyzer/perf_analyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,6 @@ PerfAnalyzer::CreateAnalyzerObjects()
}

std::unique_ptr<pa::LoadManager> manager;
params_->is_using_periodic_concurrency_mode = true;
params_->periodic_concurrency_range = {
std::stoi(std::getenv("MY_START")), std::stoi(std::getenv("MY_END")),
std::stoi(std::getenv("MY_STEP"))};
params_->periodic_concurrency_request_period =
std::stoi(std::getenv("MY_REQUEST_PERIOD"));

if (params_->targeting_concurrency()) {
if ((parser_->SchedulerType() == pa::ModelParser::SEQUENCE) ||
(parser_->SchedulerType() == pa::ModelParser::ENSEMBLE_SEQUENCE)) {
Expand Down Expand Up @@ -221,8 +214,7 @@ PerfAnalyzer::CreateAnalyzerObjects()
params_->async, params_->streaming, params_->batch_size,
params_->max_threads, params_->max_concurrency,
params_->shared_memory_type, params_->output_shm_size, parser_, factory,
params_->periodic_concurrency_range,
params_->periodic_concurrency_request_period);
params_->periodic_concurrency_range, params_->request_period);
} else if (params_->using_request_rate_range) {
if ((params_->sequence_id_range != 0) &&
(params_->sequence_id_range < params_->num_of_sequences)) {
Expand Down
3 changes: 1 addition & 2 deletions src/c++/perf_analyzer/perf_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,11 @@ class Range {
T step;
};

enum RequestParameterType { STRING = 0, INT = 1, UINT = 2, BOOL = 3 };
enum RequestParameterType { STRING = 0, INT = 1, BOOL = 3 };

struct RequestParameter {
std::string str_value;
int64_t int_value;
uint64_t uint_value;
bool bool_value;
RequestParameterType type;
};
Expand Down
15 changes: 7 additions & 8 deletions src/c++/perf_analyzer/test_command_line_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ CHECK_PARAMS(PAParamsPtr act, PAParamsPtr exp)
CHECK(act->mpi_driver != nullptr);
CHECK_STRING(act->memory_type, exp->memory_type);
CHECK(
act->using_periodic_concurrency_range ==
exp->using_periodic_concurrency_range);
act->is_using_periodic_concurrency_mode ==
exp->is_using_periodic_concurrency_mode);
CHECK(
act->periodic_concurrency_range.start ==
exp->periodic_concurrency_range.start);
Expand All @@ -200,8 +200,6 @@ CHECK_PARAMS(PAParamsPtr act, PAParamsPtr exp)
CHECK(act_param.second.str_value == exp_param->second.str_value);
} else if (act_param.second.type == RequestParameterType::INT) {
CHECK(act_param.second.int_value == exp_param->second.int_value);
} else if (act_param.second.type == RequestParameterType::UINT) {
CHECK(act_param.second.uint_value == exp_param->second.uint_value);
} else if (act_param.second.type == RequestParameterType::BOOL) {
CHECK(act_param.second.bool_value == exp_param->second.bool_value);
}
Expand Down Expand Up @@ -1232,6 +1230,7 @@ TEST_CASE("Testing Command Line Parser")
exp->async = true;
exp->streaming = true;
exp->url = "localhost:8001"; // gRPC url
exp->max_threads = 4; // not targeting concurrency

SUBCASE("start provided")
{
Expand All @@ -1254,7 +1253,7 @@ TEST_CASE("Testing Command Line Parser")
}

CheckValidRange(
args, option_name, parser, act, exp->using_periodic_concurrency_range,
args, option_name, parser, act, exp->is_using_periodic_concurrency_mode,
exp->periodic_concurrency_range);

CheckInvalidRange(args, option_name, parser, act, check_params);
Expand Down Expand Up @@ -1384,7 +1383,7 @@ TEST_CASE("Testing Command Line Parser")
SUBCASE("valid parameter")
{
args.push_back(option_name);
args.push_back("max_tokens:256:uint");
args.push_back("max_tokens:256:int");

int argc = args.size();
char* argv[argc];
Expand All @@ -1394,8 +1393,8 @@ TEST_CASE("Testing Command Line Parser")
CHECK(!parser.UsageCalled());

RequestParameter param;
param.uint_value = 256;
param.type = RequestParameterType::UINT;
param.int_value = 256;
param.type = RequestParameterType::INT;
exp->request_parameters["max_tokens"] = param;
}

Expand Down

0 comments on commit 2064297

Please sign in to comment.