Skip to content

Commit

Permalink
pylint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bzhang1945 authored Feb 3, 2025
1 parent 5fbefb6 commit c9b9cac
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/test_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def top(A: int32[M, K], B: int32[K, N]) -> int32[M, N]:

allo.verify(s, s1)


def test_range_for():
def kernel(A: int32[20]):
for i in range(10):
Expand All @@ -56,9 +57,10 @@ def kernel(A: int32[20]):

s = allo.customize(kernel)
verifier = allo.verify(s, s)

assert verifier


# test that ap_int types are correctly handled
def test_get_bit():
def kernel(A: int32[10]) -> int32[10]:
Expand All @@ -72,6 +74,7 @@ def kernel(A: int32[10]) -> int32[10]:

assert verifier


def test_fusion():
def separate_gemm(A: float32[32, 32], B: float32[32, 32]) -> float32[32, 32]:
C: float32[32, 32] = 0
Expand Down Expand Up @@ -113,6 +116,7 @@ def column_major(A: float32[32, 32]) -> float32[32, 32]:
verifier = allo.verify(s1, s2)
assert verifier


def test_strength_reduction():
def mul_by_2(A: int32[10]) -> int32[10]:
B: int32[10]
Expand Down Expand Up @@ -148,7 +152,9 @@ def incorrect(C: float32[32, 32], bias: float32[32]) -> float32[32, 32]:
D[i, j] = C[i, j] - bias[j] # incorrect function
return D

def top(A: float32[32, 32], B: float32[32, 32], bias: float32[32]) -> float32[32, 32]:
def top(
A: float32[32, 32], B: float32[32, 32], bias: float32[32]
) -> float32[32, 32]:
C = gemm(A, B)
D = incorrect(C, bias)
return D
Expand All @@ -163,11 +169,13 @@ def top(A: float32[32, 32], B: float32[32, 32], bias: float32[32]) -> float32[32

# negative test: should return false
verifier = allo.verify(s_top, s_gemm)
assert not verifier, "Verifier incorrectly claims equivalence when functions are different"
assert (
not verifier
), "Verifier incorrectly claims equivalence when functions are different"

verifier = allo.verify(s_top, s_add_bias_wrong)
assert not verifier, "Verifier failed to detect incorrect transformation"


if __name__ == "__main__":
pytest.main([__file__])

0 comments on commit c9b9cac

Please sign in to comment.