MCPcopy Create free account
hub / github.com/tile-ai/tilelang / ref_program

Function ref_program

testing/python/kernel/test_tilelang_kernel_gemm.py:87–101  ·  view source on GitHub ↗
(A, B)

Source from the content-addressed store, hash-verified

85 profiler = kernel.get_profiler()
86
87 def ref_program(A, B):
88 import torch
89
90 if trans_A:
91 A = A.T
92 if trans_B:
93 B = B.T
94 if in_dtype == T.tfloat32:
95 # Convert float32 to tfloat32 because tfloat32 mma cannot truncate
96 # float32 automatically, -0x1000 meas
97 A = (A.view(torch.int32) - 0x1000).view(torch.float32)
98 B = (B.view(torch.int32) - 0x1000).view(torch.float32)
99 C = torch.matmul(A.to(torch.float), B.to(torch.float))
100 C = C.to(torch.__getattribute__(out_dtype))
101 return C
102
103 profiler.assert_allclose(ref_program, atol=1e-2, rtol=1e-2)
104

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…