-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit to add ops into MIOpen dialect.
- conv2d - transform - gridwise_gemm add dummy parse / print / verify logic. add dummy test.
- Loading branch information
Showing
5 changed files
with
127 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//===- MIOpenOps.td - MIOpen operation definitions ---------*- tablegen -*-===// | ||
// | ||
// Part of the MLIR Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Defines MLIR MIOpen operations. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef MIOPEN_OPS | ||
#define MIOPEN_OPS | ||
|
||
include "mlir/IR/OpBase.td" | ||
//include "mlir/Transforms/LoopLikeInterface.td" | ||
|
||
def MIOpen_Dialect : Dialect { | ||
let name = "miopen"; | ||
let cppNamespace = ""; | ||
} | ||
|
||
// Base class for MIOpen dialect ops. | ||
class MIOpen_Op<string mnemonic, list<OpTrait> traits = []> : | ||
Op<MIOpen_Dialect, mnemonic, traits> { | ||
// For every standard op, there needs to be a: | ||
// * void print(OpAsmPrinter &p, ${C++ class of Op} op) | ||
// * LogicalResult verify(${C++ class of Op} op) | ||
// * ParseResult parse${C++ class of Op}(OpAsmParser &parser, | ||
// OperationState &result) | ||
// functions. | ||
let printer = [{ return ::print(p, *this); }]; | ||
let verifier = [{ return ::verify(*this); }]; | ||
let parser = [{ return ::parse$cppClass(parser, result); }]; | ||
} | ||
|
||
def MIOpen_Conv2DOp : MIOpen_Op<"conv2d">; | ||
|
||
def MIOpen_TransformOp : MIOpen_Op<"transform">; | ||
|
||
def MIOpen_GridwiseGemmOp : MIOpen_Op<"gridwise_gemm">; | ||
|
||
#endif // MIOPEN_OPS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// RUN: mlir-opt %s | FileCheck %s | ||
// RUN: mlir-opt %s | mlir-opt | FileCheck %s | ||
// Run: mlir-opt -mlir-print-op-generic %s | mlir-opt | FileCheck %s | ||
|
||
func @miopen_conv2d(%filter : memref<?x?x?x?xf32>, %input : memref<?x?x?x?xf32>, %output : memref<?x?x?x?xf32>) { | ||
miopen.conv2d | ||
return | ||
} | ||
// CHECK-LABEL: func @miopen_conv2d | ||
// CHECK-NEXT: miopen.conv2d | ||
|
||
func @miopen_transform(%memref : memref<?x?x?x?xf32>) { | ||
miopen.transform | ||
return | ||
} | ||
|
||
// CHECK-LABEL: func @miopen_transform | ||
// CHECK-NEXT: miopen.transform | ||
|
||
func @miopen_gridwise_gemm(%A : memref<?x?xf32>, %B : memref<?x?xf32>, %C : memref<?x?xf32>) { | ||
miopen.gridwise_gemm | ||
return | ||
} | ||
|
||
// CHECK-LABEL: func @miopen_gridwise_gemm | ||
// CHECK-NEXT: miopen.gridwise_gemm |