@@ -65,12 +65,39 @@ module {
6565
6666// -----
6767
68+ #map0 = affine_map <(m , n , k ) -> (m , k )>
69+ #map1 = affine_map <(m , n , k ) -> (k , n )>
70+ #map2 = affine_map <(m , n , k ) -> (m , n )>
71+ #executable_target_vmvx_bytecode_fb = #hal.executable.target <" vmvx" , " vmvx-bytecode-fb" , {encoding = #iree_encoding.unspecialized_encoding <123 >}>
72+ #device_target_local_0_ = #hal.device.target <" local" , {ordinal = 0 : index }, [#executable_target_vmvx_bytecode_fb ]> : !hal.device
73+ #encoding = #iree_encoding.encoding <operand_index = 0 : index , op_type = matmul , element_types = [f32 , f32 , f32 ], user_indexing_maps = [#map0 , #map1 , #map2 ]>
74+ module {
75+ util.global private @device_a = #device_target_local_0_
76+
77+ util.func public @tensor_fill_op (%arg0: f32 , %arg1: !stream.resource <*>, %arg2: index , %arg3: index ) {
78+ %c0 = arith.constant 0 : index
79+ %c1 = arith.constant 1 : index
80+ %0 = stream.tensor.fill on (#hal.device.affinity <@device_a >)
81+ %arg0 , %arg1 [%c0 , %c0 for %c1 , %c1 ] : f32
82+ -> tensor <?x4 xf32 , #encoding >{%arg2 } in %arg1 as !stream.resource <*>{%arg3 }
83+ util.return
84+ }
85+ }
86+ // CHECK-DAG: #[[$ENCODING:.+]] = #iree_encoding.encoding<{{.+}} layouts = [#iree_encoding.specialized_encoding<123, tensor<?x4xf32>>]
87+ // CHECK: #[[TARGET:.+]] = #hal.device.target
88+ // CHECK: util.global private @[[$DEVICE:.+]] = #[[TARGET]]
89+ // CHECK-LABEL: util.func public @tensor_fill_op
90+ // CHECK: stream.tensor.fill on(#hal.device.affinity<@[[$DEVICE]]>)
91+ // CHECK-SAME: f32 -> tensor<?x4xf32, #[[$ENCODING]]>
92+
93+ // -----
94+
6895// Checks that the stream.tensor.constant op with encoding is not supported.
6996
7097#map0 = affine_map <(m , n , k ) -> (m , k )>
7198#map1 = affine_map <(m , n , k ) -> (k , n )>
7299#map2 = affine_map <(m , n , k ) -> (m , n )>
73- #executable_target_vmvx_bytecode_fb = #hal.executable.target <" vmvx" , " vmvx-bytecode-fb" , {encoding = #iree_cpu.vmvx_encoding_layout < >}>
100+ #executable_target_vmvx_bytecode_fb = #hal.executable.target <" vmvx" , " vmvx-bytecode-fb" , {encoding = #iree_encoding.unspecialized_encoding < 123 >}>
74101#device_target_local_0_ = #hal.device.target <" local" , {ordinal = 0 : index }, [#executable_target_vmvx_bytecode_fb ]> : !hal.device
75102#encoding = #iree_encoding.encoding <operand_index = 0 : index , op_type = matmul , element_types = [f32 , f32 , f32 ], user_indexing_maps = [#map0 , #map1 , #map2 ]>
76103module {
@@ -85,6 +112,76 @@ module {
85112
86113// -----
87114
115+ // Checks that the stream.tensor.clone op with encoding is not supported.
116+
117+ #map0 = affine_map <(m , n , k ) -> (m , k )>
118+ #map1 = affine_map <(m , n , k ) -> (k , n )>
119+ #map2 = affine_map <(m , n , k ) -> (m , n )>
120+ #executable_target_vmvx_bytecode_fb = #hal.executable.target <" vmvx" , " vmvx-bytecode-fb" , {encoding = #iree_encoding.unspecialized_encoding <123 >}>
121+ #device_target_local_0_ = #hal.device.target <" local" , {ordinal = 0 : index }, [#executable_target_vmvx_bytecode_fb ]> : !hal.device
122+ #encoding = #iree_encoding.encoding <operand_index = 0 : index , op_type = matmul , element_types = [f32 , f32 , f32 ], user_indexing_maps = [#map0 , #map1 , #map2 ]>
123+ module {
124+ util.global private @device_a = #device_target_local_0_
125+
126+ // expected-error @+1 {{failed on adding layouts to Stream::TensorPhaseOp with encodings}}
127+ util.func public @tensor_clone_op (%arg0: !stream.resource <*>, %arg1: index , %arg2: index , %arg3: index , %arg4: index ) {
128+ %0 = stream.tensor.clone on (#hal.device.affinity <@device_a >)
129+ %arg0 : tensor <?x4 xf32 , #encoding >{%arg1 } in !stream.resource <*>{%arg2 }
130+ -> tensor <?x4 xf32 , #encoding >{%arg1 } in !stream.resource <*>{%arg2 }
131+ util.return
132+ }
133+ }
134+
135+ // -----
136+
137+ // Checks that the stream.tensor.slice op with encoding is not supported.
138+
139+ #map0 = affine_map <(m , n , k ) -> (m , k )>
140+ #map1 = affine_map <(m , n , k ) -> (k , n )>
141+ #map2 = affine_map <(m , n , k ) -> (m , n )>
142+ #executable_target_vmvx_bytecode_fb = #hal.executable.target <" vmvx" , " vmvx-bytecode-fb" , {encoding = #iree_encoding.unspecialized_encoding <123 >}>
143+ #device_target_local_0_ = #hal.device.target <" local" , {ordinal = 0 : index }, [#executable_target_vmvx_bytecode_fb ]> : !hal.device
144+ #encoding = #iree_encoding.encoding <operand_index = 0 : index , op_type = matmul , element_types = [f32 , f32 , f32 ], user_indexing_maps = [#map0 , #map1 , #map2 ]>
145+ module {
146+ util.global private @device_a = #device_target_local_0_
147+
148+ // expected-error @+1 {{failed on adding layouts to Stream::TensorPhaseOp with encodings}}
149+ util.func public @tensor_slice_op_with_encoding (%arg0: !stream.resource <*>, %arg1: index , %arg2: index , %arg3: index , %arg4: index ) {
150+ %c0 = arith.constant 0 : index
151+ %c1 = arith.constant 1 : index
152+ %1 = stream.tensor.slice on (#hal.device.affinity <@device_a >)
153+ %arg0 [%c0 , %c1 for %arg3 , %c1 ] : tensor <?x4 xf32 , #encoding >{%arg1 } in !stream.resource <*>{%arg2 }
154+ -> tensor <?x1 xf32 , #encoding >{%arg3 } in !stream.resource <*>{%arg4 }
155+ util.return
156+ }
157+ }
158+
159+ // -----
160+
161+ // Checks that the stream.tensor.update op with encoding is not supported.
162+
163+ #map0 = affine_map <(m , n , k ) -> (m , k )>
164+ #map1 = affine_map <(m , n , k ) -> (k , n )>
165+ #map2 = affine_map <(m , n , k ) -> (m , n )>
166+ #executable_target_vmvx_bytecode_fb = #hal.executable.target <" vmvx" , " vmvx-bytecode-fb" , {encoding = #iree_encoding.unspecialized_encoding <123 >}>
167+ #device_target_local_0_ = #hal.device.target <" local" , {ordinal = 0 : index }, [#executable_target_vmvx_bytecode_fb ]> : !hal.device
168+ #encoding = #iree_encoding.encoding <operand_index = 0 : index , op_type = matmul , element_types = [f32 , f32 , f32 ], user_indexing_maps = [#map0 , #map1 , #map2 ]>
169+ module {
170+ util.global private @device_a = #device_target_local_0_
171+
172+ // expected-error @+1 {{failed on adding layouts to Stream::TensorPhaseOp with encodings}}
173+ util.func public @tensor_update_op (%arg0: !stream.resource <*>, %arg1: index , %arg2: !stream.resource <*>, %arg3: index , %arg4: index ) {
174+ %c0 = arith.constant 0 : index
175+ %c1 = arith.constant 1 : index
176+ %0 = stream.tensor.update on (#hal.device.affinity <@device_a >)
177+ %arg0 , %arg2 [%c0 , %c0 ] : tensor <2 x2 xf32 , #encoding > in !stream.resource <*>{%arg1 }
178+ -> tensor <?x4 xf32 , #encoding >{%arg3 } in %arg2 as !stream.resource <*>{%arg4 }
179+ util.return
180+ }
181+ }
182+
183+ // -----
184+
88185#executable_target_vmvx_bytecode_fb = #hal.executable.target <" vmvx" , " vmvx-bytecode-fb" , {encoding = #iree_encoding.unspecialized_encoding <123 >}>
89186#map = affine_map <(d0 ) -> (d0 )>
90187#map0 = affine_map <(m , n , k ) -> (m , k )>
0 commit comments