Skip to content
Merged
Changes from all 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
25 changes: 22 additions & 3 deletions tests/gdn/test_prefill_delta_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,16 @@ def _test_prefill_kernel(
@pytest.mark.parametrize("head_size", [128])
@pytest.mark.parametrize(
"num_q_heads, num_k_heads, num_v_heads",
[(1, 1, 1), (4, 1, 1), (3, 3, 3), (6, 2, 2), (1, 1, 2), (2, 2, 4)],
[
(1, 1, 1),
(4, 1, 1),
(3, 3, 3),
(6, 2, 2),
(1, 1, 2),
(2, 2, 4),
(16, 16, 32),
(16, 16, 64),
],
)
@pytest.mark.parametrize("seq_lens", [[64], [128], [256], [256, 256], [64, 128, 512]])
@pytest.mark.parametrize("block_size", [64])
Expand Down Expand Up @@ -186,7 +195,16 @@ def test_prefill_kernel_basic(
@pytest.mark.parametrize("head_size", [128])
@pytest.mark.parametrize(
"num_q_heads, num_k_heads, num_v_heads",
[(1, 1, 1), (4, 1, 1), (3, 3, 3), (6, 2, 2), (1, 1, 2), (2, 2, 4)],
[
(1, 1, 1),
(4, 1, 1),
(3, 3, 3),
(6, 2, 2),
(1, 1, 2),
(2, 2, 4),
(16, 16, 32),
(16, 16, 64),
],
)
Comment on lines 196 to 208
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This list of head configurations is identical to the one used for test_prefill_kernel_basic (lines 137-149). To improve maintainability and reduce duplication, consider defining this list as a module-level constant and reusing it in both test functions. For example:

# At module level
_PREFILL_HEAD_CONFIGS = [
    (1, 1, 1),
    (4, 1, 1),
    (3, 3, 3),
    (6, 2, 2),
    (1, 1, 2),
    (2, 2, 4),
    (16, 16, 32),
    (16, 16, 64),
]

# In test decorators
@pytest.mark.parametrize(
    "num_q_heads, num_k_heads, num_v_heads", _PREFILL_HEAD_CONFIGS
)

@pytest.mark.parametrize(
"seq_lens",
Expand Down Expand Up @@ -390,7 +408,8 @@ def concat_varlen(t1, cu_seq_lens1, t2, cu_seq_lens2):
@pytest.mark.parametrize("scale", [1.0, "auto"])
@pytest.mark.parametrize("head_size", [128])
@pytest.mark.parametrize(
"num_q_heads, num_k_heads, num_v_heads", [(6, 2, 2), (2, 2, 4)]
"num_q_heads, num_k_heads, num_v_heads",
[(6, 2, 2), (2, 2, 4), (16, 16, 32), (16, 16, 64)],
)
@pytest.mark.parametrize(
"seq_lens1, seq_lens2",
Expand Down
Loading