Skip to content

Commit 3f114b0

Browse files
committed
[CIR][NFC] Match coding style with clang-format CI version
1 parent 3597e58 commit 3f114b0

File tree

5 files changed

+23
-10
lines changed

5 files changed

+23
-10
lines changed

include/aie/CIR/CIRToAIEPasses.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- CIRToAIEpasses.h ----------------------------------------------*- C++ -*-===//
1+
//===- CIRToAIEpasses.h -----------------------------------------*- C++ -*-===//
22
//
33
// This file is licensed under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -23,8 +23,7 @@ namespace xilinx::AIE::CIR {
2323
std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
2424
createCIRToAIEPreparePass();
2525

26-
std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
27-
createCIRToAIEPass();
26+
std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>> createCIRToAIEPass();
2827

2928
std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
3029
createCIRToAIEInlineKernelLambdaPass();
@@ -36,6 +35,6 @@ createCIRToAIEDecaptureKernelPass();
3635
#define GEN_PASS_REGISTRATION
3736
#include "aie/CIR/CIRToAIEPasses.h.inc"
3837

39-
}
38+
} // namespace xilinx::AIE::CIR
4039

4140
#endif

include/aie/CIR/runtime/aie++/aie++.hpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,12 @@ template <typename Channel> struct accessor {
9393
// implemented"' failed.
9494
//
9595
// accessor(access_t& a) : storage {a} { aquire<Channel>(); }
96-
accessor(access_t& a) { storage = &a; aquire<Channel>(); }
96+
accessor(access_t& a) {
97+
storage = &a;
98+
aquire<Channel>();
99+
}
97100
auto& operator[](std::size_t index) { return (*storage)[index]; }
98-
operator typename Channel::access_t&() { return *storage; }
101+
operator typename Channel::access_t &() { return *storage; }
99102
~accessor() { release<Channel>(); }
100103
};
101104

@@ -142,7 +145,8 @@ enum : std::int8_t { npu1 = 42 };
142145
// "Unique" with the lambda is used to generate a different type for multiple
143146
// instantiation, so we can have a design with several accelerators of the same
144147
// type
145-
template <auto DeviceModel = npu1, typename Unique = decltype([] {})> struct device {
148+
template <auto DeviceModel = npu1, typename Unique = decltype([] {})>
149+
struct device {
146150
template <int X, int Y>
147151
tile<X, Y, device> tile()
148152
__attribute__((annotate("aie.device.tile", X, Y, DeviceModel,

lib/CIR/CIRToAIEPasses.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ void eraseOpsAndUsers(OpRange &&opsToErase) {
8989
llvm::SmallVector<mlir::Operation *> sorted{allOpsAndUsers.begin(),
9090
allOpsAndUsers.end()};
9191
mlir::computeTopologicalSorting(sorted);
92-
LLVM_DEBUG(for (auto *op : sorted)
92+
LLVM_DEBUG(for (auto *op
93+
: sorted)
9394
op->emitRemark("eraseOpsAndUsers: topologicalSort"));
9495
for (auto *op : llvm::reverse(sorted)) {
9596
LLVM_DEBUG(op->emitRemark("eraseOpsAndUsers: reverse"));

test/CIR/aie++/empty.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
/* A tile with an empty program
2+
3+
Show that declaration of multiple devices of the same kind are actually
4+
different types, allowing 2 devices in the same platform distinguished in a
5+
type-safe way
26
*/
37

48
#include "aie++.hpp"
59

610
int main() {
711
aie::device<aie::npu1> d;
8-
d.tile<2, 3>().program([]{});
12+
d.tile<2, 3>().program([] {});
913
d.run();
1014
// Check we can get another type for another accelerator of the same kind
1115
aie::device<aie::npu1> other_device_unused;
1216
auto unused_tile = other_device_unused.tile<2, 3>();
17+
18+
// Check the type safety
19+
static_assert(!std::is_same_v<decltype(d), decltype(other_device_unused)>);
20+
static_assert(
21+
!std::is_same_v<decltype(d.tile<2, 3>()), decltype(unused_tile)>);
1322
}

test/CIR/aie++/example.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ int main() {
2828
auto t = d.tile<1, 4>();
2929
auto b = t.buffer<int, 8192>();
3030
t.program([&] { b[3] = 14; });
31-
d.tile<2, 3>().program([]{});
31+
d.tile<2, 3>().program([] {});
3232
d.run();
3333
}

0 commit comments

Comments
 (0)