11# RUN: %PYTHON %s | FileCheck %s
22# This is just a smoke test that the dialect is functional.
3+ from array import array
34
45from mlir .ir import *
5- from mlir .dialects import rocdl
6+ from mlir .dialects import rocdl , arith
7+ from mlir .extras import types as T
68
79
810def constructAndPrintInModule (f ):
@@ -18,5 +20,22 @@ def constructAndPrintInModule(f):
1820# CHECK-LABEL: testSmoke
1921@constructAndPrintInModule
2022def testSmoke ():
21- # CHECK: rocdl.barrier
22- rocdl .BarrierOp ()
23+ v_len = 16
24+ f32 = F32Type .get ()
25+ # Note: this isn't actually the right type for the intrinsic (should be f16)
26+ # but array doesn't support f16.
27+ v16f32 = T .vector (v_len , f32 )
28+ f32_array = array ("f" , [0.0 ] * v_len )
29+ a_frag = arith .constant (v16f32 , f32_array )
30+ b_frag = arith .constant (v16f32 , f32_array )
31+ c_frag = arith .constant (v16f32 , f32_array )
32+ false = arith .constant (T .bool (), False )
33+
34+ c_frag = rocdl .wmma_f16_16x16x16_f16 (v16f32 , [a_frag , b_frag , c_frag , false ])
35+ # CHECK: %{{.*}} = rocdl.wmma.f16.16x16x16.f16
36+ print (c_frag )
37+ assert isinstance (c_frag , OpView )
38+ # CHECK: Value(%{{.*}} = rocdl.wmma.f16.16x16x16.f16
39+ c_frag = rocdl .wmma_f16_16x16x16_f16_ (v16f32 , [a_frag , b_frag , c_frag , false ])
40+ print (c_frag )
41+ assert isinstance (c_frag , Value )
0 commit comments