MCPcopy Create free account
hub / github.com/antirez/ds4 / test_load_mpp_cases

Function test_load_mpp_cases

tests/ds4_test.c:1513–1540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1511
1512static void test_metal_compressor_ape_add_exact(void) {
1513 test_metal_compressor_ape_add_exact_case(128, 4, 3, 16, 1, 7, false);
1514 test_metal_compressor_ape_add_exact_case(512, 4, 0, 16, 1, 13, false);
1515 test_metal_compressor_ape_add_exact_case(512, 4, 1, 14, 0, 19, false);
1516 test_metal_compressor_ape_add_exact_case(512, 128, 127, 257, 1, 31, false);
1517}
1518
1519static void test_metal_compressor_ratio4_pack_exact(void) {
1520 test_metal_compressor_ape_add_exact_case(128, 4, 0, 4, 1, 37, true);
1521 test_metal_compressor_ape_add_exact_case(512, 4, 0, 8, 1, 41, true);
1522 test_metal_compressor_ape_add_exact_case(512, 4, 1, 14, 0, 43, true);
1523}
1524
1525static void test_metal_compressor_ratio4_replay_pack_exact_case(
1526 uint32_t head_dim,
1527 uint32_t n_tokens,
1528 uint32_t seed) {
1529 const uint32_t width = 2u * head_dim;
1530 const uint32_t n_comp = n_tokens / 4u;
1531 const uint64_t input_count = (uint64_t)n_tokens * width;
1532 const uint64_t state_count = (uint64_t)8u * width;
1533 const uint64_t comp_count = (uint64_t)n_comp * head_dim;
1534 const uint64_t input_bytes = input_count * sizeof(float);
1535 const uint64_t state_bytes = state_count * sizeof(float);
1536 const uint64_t comp_bytes = comp_count * sizeof(float);
1537 const uint64_t ape_bytes = (uint64_t)4u * width * sizeof(uint16_t);
1538 const uint64_t page = (uint64_t)getpagesize();
1539 const uint64_t norm_offset = test_round_up_u64(ape_bytes, page);
1540 const uint64_t model_bytes = test_round_up_u64(
1541 norm_offset + (uint64_t)head_dim * sizeof(float), page);
1542
1543 ds4_gpu_tensor *kv = ds4_gpu_tensor_alloc(input_bytes);

Calls 6

test_read_vector_caseFunction · 0.85
test_fill_vector_caseFunction · 0.85
test_read_fileFunction · 0.85
ds4_engine_vocab_sizeFunction · 0.85
ds4_encode_chat_promptFunction · 0.85

Tested by

no test coverage detected