Simpify some of the changes

This commit is contained in:
Gaurav Garg
2026-07-10 21:48:33 +05:30
parent 3e753aa27d
commit 9c22762603
13 changed files with 120 additions and 119 deletions
+24 -10
View File
@@ -16,19 +16,33 @@
static void test(void) {
common_params params;
assert(common_speculative_n_outputs_max(16, 2, 3) == 8);
assert(common_speculative_n_outputs_max(16, 2, -1) == 2);
assert(common_speculative_n_outputs_max(4, 2, 3) == 4);
assert(common_speculative_n_outputs_max(
auto assert_output_limits = [](int32_t n_batch, int32_t n_parallel, int32_t n_draft,
int32_t total, int32_t per_seq) {
const auto limits = common_speculative_get_output_limits(n_batch, n_parallel, n_draft);
assert(limits.total == total);
assert(limits.per_seq == per_seq);
};
assert_output_limits(16, 2, 3, 8, 4);
assert_output_limits(16, 2, -1, 2, 1);
assert_output_limits( 4, 2, 3, 4, 4);
assert_output_limits( 2, 1, 3, 2, 2);
assert_output_limits(
std::numeric_limits<int32_t>::max(),
std::numeric_limits<int32_t>::max(),
std::numeric_limits<int32_t>::max()) == std::numeric_limits<int32_t>::max());
assert(common_speculative_n_outputs_per_seq_max(16, 3) == 4);
assert(common_speculative_n_outputs_per_seq_max(16, -1) == 1);
assert(common_speculative_n_outputs_per_seq_max(2, 3) == 2);
assert(common_speculative_n_outputs_per_seq_max(
std::numeric_limits<int32_t>::max(),
std::numeric_limits<int32_t>::max()) == std::numeric_limits<int32_t>::max());
std::numeric_limits<int32_t>::max(),
std::numeric_limits<int32_t>::max());
{
common_params base;
base.n_parallel = 4;
base.n_sampling_outputs_per_seq_max = 8;
const auto draft = common_base_params_to_speculative(base);
assert(draft.n_outputs_max == 4);
assert(draft.n_sampling_outputs_per_seq_max == 1);
}
printf("test-arg-parser: make sure there is no duplicated arguments in any examples\n\n");
for (int ex = 0; ex < LLAMA_EXAMPLE_COUNT; ex++) {