test_example_flash_attention.py 2.27 KB
Newer Older
1
2
3
import tilelang.testing

import example_gqa_bwd
4
import example_gqa_bwd_wgmma_pipelined
5
import example_mha_bwd
6
import example_mha_bwd_bhsd
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import example_mha_fwd_bhsd_wgmma_pipelined
import example_gqa_fwd_bshd
import example_mha_fwd_bshd
import example_gqa_fwd_bshd_wgmma_pipelined
import example_mha_fwd_bshd_wgmma_pipelined
import example_mha_fwd_varlen
import example_mha_bwd_wgmma_pipelined
import example_mha_fwd_bhsd


@tilelang.testing.requires_cuda
def test_example_gqa_bwd():
    example_gqa_bwd.main()


22
23
24
25
26
27
@tilelang.testing.requires_cuda
@tilelang.testing.requires_cuda_compute_version_ge(9, 0)
def test_example_gqa_bwd_wgmma_pipelined():
    example_gqa_bwd_wgmma_pipelined.main()


28
29
@tilelang.testing.requires_cuda
def test_example_mha_bwd():
30
    example_mha_bwd.main(BATCH=1)
31
32


33
34
@tilelang.testing.requires_cuda
def test_example_mha_bwd_bhsd():
35
    example_mha_bwd_bhsd.main(BATCH=1)
36
37


38
39
40
@tilelang.testing.requires_cuda
@tilelang.testing.requires_cuda_compute_version_ge(9, 0)
def test_example_mha_bwd_wgmma_pipelined():
41
    example_mha_bwd_wgmma_pipelined.main(BATCH=1)
42
43
44


@tilelang.testing.requires_cuda
45
@tilelang.testing.requires_cuda_compute_version_ge(9, 0)
46
def test_example_gqa_fwd_bshd_wgmma_pipelined():
47
48
    example_gqa_fwd_bshd_wgmma_pipelined.main(
        batch=1, heads=16, seq_len=1024, dim=128, is_causal=False, groups=16, tune=False)
49
50
51
52


@tilelang.testing.requires_cuda
def test_example_gqa_fwd_bshd():
53
54
    example_gqa_fwd_bshd.main(
        batch=1, heads=16, seq_len=1024, dim=128, is_causal=False, groups=16, tune=False)
55
56
57


@tilelang.testing.requires_cuda
58
@tilelang.testing.requires_cuda_compute_version_ge(9, 0)
59
60
61
62
63
64
65
66
67
68
def test_example_mha_fwd_bhsd_wgmma_pipelined():
    example_mha_fwd_bhsd_wgmma_pipelined.main()


@tilelang.testing.requires_cuda
def test_example_mha_fwd_bhsd():
    example_mha_fwd_bhsd.main()


@tilelang.testing.requires_cuda
69
@tilelang.testing.requires_cuda_compute_version_ge(9, 0)
70
def test_example_mha_fwd_bshd_wgmma_pipelined():
71
    example_mha_fwd_bshd_wgmma_pipelined.main(batch=1, heads=32, seq_len=256)
72
73
74
75


@tilelang.testing.requires_cuda
def test_example_mha_fwd_bshd():
76
    example_mha_fwd_bshd.main(batch=1, seq_len=256)
77
78
79
80
81
82
83
84
85


@tilelang.testing.requires_cuda
def test_example_mha_fwd_varlen():
    example_mha_fwd_varlen.main()


if __name__ == "__main__":
    tilelang.testing.main()