38
38
map = (d0 , d1 , d2 ) -> (d0 : compressed , d1 : dense , d2 : compressed)
39
39
}>
40
40
41
- #DDC = #sparse_tensor.encoding <{
41
+ #DCC = #sparse_tensor.encoding <{
42
42
map = (d0 , d1 , d2 ) -> (d0 : dense , d1 : compressed , d2 : compressed)
43
43
}>
44
44
45
+ #DDC = #sparse_tensor.encoding <{
46
+ map = (d0 , d1 , d2 ) -> (d0 : dense , d1 : dense , d2 : compressed)
47
+ }>
48
+
45
49
// Creates and returns 3-D buffer of size (%s1, %s2, %s3) filled with the value %f
46
50
func.func @alloc_3d_filled_f32 (%s1 : index , %s2 : index , %s3 : index , %f : f32 ) -> tensor <?x?x?xf32 > {
47
51
%buf = tensor.empty (%s1 , %s2 , %s3 ) : tensor <?x?x?xf32 >
@@ -74,6 +78,15 @@ func.func @conv_3d_CDC(%arg0: tensor<?x?x?xf32, #CDC>, %arg1: tensor<?x?x?xf32>)
74
78
return %ret : tensor <?x?x?xf32 , #CDC >
75
79
}
76
80
81
+ func.func @conv_3d_DCC (%arg0: tensor <?x?x?xf32 , #DCC >, %arg1: tensor <?x?x?xf32 >) -> tensor <?x?x?xf32 , #DCC > {
82
+ %c6 = arith.constant 6 : index
83
+ %s = tensor.empty (%c6 , %c6 , %c6 ) : tensor <?x?x?xf32 , #DCC >
84
+ %ret = linalg.conv_3d
85
+ ins (%arg0 , %arg1: tensor <?x?x?xf32 , #DCC >, tensor <?x?x?xf32 >)
86
+ outs (%s: tensor <?x?x?xf32 , #DCC >) -> tensor <?x?x?xf32 , #DCC >
87
+ return %ret : tensor <?x?x?xf32 , #DCC >
88
+ }
89
+
77
90
func.func @conv_3d_DDC (%arg0: tensor <?x?x?xf32 , #DDC >, %arg1: tensor <?x?x?xf32 >) -> tensor <?x?x?xf32 , #DDC > {
78
91
%c6 = arith.constant 6 : index
79
92
%s = tensor.empty (%c6 , %c6 , %c6 ) : tensor <?x?x?xf32 , #DDC >
@@ -102,12 +115,15 @@ func.func @entry() {
102
115
: tensor <?x?x?xf32 > to tensor <?x?x?xf32 , #CCC >
103
116
%in3D_CDC = sparse_tensor.convert %in3D
104
117
: tensor <?x?x?xf32 > to tensor <?x?x?xf32 , #CDC >
118
+ %in3D_DCC = sparse_tensor.convert %in3D
119
+ : tensor <?x?x?xf32 > to tensor <?x?x?xf32 , #DCC >
105
120
%in3D_DDC = sparse_tensor.convert %in3D
106
121
: tensor <?x?x?xf32 > to tensor <?x?x?xf32 , #DDC >
107
122
108
123
%dense_ret = call @conv_3d (%in3D , %filter3D , %out3D ) : (tensor <?x?x?xf32 >, tensor <?x?x?xf32 >, tensor <?x?x?xf32 >) -> (tensor <?x?x?xf32 >)
109
124
%CCC_ret = call @conv_3d_CCC (%in3D_CCC , %filter3D ) : (tensor <?x?x?xf32 , #CCC >, tensor <?x?x?xf32 >) -> (tensor <?x?x?xf32 , #CCC >)
110
125
%CDC_ret = call @conv_3d_CDC (%in3D_CDC , %filter3D ) : (tensor <?x?x?xf32 , #CDC >, tensor <?x?x?xf32 >) -> (tensor <?x?x?xf32 , #CDC >)
126
+ %DCC_ret = call @conv_3d_DCC (%in3D_DCC , %filter3D ) : (tensor <?x?x?xf32 , #DCC >, tensor <?x?x?xf32 >) -> (tensor <?x?x?xf32 , #DCC >)
111
127
%DDC_ret = call @conv_3d_DDC (%in3D_DDC , %filter3D ) : (tensor <?x?x?xf32 , #DDC >, tensor <?x?x?xf32 >) -> (tensor <?x?x?xf32 , #DDC >)
112
128
113
129
// CHECK:( ( ( 108, 108, 108, 108, 108, 108 ),
@@ -276,6 +292,48 @@ func.func @entry() {
276
292
: tensor <?x?x?xf32 >, vector <6 x6 x6 xf32 >
277
293
vector.print %v2 : vector <6 x6 x6 xf32 >
278
294
295
+ // CHECK-NEXT:( ( ( 108, 108, 108, 108, 108, 108 ),
296
+ // CHECK-SAME: ( 124, 108, 108, 108, 108, 108 ),
297
+ // CHECK-SAME: ( 124, 108, 108, 108, 108, 108 ),
298
+ // CHECK-SAME: ( 124, 108, 108, 108, 108, 108 ),
299
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
300
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ) ),
301
+ // CHECK-SAME: ( ( 108, 108, 108, 108, 108, 108 ),
302
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
303
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
304
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
305
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
306
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ) ),
307
+ // CHECK-SAME: ( ( 108, 108, 108, 108, 108, 108 ),
308
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
309
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
310
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
311
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
312
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ) ),
313
+ // CHECK-SAME: ( ( 108, 108, 108, 108, 108, 108 ),
314
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
315
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
316
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
317
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
318
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ) ),
319
+ // CHECK-SAME: ( ( 108, 108, 108, 108, 108, 108 ),
320
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
321
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
322
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
323
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
324
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ) ),
325
+ // CHECK-SAME: ( ( 108, 108, 108, 108, 108, 108 ),
326
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
327
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
328
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
329
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ),
330
+ // CHECK-SAME: ( 108, 108, 108, 108, 108, 108 ) ) )
331
+ %4 = sparse_tensor.convert %DCC_ret
332
+ : tensor <?x?x?xf32 , #DCC > to tensor <?x?x?xf32 >
333
+ %v4 = vector.transfer_read %3 [%c0 , %c0 , %c0 ], %zero
334
+ : tensor <?x?x?xf32 >, vector <6 x6 x6 xf32 >
335
+ vector.print %v2 : vector <6 x6 x6 xf32 >
336
+
279
337
// Free the resources
280
338
bufferization.dealloc_tensor %in3D : tensor <?x?x?xf32 >
281
339
bufferization.dealloc_tensor %filter3D : tensor <?x?x?xf32 >
@@ -284,9 +342,11 @@ func.func @entry() {
284
342
bufferization.dealloc_tensor %in3D_CDC : tensor <?x?x?xf32 , #CDC >
285
343
bufferization.dealloc_tensor %in3D_CCC : tensor <?x?x?xf32 , #CCC >
286
344
bufferization.dealloc_tensor %in3D_DDC : tensor <?x?x?xf32 , #DDC >
345
+ bufferization.dealloc_tensor %in3D_DCC : tensor <?x?x?xf32 , #DCC >
287
346
288
347
bufferization.dealloc_tensor %CCC_ret : tensor <?x?x?xf32 , #CCC >
289
348
bufferization.dealloc_tensor %CDC_ret : tensor <?x?x?xf32 , #CDC >
290
349
bufferization.dealloc_tensor %DDC_ret : tensor <?x?x?xf32 , #DDC >
350
+ bufferization.dealloc_tensor %DCC_ret : tensor <?x?x?xf32 , #DCC >
291
351
return
292
352
}
0 commit comments