@@ -391,3 +391,33 @@ func.func @memref_index_type() {
391391 // PRODUCER-CONSUMER-MAXIMAL: return
392392 return
393393}
394+
395+ #map = affine_map <(d0 ) -> (d0 )>
396+ #map1 =affine_map <(d0 ) -> (d0 + 1 )>
397+
398+ // Test non-integer memory spaces.
399+
400+ // PRODUCER-CONSUMER-LABEL: func @non_int_memory_space
401+ func.func @non_int_memory_space () {
402+ %alloc = memref.alloc () : memref <256 x8 xf32 , #spirv.storage_class <StorageBuffer >>
403+ affine.for %arg0 = 0 to 64 {
404+ affine.for %arg1 = 0 to 8 {
405+ %0 = affine.apply #map (%arg1 )
406+ %1 = affine.load %alloc [%arg0 , %0 ] : memref <256 x8 xf32 , #spirv.storage_class <StorageBuffer >>
407+ affine.store %1 , %alloc [%arg0 , %arg1 ] : memref <256 x8 xf32 , #spirv.storage_class <StorageBuffer >>
408+ }
409+ }
410+ affine.for %arg0 = 16 to 32 {
411+ affine.for %arg1 = 0 to 8 {
412+ %0 = affine.apply #map (%arg1 )
413+ %1 = affine.load %alloc [%arg0 , %0 ] : memref <256 x8 xf32 , #spirv.storage_class <StorageBuffer >>
414+ affine.store %1 , %alloc [%arg0 , %arg1 ] : memref <256 x8 xf32 , #spirv.storage_class <StorageBuffer >>
415+ }
416+ }
417+ // Fused nest.
418+ // PRODUCER-CONSUMER-NEXT: memref.alloc()
419+ // PRODUCER-CONSUMER-NEXT: memref.alloc()
420+ // PRODUCER-CONSUMER: affine.for %{{.*}} = 16 to 32
421+ // PRODUCER-CONSUMER-NEXT: affine.for %{{.*}} = 0 to 8
422+ return
423+ }
0 commit comments