22
22
@test out == " foobar\n "
23
23
24
24
# 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 "
34
34
end
35
35
36
36
@testset " @mtlprint" begin
92
92
test_output (typ (42 ), " 42" )
93
93
end
94
94
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
98
98
99
99
test_output (Cchar (' c' ), " c" )
100
100
108
108
109
109
test_output ((1 ,), " (1,)" )
110
110
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)" )
113
112
114
113
# escaping
115
114
122
121
@test out == " 42\n "
123
122
end
124
123
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
152
133
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
153
137
end
154
138
0 commit comments