@@ -1739,3 +1739,137 @@ func.func @test_dynamic_rfft2d(%arg0: tensor<?x?x?xf32>) -> (tensor<?x?x?xf32>,
17391739 %output_real , %output_imag = " tosa.rfft2d" (%arg0 ) {} : (tensor <?x?x?xf32 >) -> (tensor <?x?x?xf32 >, tensor <?x?x?xf32 >)
17401740 return %output_real , %output_imag : tensor <?x?x?xf32 >, tensor <?x?x?xf32 >
17411741}
1742+
1743+ // -----
1744+ // NOTE: Assertions have been autogenerated by utils/generate-test-checks.py
1745+
1746+ // CHECK: #[[$ATTR_0:.+]] = affine_map<(d0, d1, d2, d3, d4) -> (d0, d3, d4)>
1747+ // CHECK: #[[$ATTR_1:.+]] = affine_map<(d0, d1, d2, d3, d4) -> (d0, d1, d2)>
1748+
1749+ // CHECK-LABEL: func.func @test_static_fft2d(
1750+ // CHECK-SAME: %[[VAL_0:.*]]: tensor<8x8x8xf32>,
1751+ // CHECK-SAME: %[[VAL_1:.*]]: tensor<8x8x8xf32>) -> (tensor<8x8x8xf32>, tensor<8x8x8xf32>) {
1752+ // CHECK: %[[VAL_2:.*]] = tensor.empty() : tensor<8x8x8xf32>
1753+ // CHECK: %[[VAL_3:.*]] = arith.constant 0.000000e+00 : f32
1754+ // CHECK: %[[VAL_4:.*]] = linalg.fill ins(%[[VAL_3]] : f32) outs(%[[VAL_2]] : tensor<8x8x8xf32>) -> tensor<8x8x8xf32>
1755+ // CHECK: %[[VAL_5:.*]] = tensor.empty() : tensor<8x8x8xf32>
1756+ // CHECK: %[[VAL_6:.*]] = arith.constant 0.000000e+00 : f32
1757+ // CHECK: %[[VAL_7:.*]] = linalg.fill ins(%[[VAL_6]] : f32) outs(%[[VAL_5]] : tensor<8x8x8xf32>) -> tensor<8x8x8xf32>
1758+ // CHECK: %[[VAL_8:.*]] = arith.constant 1 : index
1759+ // CHECK: %[[VAL_9:.*]] = arith.constant 8 : index
1760+ // CHECK: %[[VAL_10:.*]] = arith.constant 2 : index
1761+ // CHECK: %[[VAL_11:.*]] = arith.constant 8 : index
1762+ // CHECK: %[[VAL_12:.*]] = arith.constant 6.28318548 : f32
1763+ // CHECK: %[[VAL_13:.*]] = arith.index_castui %[[VAL_9]] : index to i32
1764+ // CHECK: %[[VAL_14:.*]] = arith.uitofp %[[VAL_13]] : i32 to f32
1765+ // CHECK: %[[VAL_15:.*]] = arith.index_castui %[[VAL_11]] : index to i32
1766+ // CHECK: %[[VAL_16:.*]] = arith.uitofp %[[VAL_15]] : i32 to f32
1767+ // CHECK: %[[VAL_17:.*]]:2 = linalg.generic {indexing_maps = [#[[$ATTR_0]], #[[$ATTR_0]], #[[$ATTR_1]], #[[$ATTR_1]]], iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"]} ins(%[[VAL_0]], %[[VAL_1]] : tensor<8x8x8xf32>, tensor<8x8x8xf32>) outs(%[[VAL_4]], %[[VAL_7]] : tensor<8x8x8xf32>, tensor<8x8x8xf32>) {
1768+ // CHECK: ^bb0(%[[VAL_18:.*]]: f32, %[[VAL_19:.*]]: f32, %[[VAL_20:.*]]: f32, %[[VAL_21:.*]]: f32):
1769+ // CHECK: %[[VAL_22:.*]] = linalg.index 1 : index
1770+ // CHECK: %[[VAL_23:.*]] = arith.index_castui %[[VAL_22]] : index to i32
1771+ // CHECK: %[[VAL_24:.*]] = arith.uitofp %[[VAL_23]] : i32 to f32
1772+ // CHECK: %[[VAL_25:.*]] = linalg.index 2 : index
1773+ // CHECK: %[[VAL_26:.*]] = arith.index_castui %[[VAL_25]] : index to i32
1774+ // CHECK: %[[VAL_27:.*]] = arith.uitofp %[[VAL_26]] : i32 to f32
1775+ // CHECK: %[[VAL_28:.*]] = linalg.index 3 : index
1776+ // CHECK: %[[VAL_29:.*]] = arith.index_castui %[[VAL_28]] : index to i32
1777+ // CHECK: %[[VAL_30:.*]] = arith.uitofp %[[VAL_29]] : i32 to f32
1778+ // CHECK: %[[VAL_31:.*]] = linalg.index 4 : index
1779+ // CHECK: %[[VAL_32:.*]] = arith.index_castui %[[VAL_31]] : index to i32
1780+ // CHECK: %[[VAL_33:.*]] = arith.uitofp %[[VAL_32]] : i32 to f32
1781+ // CHECK: %[[VAL_34:.*]] = arith.mulf %[[VAL_30]], %[[VAL_24]] : f32
1782+ // CHECK: %[[VAL_35:.*]] = arith.mulf %[[VAL_33]], %[[VAL_27]] : f32
1783+ // CHECK: %[[VAL_36:.*]] = arith.divf %[[VAL_34]], %[[VAL_14]] : f32
1784+ // CHECK: %[[VAL_37:.*]] = arith.divf %[[VAL_35]], %[[VAL_16]] : f32
1785+ // CHECK: %[[VAL_38:.*]] = arith.addf %[[VAL_36]], %[[VAL_37]] : f32
1786+ // CHECK: %[[VAL_39:.*]] = arith.mulf %[[VAL_12]], %[[VAL_38]] : f32
1787+ // CHECK: %[[VAL_40:.*]] = math.cos %[[VAL_39]] : f32
1788+ // CHECK: %[[VAL_41:.*]] = math.sin %[[VAL_39]] : f32
1789+ // CHECK: %[[VAL_42:.*]] = arith.mulf %[[VAL_18]], %[[VAL_40]] : f32
1790+ // CHECK: %[[VAL_43:.*]] = arith.mulf %[[VAL_19]], %[[VAL_41]] : f32
1791+ // CHECK: %[[VAL_44:.*]] = arith.addf %[[VAL_42]], %[[VAL_43]] : f32
1792+ // CHECK: %[[VAL_45:.*]] = arith.mulf %[[VAL_19]], %[[VAL_40]] : f32
1793+ // CHECK: %[[VAL_46:.*]] = arith.mulf %[[VAL_18]], %[[VAL_41]] : f32
1794+ // CHECK: %[[VAL_47:.*]] = arith.subf %[[VAL_45]], %[[VAL_46]] : f32
1795+ // CHECK: %[[VAL_48:.*]] = arith.addf %[[VAL_20]], %[[VAL_44]] : f32
1796+ // CHECK: %[[VAL_49:.*]] = arith.addf %[[VAL_21]], %[[VAL_47]] : f32
1797+ // CHECK: linalg.yield %[[VAL_48]], %[[VAL_49]] : f32, f32
1798+ // CHECK: } -> (tensor<8x8x8xf32>, tensor<8x8x8xf32>)
1799+ // CHECK: return %[[VAL_50:.*]]#0, %[[VAL_50]]#1 : tensor<8x8x8xf32>, tensor<8x8x8xf32>
1800+ // CHECK: }
1801+ func.func @test_static_fft2d (%arg0: tensor <8 x8 x8 xf32 >, %arg1: tensor <8 x8 x8 xf32 >) -> (tensor <8 x8 x8 xf32 >, tensor <8 x8 x8 xf32 >) {
1802+ %output_real , %output_imag = " tosa.fft2d" (%arg0 , %arg1 ) {inverse =false } : (tensor <8 x8 x8 xf32 >, tensor <8 x8 x8 xf32 >) -> (tensor <8 x8 x8 xf32 >, tensor <8 x8 x8 xf32 >)
1803+ return %output_real , %output_imag : tensor <8 x8 x8 xf32 >, tensor <8 x8 x8 xf32 >
1804+ }
1805+
1806+ // -----
1807+ // NOTE: Assertions have been autogenerated by utils/generate-test-checks.py
1808+
1809+ // CHECK: #[[$ATTR_2:.+]] = affine_map<(d0, d1, d2, d3, d4) -> (d0, d3, d4)>
1810+ // CHECK: #[[$ATTR_3:.+]] = affine_map<(d0, d1, d2, d3, d4) -> (d0, d1, d2)>
1811+
1812+ // CHECK-LABEL: func.func @test_dynamic_fft2d(
1813+ // CHECK-SAME: %[[VAL_0:.*]]: tensor<?x?x?xf32>,
1814+ // CHECK-SAME: %[[VAL_1:.*]]: tensor<?x?x?xf32>) -> (tensor<?x?x?xf32>, tensor<?x?x?xf32>) {
1815+ // CHECK: %[[VAL_2:.*]] = arith.constant 0 : index
1816+ // CHECK: %[[VAL_3:.*]] = tensor.dim %[[VAL_0]], %[[VAL_2]] : tensor<?x?x?xf32>
1817+ // CHECK: %[[VAL_4:.*]] = arith.constant 1 : index
1818+ // CHECK: %[[VAL_5:.*]] = tensor.dim %[[VAL_0]], %[[VAL_4]] : tensor<?x?x?xf32>
1819+ // CHECK: %[[VAL_6:.*]] = arith.constant 2 : index
1820+ // CHECK: %[[VAL_7:.*]] = tensor.dim %[[VAL_0]], %[[VAL_6]] : tensor<?x?x?xf32>
1821+ // CHECK: %[[VAL_8:.*]] = tensor.empty(%[[VAL_3]], %[[VAL_5]], %[[VAL_7]]) : tensor<?x?x?xf32>
1822+ // CHECK: %[[VAL_9:.*]] = arith.constant 0.000000e+00 : f32
1823+ // CHECK: %[[VAL_10:.*]] = linalg.fill ins(%[[VAL_9]] : f32) outs(%[[VAL_8]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
1824+ // CHECK: %[[VAL_11:.*]] = tensor.empty(%[[VAL_3]], %[[VAL_5]], %[[VAL_7]]) : tensor<?x?x?xf32>
1825+ // CHECK: %[[VAL_12:.*]] = arith.constant 0.000000e+00 : f32
1826+ // CHECK: %[[VAL_13:.*]] = linalg.fill ins(%[[VAL_12]] : f32) outs(%[[VAL_11]] : tensor<?x?x?xf32>) -> tensor<?x?x?xf32>
1827+ // CHECK: %[[VAL_14:.*]] = arith.constant 1 : index
1828+ // CHECK: %[[VAL_15:.*]] = tensor.dim %[[VAL_0]], %[[VAL_14]] : tensor<?x?x?xf32>
1829+ // CHECK: %[[VAL_16:.*]] = arith.constant 2 : index
1830+ // CHECK: %[[VAL_17:.*]] = tensor.dim %[[VAL_0]], %[[VAL_16]] : tensor<?x?x?xf32>
1831+ // CHECK: %[[VAL_18:.*]] = arith.constant 6.28318548 : f32
1832+ // CHECK: %[[VAL_19:.*]] = arith.index_castui %[[VAL_15]] : index to i32
1833+ // CHECK: %[[VAL_20:.*]] = arith.uitofp %[[VAL_19]] : i32 to f32
1834+ // CHECK: %[[VAL_21:.*]] = arith.index_castui %[[VAL_17]] : index to i32
1835+ // CHECK: %[[VAL_22:.*]] = arith.uitofp %[[VAL_21]] : i32 to f32
1836+ // CHECK: %[[VAL_23:.*]]:2 = linalg.generic {indexing_maps = [#[[$ATTR_2]], #[[$ATTR_2]], #[[$ATTR_3]], #[[$ATTR_3]]], iterator_types = ["parallel", "parallel", "parallel", "reduction", "reduction"]} ins(%[[VAL_0]], %[[VAL_1]] : tensor<?x?x?xf32>, tensor<?x?x?xf32>) outs(%[[VAL_10]], %[[VAL_13]] : tensor<?x?x?xf32>, tensor<?x?x?xf32>) {
1837+ // CHECK: ^bb0(%[[VAL_24:.*]]: f32, %[[VAL_25:.*]]: f32, %[[VAL_26:.*]]: f32, %[[VAL_27:.*]]: f32):
1838+ // CHECK: %[[VAL_28:.*]] = linalg.index 1 : index
1839+ // CHECK: %[[VAL_29:.*]] = arith.index_castui %[[VAL_28]] : index to i32
1840+ // CHECK: %[[VAL_30:.*]] = arith.uitofp %[[VAL_29]] : i32 to f32
1841+ // CHECK: %[[VAL_31:.*]] = linalg.index 2 : index
1842+ // CHECK: %[[VAL_32:.*]] = arith.index_castui %[[VAL_31]] : index to i32
1843+ // CHECK: %[[VAL_33:.*]] = arith.uitofp %[[VAL_32]] : i32 to f32
1844+ // CHECK: %[[VAL_34:.*]] = linalg.index 3 : index
1845+ // CHECK: %[[VAL_35:.*]] = arith.index_castui %[[VAL_34]] : index to i32
1846+ // CHECK: %[[VAL_36:.*]] = arith.uitofp %[[VAL_35]] : i32 to f32
1847+ // CHECK: %[[VAL_37:.*]] = linalg.index 4 : index
1848+ // CHECK: %[[VAL_38:.*]] = arith.index_castui %[[VAL_37]] : index to i32
1849+ // CHECK: %[[VAL_39:.*]] = arith.uitofp %[[VAL_38]] : i32 to f32
1850+ // CHECK: %[[VAL_40:.*]] = arith.mulf %[[VAL_36]], %[[VAL_30]] : f32
1851+ // CHECK: %[[VAL_41:.*]] = arith.mulf %[[VAL_39]], %[[VAL_33]] : f32
1852+ // CHECK: %[[VAL_42:.*]] = arith.divf %[[VAL_40]], %[[VAL_20]] : f32
1853+ // CHECK: %[[VAL_43:.*]] = arith.divf %[[VAL_41]], %[[VAL_22]] : f32
1854+ // CHECK: %[[VAL_44:.*]] = arith.addf %[[VAL_42]], %[[VAL_43]] : f32
1855+ // CHECK: %[[VAL_45:.*]] = arith.mulf %[[VAL_18]], %[[VAL_44]] : f32
1856+ // CHECK: %[[VAL_46:.*]] = arith.constant -1.000000e+00 : f32
1857+ // CHECK: %[[VAL_47:.*]] = arith.mulf %[[VAL_45]], %[[VAL_46]] : f32
1858+ // CHECK: %[[VAL_48:.*]] = math.cos %[[VAL_47]] : f32
1859+ // CHECK: %[[VAL_49:.*]] = math.sin %[[VAL_47]] : f32
1860+ // CHECK: %[[VAL_50:.*]] = arith.mulf %[[VAL_24]], %[[VAL_48]] : f32
1861+ // CHECK: %[[VAL_51:.*]] = arith.mulf %[[VAL_25]], %[[VAL_49]] : f32
1862+ // CHECK: %[[VAL_52:.*]] = arith.addf %[[VAL_50]], %[[VAL_51]] : f32
1863+ // CHECK: %[[VAL_53:.*]] = arith.mulf %[[VAL_25]], %[[VAL_48]] : f32
1864+ // CHECK: %[[VAL_54:.*]] = arith.mulf %[[VAL_24]], %[[VAL_49]] : f32
1865+ // CHECK: %[[VAL_55:.*]] = arith.subf %[[VAL_53]], %[[VAL_54]] : f32
1866+ // CHECK: %[[VAL_56:.*]] = arith.addf %[[VAL_26]], %[[VAL_52]] : f32
1867+ // CHECK: %[[VAL_57:.*]] = arith.addf %[[VAL_27]], %[[VAL_55]] : f32
1868+ // CHECK: linalg.yield %[[VAL_56]], %[[VAL_57]] : f32, f32
1869+ // CHECK: } -> (tensor<?x?x?xf32>, tensor<?x?x?xf32>)
1870+ // CHECK: return %[[VAL_58:.*]]#0, %[[VAL_58]]#1 : tensor<?x?x?xf32>, tensor<?x?x?xf32>
1871+ // CHECK: }
1872+ func.func @test_dynamic_fft2d (%arg0: tensor <?x?x?xf32 >, %arg1: tensor <?x?x?xf32 >) -> (tensor <?x?x?xf32 >, tensor <?x?x?xf32 >) {
1873+ %output_real , %output_imag = " tosa.fft2d" (%arg0 , %arg1 ) {inverse = true } : (tensor <?x?x?xf32 >, tensor <?x?x?xf32 >) -> (tensor <?x?x?xf32 >, tensor <?x?x?xf32 >)
1874+ return %output_real , %output_imag : tensor <?x?x?xf32 >, tensor <?x?x?xf32 >
1875+ }
0 commit comments