2222 @test out == " foobar\n "
2323
2424 # c argument promotions
25- # function kernel(A)
26- # @mtlprintf("%f %f\n", A[1], A[1])
27- # return
28- # end
29- # x = MtlArray (ones(2, 2))
30- # _, out = @grab_output begin
31- # Metal.@sync @metal kernel(x)
32- # end
33- # @test out == "1.000000 1.000000\n"
25+ function kernel (A)
26+ @mtlprintf (" %f %f\n " , A[1 ], A[1 ])
27+ return
28+ end
29+ x = mtl (ones (2 , 2 ))
30+ _, out = @grab_output begin
31+ Metal. @sync @metal kernel (x)
32+ end
33+ @test out == " 1.000000 1.000000\n "
3434 end
3535
3636 @testset " @mtlprint" begin
9292 test_output (typ (42 ), " 42" )
9393 end
9494
95- # for typ in (Float32,)
96- # test_output(typ(42), "42.000000")
97- # end
95+ for typ in (Float32,)
96+ test_output (typ (42 ), " 42.000000" )
97+ end
9898
9999 test_output (Cchar (' c' ), " c" )
100100
108108
109109 test_output ((1 ,), " (1,)" )
110110 test_output ((1 ,2 ), " (1, 2)" )
111- # test_output((1,2,3.), "(1, 2, 3.000000)")
112-
111+ test_output ((1 ,2 ,3.0f0 ), " (1, 2, 3.000000)" )
113112
114113 # escaping
115114
122121 @test out == " 42\n "
123122 end
124123
125- # @testset "@mtlshow" begin
126- # function kernel()
127- # seven_i32 = Int32(7)
128- # three_f32 = Float32(3)
129- # @mtlshow seven_i32
130- # @mtlshow three_f32
131- # @mtlshow 1f0 + 4f0
132- # return
133- # end
134-
135- # _, out = @grab_output @on_device kernel()
136- # @test out == "seven_i32 = 7\nthree_f64 = 3.000000\n1.0f0 + 4.0f0 = 5.000000\n"
137- # end
138-
139- # @testset "@mtlshow array pointers" begin
140- # function kernel()
141- # a = mtlStaticSharedArray(Float32, 1)
142- # b = mtlStaticSharedArray(Float32, 2)
143- # @mtlshow pointer(a) pointer(b)
144- # return
145- # end
146-
147- # _, out = @grab_output @on_device kernel()
148- # @test ocmtlrsin("pointer(a) = ", out)
149- # @test ocmtlrsin("pointer(b) = ", out)
150- # @test ocmtlrsin("= 0", out)
151- # end
124+ @testset " @mtlshow" begin
125+ function kernel ()
126+ seven_i32 = Int32 (7 )
127+ three_f32 = Float32 (3 )
128+ @mtlshow seven_i32
129+ @mtlshow three_f32
130+ @mtlshow 1f0 + 4f0
131+ return
132+ end
152133
134+ _, out = @grab_output @on_device kernel ()
135+ @test out == " seven_i32 = 7\n three_f32 = 3.000000\n 1.0f0 + 4.0f0 = 5.000000\n "
136+ end
153137end
154138
0 commit comments