-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
f94b463
commit ca0478a
Showing
7 changed files
with
202 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//===- local_locks_aie2.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 2025, Advanced Micro Devices, Inc. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// RUN: aie-opt --aie-standard-lowering="tilecol=3 tilerow=3" %s | FileCheck --check-prefix=CHECK33 %s | ||
|
||
// CHECK33: func.func @core_3_3() { | ||
// CHECK33: %c56 = arith.constant 56 : index | ||
// CHECK33: %0 = arith.index_cast %c56 : index to i32 | ||
// CHECK33: %c0_i32 = arith.constant 0 : i32 | ||
// CHECK33: call @llvm.aie2.acquire(%0, %c0_i32) : (i32, i32) -> () | ||
// CHECK33: %1 = arith.index_cast %c56 : index to i32 | ||
// CHECK33: %c1_i32 = arith.constant 1 : i32 | ||
// CHECK33: call @llvm.aie2.release(%1, %c1_i32) : (i32, i32) -> () | ||
// CHECK33: return | ||
// CHECK33: } | ||
|
||
module @local_locks { | ||
aie.device(xcve2302) { | ||
%3 = aie.tile(3, 3) | ||
%11 = aie.core(%3) { | ||
%c56 = arith.constant 56 : index | ||
aie.use_lock(%c56, Acquire, 0) | ||
aie.use_lock(%c56, Release, 1) | ||
aie.end | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//===- local_locks_aie2p.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 2025, Advanced Micro Devices, Inc. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// RUN: aie-opt --aie-standard-lowering="tilecol=3 tilerow=3" %s | FileCheck --check-prefix=CHECK33 %s | ||
|
||
// CHECK33: func.func @core_3_3() { | ||
// CHECK33: %c56 = arith.constant 56 : index | ||
// CHECK33: %0 = arith.index_cast %c56 : index to i32 | ||
// CHECK33: %c0_i32 = arith.constant 0 : i32 | ||
// CHECK33: call @llvm.aie2p.acquire(%0, %c0_i32) : (i32, i32) -> () | ||
// CHECK33: %1 = arith.index_cast %c56 : index to i32 | ||
// CHECK33: %c1_i32 = arith.constant 1 : i32 | ||
// CHECK33: call @llvm.aie2p.release(%1, %c1_i32) : (i32, i32) -> () | ||
// CHECK33: return | ||
// CHECK33: } | ||
|
||
module @local_locks { | ||
aie.device(npu2) { | ||
%3 = aie.tile(3, 3) | ||
%11 = aie.core(%3) { | ||
%c56 = arith.constant 56 : index | ||
aie.use_lock(%c56, Acquire, 0) | ||
aie.use_lock(%c56, Release, 1) | ||
aie.end | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//===- useLock_in_func_aie2.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 2025, Advanced Micro Devices, Inc. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// RUN: aie-opt --aie-localize-locks --aie-standard-lowering="tilecol=1 tilerow=3" %s | FileCheck --check-prefix=CHECK %s | ||
|
||
// CHECK: module @test attributes {llvm.target_triple = "aie2"} { | ||
// CHECK: func.func private @kernel(%arg0: index) { | ||
// CHECK-NEXT: %0 = arith.index_cast %arg0 : index to i32 | ||
// CHECK-NEXT: %c0_i32 = arith.constant 0 : i32 | ||
// CHECK-NEXT: call @llvm.aie2.acquire(%0, %c0_i32) : (i32, i32) -> () | ||
// CHECK-NEXT: return | ||
// CHECK: } | ||
// CHECK: func.func @core_1_3() { | ||
// CHECK: %c48 = arith.constant 48 : index | ||
// CHECK: call @kernel(%c48) : (index) -> () | ||
// CHECK: return | ||
// CHECK: } | ||
// CHECK: } | ||
|
||
module @test { | ||
aie.device(xcve2302) { | ||
%tile13 = aie.tile(1, 3) | ||
%lock13_3 = aie.lock(%tile13, 0) | ||
|
||
func.func private @kernel(%lock : index) { | ||
aie.use_lock(%lock, "Acquire", 0) | ||
return | ||
} | ||
|
||
%core13 = aie.core(%tile13) { | ||
func.call @kernel(%lock13_3) : (index) -> () | ||
aie.end | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//===- useLock_in_func_aie2p.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 2025, Advanced Micro Devices, Inc. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// RUN: aie-opt --aie-localize-locks --aie-standard-lowering="tilecol=1 tilerow=3" %s | FileCheck --check-prefix=CHECK %s | ||
|
||
// CHECK: module @test attributes {llvm.target_triple = "aie2p"} { | ||
// CHECK: func.func private @kernel(%arg0: index) { | ||
// CHECK-NEXT: %0 = arith.index_cast %arg0 : index to i32 | ||
// CHECK-NEXT: %c0_i32 = arith.constant 0 : i32 | ||
// CHECK-NEXT: call @llvm.aie2p.acquire(%0, %c0_i32) : (i32, i32) -> () | ||
// CHECK-NEXT: return | ||
// CHECK: } | ||
// CHECK: func.func @core_1_3() { | ||
// CHECK: %c48 = arith.constant 48 : index | ||
// CHECK: call @kernel(%c48) : (index) -> () | ||
// CHECK: return | ||
// CHECK: } | ||
// CHECK: } | ||
|
||
module @test { | ||
aie.device(npu2) { | ||
%tile13 = aie.tile(1, 3) | ||
%lock13_3 = aie.lock(%tile13, 0) | ||
|
||
func.func private @kernel(%lock : index) { | ||
aie.use_lock(%lock, "Acquire", 0) | ||
return | ||
} | ||
|
||
%core13 = aie.core(%tile13) { | ||
func.call @kernel(%lock13_3) : (index) -> () | ||
aie.end | ||
} | ||
} | ||
} |