[FRONTEND] Use inline asm for global timer and smid functions (#2143)

Simplify the code by using inline asm to implement globaltimer and smid
instead of relying on bc file.
This commit is contained in:
Thomas
2023-08-20 22:56:37 -07:00
committed by GitHub
parent ad3e363a44
commit 54ca7fcb35
6 changed files with 14 additions and 35 deletions

View File

@@ -3403,8 +3403,7 @@ def test_globaltimer(device):
out2 = to_triton(np.zeros((1,), dtype=np.int64), device=device)
h = kernel[(1,)](out1, out2)
assert out2[0] > 0
# 2 inlined globaltimers + one extra in the wrapper extern function
assert h.asm["ptx"].count("%globaltimer") == 3
assert h.asm["ptx"].count("%globaltimer") == 2
def test_smid(device):
@@ -3417,7 +3416,7 @@ def test_smid(device):
out = to_triton(np.zeros((1024,), dtype=np.int32), device=device)
h = kernel[(out.shape[0],)](out)
assert out.sort()[0].unique().shape[0] > 0
assert h.asm["ptx"].count("%smid") == 2
assert h.asm["ptx"].count("%smid") == 1
# -----------------------
# test layout conversions