Skip to content

Commit 08cf9cd

Browse files
author
Longsheng Du
committed
fix
1 parent ff2fd3b commit 08cf9cd

File tree

3 files changed

+19
-18
lines changed

3 files changed

+19
-18
lines changed

include/gc/Dialect/OneDNNGraph/OneDNNGraphTypes.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ include "OneDNNGraphDialect.td"
1818
//===----------------------------------------------------------------------===//
1919

2020
def OneDNNGraph_DataType : AnyTypeOf<[
21-
F16,
21+
F16,
2222
BF16,
2323
F32,
2424
SI<32>,

lib/gc/Dialect/OneDNNGraph/OneDNNGraphDialect.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,6 @@
1010
#include "gc/Dialect/OneDNNGraph/OneDNNGraphOps.h"
1111
#include "gc/Dialect/OneDNNGraph/OneDNNGraphTypes.h"
1212

13-
#include "mlir/Dialect/Quant/QuantOps.h"
14-
#include "mlir/Dialect/Tensor/IR/Tensor.h"
15-
#include "mlir/Dialect/Tosa/IR/TosaOps.h"
16-
#include "mlir/Dialect/Tosa/Utils/QuantUtils.h"
17-
#include "mlir/Dialect/Tosa/Utils/ShapeUtils.h"
18-
#include "mlir/Dialect/Utils/IndexingUtils.h"
19-
#include "mlir/IR/BuiltinTypes.h"
20-
#include "mlir/IR/DialectImplementation.h"
21-
#include "mlir/IR/Matchers.h"
22-
#include "mlir/IR/PatternMatch.h"
23-
#include "mlir/IR/TypeUtilities.h"
24-
#include "mlir/Interfaces/InferTypeOpInterface.h"
25-
#include "mlir/Transforms/InliningUtils.h"
26-
#include "llvm/ADT/APFloat.h"
27-
#include "llvm/ADT/DenseMap.h"
28-
#include "llvm/ADT/TypeSwitch.h"
29-
3013
using namespace mlir;
3114
using namespace mlir::onednn_graph;
3215

test/gc/Dialect/OneDNNGraph/onednn-graph-mlp.mlir

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
func.func @mlp(%in: tensor<128x512xbf16>,
55
%weight0: tensor<512x64xbf16>, %bias0: tensor<64xbf16>,
66
%weight1: tensor<64x256xbf16>, %bias1: tensor<256xbf16>) -> tensor<128x256xbf16> {
7+
// CHECK: [[MM1:%.+]] = onednn_graph.matmul
8+
// CHECK: [[RL1:%.+]] = onednn_graph.relu [[MM1]]
9+
// CHECK: [[MM2:%.+]] = onednn_graph.matmul
10+
// CHECK: [[AD2:%.+]] = onednn_graph.add [[MM2]]
11+
// CHECK: [[RL2:%.+]] = onednn_graph.relu [[AD2]]
12+
// CHECK: return [[RL2]]
713
%0 = onednn_graph.matmul %in, %weight0, %bias0
814
: (tensor<128x512xbf16>, tensor<512x64xbf16>, tensor<64xbf16>) -> tensor<128x64xbf16>
915
%1 = onednn_graph.relu %0 : (tensor<128x64xbf16>) -> tensor<128x64xbf16>
@@ -17,6 +23,10 @@ func.func @mlp(%in: tensor<128x512xbf16>,
1723
// CHECK-LABEL: @mlp_transpose_a
1824
func.func @mlp_transpose_a(%in: tensor<512x128xbf16>,
1925
%weight0: tensor<512x256xbf16>, %bias0: tensor<256xbf16>) -> tensor<128x256xbf16> {
26+
// CHECK: [[MM1:%.+]] = onednn_graph.matmul
27+
// CHECK: {transpose_a = true}
28+
// CHECK-NEXT: [[RL1:%.+]] = onednn_graph.relu [[MM1]]
29+
// CHECK-NEXT: return [[RL1]]
2030
%0 = onednn_graph.matmul %in, %weight0, %bias0 {transpose_a = true}
2131
: (tensor<512x128xbf16>, tensor<512x256xbf16>, tensor<256xbf16>) -> tensor<128x256xbf16>
2232
%1 = onednn_graph.relu %0 : (tensor<128x256xbf16>) -> tensor<128x256xbf16>
@@ -26,6 +36,10 @@ func.func @mlp_transpose_a(%in: tensor<512x128xbf16>,
2636
// CHECK-LABEL: @mlp_transpose_b
2737
func.func @mlp_transpose_b(%in: tensor<128x512xbf16>,
2838
%weight0: tensor<256x512xbf16>, %bias0: tensor<256xbf16>) -> tensor<128x256xbf16> {
39+
// CHECK: [[MM1:%.+]] = onednn_graph.matmul
40+
// CHECK: {transpose_b = true}
41+
// CHECK-NEXT: [[RL1:%.+]] = onednn_graph.relu [[MM1]]
42+
// CHECK-NEXT: return [[RL1]]
2943
%0 = onednn_graph.matmul %in, %weight0, %bias0 {transpose_b = true}
3044
: (tensor<128x512xbf16>, tensor<256x512xbf16>, tensor<256xbf16>) -> tensor<128x256xbf16>
3145
%1 = onednn_graph.relu %0 : (tensor<128x256xbf16>) -> tensor<128x256xbf16>
@@ -35,6 +49,10 @@ func.func @mlp_transpose_b(%in: tensor<128x512xbf16>,
3549
// CHECK-LABEL: @mlp_transpose_a_b
3650
func.func @mlp_transpose_a_b(%in: tensor<512x128xbf16>,
3751
%weight0: tensor<256x512xbf16>, %bias0: tensor<256xbf16>) -> tensor<128x256xbf16> {
52+
// CHECK: [[MM1:%.+]] = onednn_graph.matmul
53+
// CHECK: {transpose_a = true, transpose_b = true}
54+
// CHECK-NEXT: [[RL1:%.+]] = onednn_graph.relu [[MM1]]
55+
// CHECK-NEXT: return [[RL1]]
3856
%0 = onednn_graph.matmul %in, %weight0, %bias0 {transpose_a = true, transpose_b = true}
3957
: (tensor<512x128xbf16>, tensor<256x512xbf16>, tensor<256xbf16>) -> tensor<128x256xbf16>
4058
%1 = onednn_graph.relu %0 : (tensor<128x256xbf16>) -> tensor<128x256xbf16>

0 commit comments

Comments
 (0)