Skip to content

Commit 31c04a3

Browse files
committed
update
1 parent f519ca2 commit 31c04a3

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/AMDAIELowerToAIE.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "llvm/Support/Debug.h"
2929
#include "mlir/Dialect/Utils/StaticValueUtils.h"
3030
#include "mlir/IR/IRMapping.h"
31-
#include "mlir/IR/Iterators.h"
3231
#include "mlir/Pass/PassManager.h"
3332

3433
#define DEBUG_TYPE "iree-amdaie-lower-to-aie"
@@ -433,6 +432,19 @@ LogicalResult AIEDeviceBuilder::coreFuncCallOpToAIE(
433432
SymbolTable::setSymbolVisibility(newFnDecl,
434433
SymbolTable::Visibility::Private);
435434
newFnDecl->setAttr("llvm.bareptr", rewriter.getBoolAttr(true));
435+
436+
// Add the 'noalias' attribute to all argument attributes, if the type is
437+
// memref:
438+
auto noAliasAttrName = LLVM::LLVMDialect::getNoAliasAttrName();
439+
// The read-only attribute:
440+
auto readOnlyAttrName = LLVM::LLVMDialect::getReadonlyAttrName();
441+
for (int i = 0; i < newArgs.size(); ++i) {
442+
if (isa<MemRefType>(newArgs[i].getType())) {
443+
newFnDecl.setArgAttr(i, noAliasAttrName, rewriter.getUnitAttr());
444+
}
445+
}
446+
(void)readOnlyAttrName;
447+
(void)noAliasAttrName;
436448
fnDecl.getBody().cloneInto(&(newFnDecl.getBody()), mapper);
437449
mapper.map(fnDecl.getOperation(), newFnDecl.getOperation());
438450
fnDecl = newFnDecl;

compiler/plugins/target/AMD-AIE/iree-amd-aie/Transforms/test/lower_to_aie.mlir

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,9 +897,10 @@ module attributes {hal.executable.target = #executable_target_amdaie_xclbin_fb}
897897

898898
// -----
899899

900+
900901
// CHECK: aie.device
901-
// CHECK: func.func private @ukernel_B(memref<i32, 2 : i32>, index, memref<f32, 2 : i32>, index) attributes {llvm.bareptr = true}
902-
// CHECK: func.func private @ukernel_A(memref<i32, 2 : i32>, index) attributes {llvm.bareptr = true}
902+
// CHECK: func.func private @ukernel_B(memref<i32, 2 : i32> {llvm.noalias}, index, memref<f32, 2 : i32> {llvm.noalias}, index) attributes {llvm.bareptr = true}
903+
// CHECK: func.func private @ukernel_A(memref<i32, 2 : i32> {llvm.noalias}, index) attributes {llvm.bareptr = true}
903904
// CHECK: %[[TILE_0_2:.*]] = aie.tile(0, 2)
904905
// CHECK: %[[BUFFER_0_2:.*]] = aie.buffer(%[[TILE_0_2]]) {sym_name = "buff_0"} : memref<4096xi32, 2 : i32>
905906
// CHECK: %[[LOCK_0_2:.*]] = aie.lock(%[[TILE_0_2]], 0) {init = 1 : i8, sym_name = "lock_0"}

0 commit comments

Comments
 (0)