[mlir][GPU] Add ShuffleOp builder for constant offset/width
Differential Revision: https://reviews.llvm.org/D119345
This commit is contained in:
parent
e92ff1b4fa
commit
69f7647158
|
@ -724,6 +724,11 @@ def GPU_ShuffleOp : GPU_Op<
|
|||
in the shuffle. Exactly the first `width` invocations of a subgroup need to
|
||||
execute this op in convergence.
|
||||
}];
|
||||
let builders = [
|
||||
// Helper function that creates a shuffle with constant offset/width.
|
||||
OpBuilder<(ins "Value":$value, "int32_t":$offset, "int32_t":$width,
|
||||
"ShuffleMode":$mode)>
|
||||
];
|
||||
let assemblyFormat = "$mode $value `,` $offset `,` $width attr-dict `:` type($value)";
|
||||
}
|
||||
|
||||
|
|
|
@ -691,6 +691,22 @@ static void printLaunchFuncOperands(OpAsmPrinter &printer, Operation *,
|
|||
printer << ")";
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ShuffleOp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void ShuffleOp::build(OpBuilder &builder, OperationState &result, Value value,
|
||||
int32_t offset, int32_t width, ShuffleMode mode) {
|
||||
build(builder, result, value,
|
||||
builder.create<arith::ConstantOp>(result.location,
|
||||
builder.getI32IntegerAttr(offset)),
|
||||
builder.create<arith::ConstantOp>(result.location,
|
||||
builder.getI32IntegerAttr(width)),
|
||||
mode);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// GPUFuncOp
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue