-
Notifications
You must be signed in to change notification settings - Fork 183
Expand file tree
/
Copy pathloc_preservation.mlir
More file actions
69 lines (58 loc) · 2.53 KB
/
loc_preservation.mlir
File metadata and controls
69 lines (58 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//===- loc_preservation.mlir -----------------------*- MLIR -*-===//
//
// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// (c) Copyright 2026 AMD Inc.
//
//===----------------------------------------------------------------------===//
// Verifies that:
// - --aie-create-cores forwards the source func.call op's location to the
// synthesized aie.tile / aie.buffer / aie.mem / aie.core / aie.end ops.
// - --aie-lower-memcpy forwards the source aiex.memcpy op's location to
// the synthesized aie.flow / aie.dma_start / aie.dma_bd / aiex.useToken
// / aie.next_bd ops.
// RUN: aie-opt --aie-create-cores --aie-lower-memcpy --mlir-print-debuginfo %s | FileCheck %s
#call_loc = loc("user_design.py":42:4)
#memcpy_loc = loc("user_design.py":50:4)
module @loc_test {
aie.device(xcvc1902) {
%t11 = aie.tile(1, 1)
%t22 = aie.tile(2, 2)
%buf0 = memref.alloc() : memref<256xi32>
%buf1 = memref.alloc() : memref<256xi32>
aiex.token(0) { sym_name = "token0" }
func.func @task0(%arg0: memref<256xi32>) -> () {
aiex.useToken @token0(Acquire, 0)
aiex.useToken @token0(Release, 1)
return
}
func.func @task1(%arg0: memref<256xi32>) -> () {
aiex.useToken @token0(Acquire, 2)
aiex.useToken @token0(Release, 3)
return
}
func.call @task0(%buf0) { aie.x = 1, aie.y = 1 } : (memref<256xi32>) -> () loc(#call_loc)
aiex.memcpy @token0(1, 2) (%t11 : <%buf0, 0, 256>, %t22 : <%buf1, 0, 256>) : (memref<256xi32>, memref<256xi32>) loc(#memcpy_loc)
func.call @task1(%buf1) { aie.x = 2, aie.y = 2 } : (memref<256xi32>) -> ()
}
}
// AIECreateCores: synthesized tile / core / end / mem / buffer for the call
// op carry
// the call's loc.
// CHECK-DAG: aie.tile({{.*}}) loc(#[[CALLLOC:loc[0-9]*]])
// CHECK-DAG: aie.mem({{.*}})
// CHECK-DAG: aie.core({{.*}}) {{[{][[:space:]]*$}}
// CHECK-DAG: aie.end loc(#[[CALLLOC]])
// CHECK-DAG: } loc(#[[CALLLOC]])
// CHECK-DAG: aie.buffer({{.*}}) : memref<256xi32> loc(#[[CALLLOC]])
// AIELowerMemcpy: synthesized aie.flow / dma_start / dma_bd / use_token /
// next_bd carry the memcpy's loc.
// CHECK-DAG: aie.flow({{.*}}) loc(#[[MCLOC:loc[0-9]*]])
// CHECK-DAG: aie.dma_start({{.*}}) loc(#[[MCLOC]])
// CHECK-DAG: aie.dma_bd({{.*}}) loc(#[[MCLOC]])
// CHECK-DAG: aie.next_bd {{.*}} loc(#[[MCLOC]])
// CHECK-DAG: aiex.useToken {{.*}} loc(#[[MCLOC]])
// CHECK-DAG: #[[CALLLOC]] = loc("user_design.py":42:4)
// CHECK-DAG: #[[MCLOC]] = loc("user_design.py":50:4)