Skip to content

Commit

Permalink
Add attribute control for swizzle
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvedhmeshram committed Apr 21, 2022
1 parent c20047a commit 0686f2b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion iree/compiler/Codegen/Common/WorkGroupSwizzle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
namespace mlir {
namespace iree_compiler {

static const char kSwizzleAttr[] = "iree_swizzle";

/// This function implements the following swizzling logic
/// void getTiledId2(unsigned x, unsigned y, unsigned* tiledx,
/// unsigned* tiledy) {
Expand Down Expand Up @@ -68,9 +70,13 @@ struct WorkGroupSwizzlePass
return success();
}
void runOnOperation() override {
FuncOp funcOp = getOperation();
funcOp.walk([&](linalg::LinalgOp op) {
if (auto attr = op->getAttrOfType<IntegerAttr>(kSwizzleAttr))
swizzleLogTile = attr.getInt();
});
if (swizzleLogTile == 0) return;
unsigned swizzleTile = pow(2, swizzleLogTile);
FuncOp funcOp = getOperation();
std::array<IREE::HAL::InterfaceWorkgroupIDOp, 2> oldWorkgroupIds;
bool xFound = false, yFound = false;
funcOp.walk([&](IREE::HAL::InterfaceWorkgroupIDOp idOp) {
Expand Down

0 comments on commit 0686f2b

Please sign in to comment.