From d1213ae51d2e321680a4c62c32358e3e07ff3f66 Mon Sep 17 00:00:00 2001 From: Alex Zinenko Date: Tue, 10 Dec 2019 13:54:50 -0800 Subject: Move gpu.launch_func to ODS. NFC Move the definition of gpu.launch_func operation from hand-rolled C++ implementation to the ODS framework. Also move the documentation. This only performs the move and remains a non-functional change, a follow-up will clean up the custom functions that can be auto-generated using ODS. PiperOrigin-RevId: 284842252 --- mlir/lib/Dialect/GPU/IR/GPUDialect.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'mlir/lib/Dialect/GPU/IR/GPUDialect.cpp') diff --git a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp index 05dcd90ea45..b8970650806 100644 --- a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp +++ b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp @@ -46,10 +46,10 @@ bool GPUDialect::isKernel(Operation *op) { GPUDialect::GPUDialect(MLIRContext *context) : Dialect(getDialectName(), context) { - addOperations(); + >(); } LogicalResult GPUDialect::verifyOperationAttribute(Operation *op, @@ -545,26 +545,26 @@ KernelDim3 LaunchFuncOp::getBlockSizeOperandValues() { return KernelDim3{getOperand(3), getOperand(4), getOperand(5)}; } -LogicalResult LaunchFuncOp::verify() { - auto module = getParentOfType(); +LogicalResult verify(LaunchFuncOp op) { + auto module = op.getParentOfType(); if (!module) - return emitOpError("expected to belong to a module"); + return op.emitOpError("expected to belong to a module"); if (!module.getAttrOfType(GPUDialect::getContainerModuleAttrName())) - return emitOpError("expected the closest surrounding module to have the '" + - GPUDialect::getContainerModuleAttrName() + - "' attribute"); + return op.emitOpError( + "expected the closest surrounding module to have the '" + + GPUDialect::getContainerModuleAttrName() + "' attribute"); - auto kernelAttr = getAttrOfType(getKernelAttrName()); + auto kernelAttr = op.getAttrOfType(op.getKernelAttrName()); if (!kernelAttr) - return emitOpError("string attribute '" + getKernelAttrName() + - "' must be specified"); + return op.emitOpError("string attribute '" + op.getKernelAttrName() + + "' must be specified"); auto kernelModuleAttr = - getAttrOfType(getKernelModuleAttrName()); + op.getAttrOfType(op.getKernelModuleAttrName()); if (!kernelModuleAttr) - return emitOpError("symbol reference attribute '" + - getKernelModuleAttrName() + "' must be specified"); + return op.emitOpError("symbol reference attribute '" + + op.getKernelModuleAttrName() + "' must be specified"); return success(); } -- cgit v1.2.3