ops.td 17.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
#ifndef MGB_OPS
#define MGB_OPS

include "base.td"
include "param_defs.td"

include "mlir/Interfaces/SideEffectInterfaces.td"

def Elemwise : MgbHashableOp<"Elemwise", [ElemwiseParam], [NoSideEffect]> {
  let inputs = (ins Variadic<AnyType>:$input);
  let results = (outs AnyType);
12 13 14
  let nameFunction = [{
    return to_string($_self.mode);
  }];
15 16
}

17 18
def Reduce: MgbHashableOp<"Reduce", [ReduceParam]>{
  let extraArguments = (ins
19
    MgbDefaultValuedAttr<MgbBoolAttr, "true">:$keepdim
20 21
  );
}
22 23 24 25 26 27 28 29 30 31

def TypeCvt: MgbHashableOp<"TypeCvt", [], [NoSideEffect]> {
  let inputs = (ins AnyType:$inputs);
  let extraArguments = (ins
    TypeAttr:$idtype,
    MgbDTypeAttr:$dtype
  );
  let results = (outs AnyType);
}

32 33
def MatrixInverse: MgbHashableOp<"MatrixInverse", [EmptyParam]>;

34 35 36 37 38 39
def MatrixMul: MgbHashableOp<"MatrixMul", [MatrixMulParam, ExecutionPolicyParamBase<"policy">]> {
  let extraArguments = (ins
    MgbUI32Attr:$dimA,
    MgbUI32Attr:$dimB
  );
}
40

41 42 43 44 45 46
def BatchedMatrixMul: MgbHashableOp<"BatchedMatmul", [MatrixMulParam, ExecutionPolicyParamBase<"policy">]> {
  let extraArguments = (ins
    MgbUI32Attr:$dimA,
    MgbUI32Attr:$dimB
  );
}
47 48 49 50 51 52 53

def Dot: MgbHashableOp<"Dot", [EmptyParam]>;

def SVD: MgbHashableOp<"SVD", [SVDParam]>;

def Convolution : MgbHashableOp<"Convolution", [ConvolutionParam, ExecutionPolicyParamBase<"policy">]>;

54 55 56 57 58
def ConvolutionBackwardData: MgbHashableOp<"ConvolutionBackwardData", [ConvolutionParam, ExecutionPolicyParamBase<"policy">]> {
  let extraArguments = (ins
    MgbDTypeAttr:$dtype
  );
}
59

60 61
def Convolution3D: MgbHashableOp<"Convolution3D", [Convolution3DParam, ExecutionPolicyParamBase<"policy">]>;

62 63
def Convolution3DBackwardData: MgbHashableOp<"Convolution3DBackwardData", [Convolution3DParam, ExecutionPolicyParamBase<"policy">]>;

64 65
def DeformableConv : MgbHashableOp<"DeformableConv", [ConvolutionParam, ExecutionPolicyParamBase<"policy">]>;

66 67
def GroupLocal: MgbHashableOp<"GroupLocal", [ConvolutionParam]>;

68
def Pooling: MgbHashableOp<"Pooling", [PoolingParam, ExecutionPolicyParamBase<"policy">]>;
69

70 71 72 73 74
def AdaptivePooling : MgbHashableOp<"AdaptivePooling", [AdaptivePoolingParam]> {
  let extraArguments = (ins
    MgbArrayAttr<MgbI32Attr>:$shape
  );
}
75 76 77

def ROIPooling: MgbHashableOp<"ROIPooling", [ROIPoolingParam]>;

78 79
def DeformablePSROIPooling : MgbHashableOp<"DeformablePSROIPooling", [DeformablePSROIPoolingParam]>;

80 81 82 83 84 85 86 87 88 89 90 91
def ConvBias : MgbHashableOp<"ConvBias", [ConvBiasParam, ExecutionPolicyParamBase<"policy">]> {
  let extraArguments = (ins
    MgbDTypeAttr:$dtype
  );
}

def BatchConvBias : MgbHashableOp<"BatchConvBias", [BatchConvBiasParam, ExecutionPolicyParamBase<"policy">]> {
  let extraArguments = (ins
    MgbDTypeAttr:$dtype
  );
}

92 93
def Images2Neibs : MgbHashableOp<"Images2Neibs", [Images2NeibsParam]>;

94 95
def SlidingWindowTranspose : MgbHashableOp<"SlidingWindowTranspose", [SlidingWindowTransposeParam]>;

96 97
def BatchNorm : MgbHashableOp<"BatchNorm", [BNParam]>;

98 99
def BatchNormBackward : MgbHashableOp<"BatchNormBackward", [BNParam]>;

100
def ROIAlign: MgbHashableOp<"ROIAlign", [ROIAlignParam]>;
101
def Correlation: MgbHashableOp<"Correlation", [CorrelationParam]>;
102 103 104

def WarpPerspective: MgbHashableOp<"WarpPerspective", [WarpPerspectiveParam]>;

105 106
def WarpAffine: MgbHashableOp<"WarpAffine", [WarpAffineParam]>;

107 108 109 110
def WarpPerspectiveBackwardData: MgbHashableOp<"WarpPerspectiveBackwardData", [WarpPerspectiveParam]>;

def WarpPerspectiveBackwardMat: MgbHashableOp<"WarpPerspectiveBackwardMat", [WarpPerspectiveParam]>;

111 112
def Remap: MgbHashableOp<"Remap", [RemapParam]>;

113 114
def Resize: MgbHashableOp<"Resize", [ResizeParam]>;

115 116 117 118 119
def IndexingOneHot: MgbHashableOp<"IndexingOneHot", [AxisParam]> {
  let extraArguments = (ins
    MgbI32Attr:$ndim
  );
}
120

121 122 123 124 125
def IndexingSetOneHot: MgbHashableOp<"IndexingSetOneHot", [AxisParam]> {
  let extraArguments = (ins
    MgbI32Attr:$ndim
  );
}
126 127 128 129 130 131 132

def Copy: MgbHashableOp<"Copy"> {
  let extraArguments = (ins
    MgbCompNodeAttr:$comp_node
  );
}

133 134 135 136 137 138 139 140 141 142 143 144 145
def Borrow: MgbHashableOp<"Borrow"> {
  let extraArguments = (ins
    MgbCompNodeAttr:$comp_node
  );
}

def Barrier: MgbHashableOp<"Barrier"> {
  let extraArguments = (ins
    MgbCompNodeAttr:$comp_node,
    MgbUI32Attr:$nr_outputs
  );
}

146 147 148 149 150 151 152 153 154 155 156 157 158
def Argsort: MgbHashableOp<"Argsort", [ArgsortParam]>;

def Argmax : MgbHashableOp<"Argmax", [AxisParam]>;

def Argmin : MgbHashableOp<"Argmin", [AxisParam]>;

def CondTake : MgbHashableOp<"CondTake">;

def TopK: MgbHashableOp<"TopK", [TopKParam]>;

def NvOf: MgbHashableOp<"NvOf", [NvOfParam]>;

def UniformRNG: MgbHashableOp<"UniformRNG", [UniformRNGParam]> {
159 160 161 162 163 164
  let extraArguments = (ins
    MgbSizeTAddr:$handle
  );
  let hashFunction = [{
    return mgb::hash_pair_combine(
      mgb::hash($_self.dyn_typeinfo()),
165 166 167 168 169
      mgb::hash_pair_combine(
        mgb::hash($_self.handle),
        mgb::hash($_self.dtype.enumv())
      )
    );
170
  }];
171
  let cmpFunction = [{return $0.handle == $1.handle && $0.dtype == $1.dtype;}];
172 173 174
}

def GaussianRNG: MgbHashableOp<"GaussianRNG", [GaussianRNGParam]> {
175 176 177
  let extraArguments = (ins
    MgbSizeTAddr:$handle
  );
178 179 180
  let hashFunction = [{
    return mgb::hash_pair_combine(
      mgb::hash($_self.dyn_typeinfo()),
181 182 183 184
      mgb::hash_pair_combine(
        mgb::hash($_self.handle),
        mgb::hash_pair_combine(
          mgb::hash($_self.mean),
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
          mgb::hash_pair_combine(
            mgb::hash($_self.std),
            mgb::hash($_self.dtype.enumv())
          )
        )
      )
    );
  }];
  let cmpFunction = [{return $0.handle == $1.handle && $0.mean == $1.mean && $0.std == $1.std && $0.dtype == $1.dtype;}];
}

def GammaRNG: MgbHashableOp<"GammaRNG", [GammaRNGParam]> {
  let extraArguments = (ins
    MgbSizeTAddr:$handle
  );
  let hashFunction = [{
    return mgb::hash_pair_combine(
      mgb::hash($_self.dyn_typeinfo()),
      mgb::hash($_self.handle)
      );
  }];
  let cmpFunction = [{return $0.handle == $1.handle;}];
}

def PoissonRNG: MgbHashableOp<"PoissonRNG", [PoissonRNGParam]> {
  let extraArguments = (ins
    MgbSizeTAddr:$handle
  );
  let hashFunction = [{
    return mgb::hash_pair_combine(
      mgb::hash($_self.dyn_typeinfo()),
      mgb::hash($_self.handle)
      );
  }];
  let cmpFunction = [{return $0.handle == $1.handle;}];
}

def BetaRNG: MgbHashableOp<"BetaRNG", [BetaRNGParam]> {
  let extraArguments = (ins
    MgbSizeTAddr:$handle
  );
  let hashFunction = [{
    return mgb::hash_pair_combine(
      mgb::hash($_self.dyn_typeinfo()),
      mgb::hash($_self.handle)
      );
  }];
  let cmpFunction = [{return $0.handle == $1.handle;}];
}

def PermutationRNG: MgbHashableOp<"PermutationRNG", [PermutationRNGParam]> {
  let extraArguments = (ins
    MgbSizeTAddr:$handle
  );
  let hashFunction = [{
    return mgb::hash_pair_combine(
      mgb::hash($_self.dyn_typeinfo()),
      mgb::hash_pair_combine(
        mgb::hash($_self.handle),
        mgb::hash($_self.dtype.enumv())
245 246
      )
    );
247
  }];
248
  let cmpFunction = [{return $0.handle == $1.handle && $0.dtype == $1.dtype;}];
249 250
}

251 252 253 254 255 256 257 258 259 260 261 262 263
def Fill: MgbHashableOp<"Fill", [FillParam]> {
  let extraArguments = (ins
    MgbDTypeAttr:$dtype,
    MgbCompNodeAttr:$comp_node
  );
}

def FillLike: MgbHashableOp<"FillLike", [FillParam]> {
  let extraArguments = (ins
    MgbCompNodeAttr:$comp_node
  );
}

264 265 266 267 268 269 270 271 272 273 274 275 276
def ShuffleRNG: MgbHashableOp<"ShuffleRNG", [ShuffleRNGParam]> {
  let extraArguments = (ins
    MgbSizeTAddr:$handle
  );
  let hashFunction = [{
    return mgb::hash_pair_combine(
      mgb::hash($_self.dyn_typeinfo()),
      mgb::hash($_self.handle)
      );
  }];
  let cmpFunction = [{return $0.handle == $1.handle;}];
}

277 278 279 280 281 282 283 284 285 286 287 288
def Linspace: MgbHashableOp<"Linspace", [LinspaceParam]> {
  let extraArguments = (ins
    MgbCompNodeAttr:$comp_node
  );
}

def Eye: MgbHashableOp<"Eye", [EyeParam]> {
  let extraArguments = (ins
    MgbCompNodeAttr:$comp_node
  );
}

289 290
def Diag: MgbHashableOp<"Diag", [DiagParam]>;

291
def GetVarShape : MgbHashableOp<"GetVarShape", [OptionalAxisV1Param]>;
292 293 294 295 296 297 298

def Concat: MgbHashableOp<"Concat", [AxisParam]> {
  let extraArguments = (ins
    MgbCompNodeAttr:$comp_node
  );
}

299 300 301 302 303 304
def Stack: MgbHashableOp<"Stack", [AxisParam]> {
  let extraArguments = (ins
    MgbCompNodeAttr:$comp_node
  );
}

305 306 307 308 309
def Broadcast : MgbHashableOp<"Broadcast", [EmptyParam]> {
  let extraArguments = (ins
    MgbArrayAttr<MgbI32Attr>:$shape
  );
}
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332

def Identity: MgbHashableOp<"Identity">;

def CollectiveComm : MgbHashableOp<"CollectiveComm", [CollectiveCommParam]> {
  let extraArguments = (ins
    MgbStringAttr:$key,
    MgbUI32Attr:$nr_devices,
    MgbUI32Attr:$rank,
    MgbBoolAttr:$is_root,
    MgbBoolAttr:$local_grad,
    MgbStringAttr:$addr,
    MgbUI32Attr:$port,
    MgbDTypeAttr:$dtype,
    MgbStringAttr:$backend,
    MgbStringAttr:$comp_node
  );
}

def RemoteSend : MgbHashableOp<"RemoteSend"> {
  let extraArguments = (ins
    MgbStringAttr:$key,
    MgbStringAttr:$addr,
    MgbUI32Attr:$port,
333 334
    MgbUI32Attr:$rank_to,
    MgbStringAttr:$backend
335 336 337 338 339 340 341 342 343 344
  );
}

def RemoteRecv : MgbHashableOp<"RemoteRecv"> {
  let extraArguments = (ins
    MgbStringAttr:$key,
    MgbStringAttr:$addr,
    MgbUI32Attr:$port,
    MgbUI32Attr:$rank_from,
    MgbCompNodeAttr:$cn,
345
    MgbArrayAttr<MgbI32Attr>:$shape,
346 347
    MgbDTypeAttr:$dtype,
    MgbStringAttr:$backend
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
  );
}

def NMSKeep : MgbHashableOp<"NMSKeep"> {
  let extraArguments = (ins
    MgbF32Attr:$iou_thresh,
    MgbUI32Attr:$max_output
  );
}

def ParamPackSplit : MgbHashableOp<"ParamPackSplit"> {
  let extraArguments = (ins
    MgbArrayAttr<MgbI32Attr>:$offsets,
    MgbArrayAttr<MgbArrayAttr<MgbSizeTAddr>>:$shapes
  );
}

def ParamPackConcat : MgbHashableOp<"ParamPackConcat"> {
  let extraArguments = (ins
    MgbArrayAttr<MgbI32Attr>:$offsets
  );
}

def Dimshuffle: MgbHashableOp<"Dimshuffle"> {
  let inputs = (ins AnyMemRef:$input);
  let extraArguments = (ins MgbArrayAttr<MgbI32Attr>:$pattern);
  let results = (outs AnyMemRef);
}

377 378 379 380 381
def Reshape: MgbHashableOp<"Reshape", [OptionalAxisV1Param]> {
  let extraArguments = (ins
    MgbArrayAttr<MgbI32Attr>:$shape
  );
}
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401

// TODO: merge Add/Remove Axis into AxisAddRemove as megbrain?
def AddAxis: MgbHashableOp<"AddAxis"> {
  let extraArguments = (ins
    MgbArrayAttr<MgbI32Attr>:$axis
  );
}
def RemoveAxis: MgbHashableOp<"RemoveAxis"> {
  let extraArguments = (ins
    MgbArrayAttr<MgbI32Attr>:$axis
  );
}

class FancyIndexingBase<string name>: MgbHashableOp<name> {
  let extraArguments = (ins
    MgbArrayAttr<MgbTupleAttr<
      [MgbI8Attr, MgbBoolAttr, MgbBoolAttr, MgbBoolAttr, MgbBoolAttr]>>:$items
  );
}

402 403 404 405 406 407 408 409 410
def Subtensor: MgbHashableOp<"Subtensor"> {
  let extraArguments = (ins
    MgbArrayAttr<MgbTupleAttr<
      [MgbI8Attr, MgbBoolAttr, MgbBoolAttr, MgbBoolAttr, MgbBoolAttr]>>:$items,
    MgbArrayAttr<MgbTupleAttr<[MgbI32Attr, MgbI32Attr, MgbI32Attr, MgbI32Attr]>>:$slice_items
  );
}

// def Subtensor: FancyIndexingBase<"Subtensor">;
411 412 413 414 415 416 417 418 419 420 421 422 423
def SetSubtensor: FancyIndexingBase<"SetSubtensor">;
def IncrSubtensor: FancyIndexingBase<"IncrSubtensor">;
def IndexingMultiAxisVec: FancyIndexingBase<"IndexingMultiAxisVec">;
def IndexingSetMultiAxisVec: FancyIndexingBase<"IndexingSetMultiAxisVec">;
def IndexingIncrMultiAxisVec: FancyIndexingBase<"IndexingIncrMultiAxisVec">;
def MeshIndexing: FancyIndexingBase<"MeshIndexing">;
def IncrMeshIndexing: FancyIndexingBase<"IncrMeshIndexing">;
def SetMeshIndexing: FancyIndexingBase<"SetMeshIndexing">;
def BatchedMeshIndexing: FancyIndexingBase<"BatchedMeshIndexing">;
def BatchedIncrMeshIndexing: FancyIndexingBase<"BatchedIncrMeshIndexing">;
def BatchedSetMeshIndexing: FancyIndexingBase<"BatchedSetMeshIndexing">;

def FakeQuant: MgbHashableOp<"FakeQuant", [FakeQuantParam]>;
424
def AssertEqual: MgbHashableOp<"AssertEqual",[AssertEqualParam]>;
M
Megvii Engine Team 已提交
425
def TQT: MgbHashableOp<"TQT", [TQTParam]>;
M
Megvii Engine Team 已提交
426
def LSQ: MgbHashableOp<"LSQ", [LSQParam]>;
427
def Softmax: MgbHashableOp<"Softmax", [SoftmaxParam]>;
428 429 430 431
def ElemwiseMultiType: MgbHashableOp<"ElemwiseMultiType", [ElemwiseMultiTypeParam]> {
  let extraArguments = (ins
    MgbDTypeAttr:$dtype
  );
432 433 434
  let nameFunction = [{
    return to_string($_self.mode);
  }];
435 436
}

437 438
def InplaceAdd: MgbHashableOp<"InplaceAdd", [EmptyParam]>;

439 440 441 442 443 444 445
def TensorRTRuntime: MgbHashableOp<"TensorRTRuntime"> {
  let extraArguments = (ins
    MgbStringAttr:$buf,
    MgbSizeTAddr:$buf_size
  );
}

446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461
def AtlasRuntime: MgbHashableOp<"AtlasRuntime"> {
  let extraArguments = (ins
    MgbStringAttr:$buf,
    MgbSizeTAddr:$buf_size
  );
}

def CambriconRuntime: MgbHashableOp<"CambriconRuntime"> {
  let extraArguments = (ins
    MgbStringAttr:$buf,
    MgbSizeTAddr:$buf_size,
    MgbStringAttr:$symbol,
    MgbBoolAttr:$tensor_dim_mutable
  );
}

462 463 464 465 466 467 468
def MagicMindRuntime: MgbHashableOp<"MagicMindRuntime"> {
  let extraArguments = (ins
    MgbStringAttr:$buf,
    MgbSizeTAddr:$buf_size
  );
}

469 470
def CvtColor: MgbHashableOp<"CvtColor", [CvtColorParam]>;

471
def CheckNonFinite: MgbHashableOp<"CheckNonFinite", [CheckNonFiniteParam]>;
472

473 474
def FastpathCopy: MgbHashableOp<"FastpathCopy">;

475 476 477 478 479 480 481 482 483 484 485 486
def PixelShuffle: MgbHashableOp<"PixelShuffle"> {
  let extraArguments = (ins
    MgbI32Attr:$factor
  );
}

def PixelShuffleBackward: MgbHashableOp<"PixelShuffleBackward"> {
  let extraArguments = (ins
    MgbI32Attr:$factor
  );
}

487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504
def ExternOpr: MgbHashableOp<"ExternOpr"> {
  let extraArguments = (ins
    MgbArrayAttr<MgbArrayAttr<MgbSizeTAddr>>:$output_shapes,
    MgbStringAttr:$name,
    MgbStringAttr:$data,
    MgbSizeTAddr:$data_len,
    MgbArrayAttr<MgbDTypeAttr>:$output_dtypes
  );
  let hashFunction = [{
    return mgb::hash_pair_combine(
      mgb::hash($_self.dyn_typeinfo()),
      mgb::hash_pair_combine(
        mgb::hash($_self.name),
        mgb::hash($_self.data))
      );
  }];
}

M
Megvii Engine Team 已提交
505 506
def Cumsum: MgbHashableOp<"Cumsum", [CumsumParam]>;

507 508
def Split: MgbHashableOp<"Split", [EmptyParam]> {
  let extraArguments = (ins
509 510
    MgbI32Attr:$axis,
    MgbI32Attr:$nsections
511 512 513
  );
}

514 515
def Padding: MgbHashableOp<"Padding", [PaddingParam]>;

516 517
def LRN: MgbHashableOp<"LRN", [LRNParam]>;

518
def LayerNorm: MgbHashableOp<"LayerNorm", [LayerNormParam]>;
519

520 521
def GroupNorm: MgbHashableOp<"GroupNorm", [GroupNormParam]>;

522 523
def GeneralNorm: MgbHashableOp<"GeneralNorm", [GeneralNormParam]>;

524 525
def LAMBUpdate: MgbHashableOp<"LAMBUpdate", [LAMBUpdateParam]>;

526 527 528 529
def RNNCell: MgbHashableOp<"RNNCell", [RNNCellParam]>;

def LSTMCell: MgbHashableOp<"LSTMCell", [EmptyParam]>;

530 531
def InstanceNorm: MgbHashableOp<"InstanceNorm",[GroupNormParam]>;

532 533 534
def RNN: MgbHashableOp<"RNN", [RNNParam]>;

def LSTM: MgbHashableOp<"LSTM", [LSTMParam]>;
535

536 537 538 539 540 541 542 543 544 545 546 547 548 549 550
def Dropout: MgbHashableOp<"Dropout", [DropoutParam]> {
  let extraArguments = (ins
    MgbSizeTAddr:$handle
  );
  let hashFunction = [{
    return mgb::hash_pair_combine(
      mgb::hash($_self.dyn_typeinfo()),
      mgb::hash_pair_combine(
        mgb::hash($_self.drop_prob),
        mgb::hash($_self.handle))
      );
  }];
  let cmpFunction = [{return $0.handle == $1.handle && $0.drop_prob == $1.drop_prob;}];

}
551 552 553 554 555
def MeshGrid: MgbHashableOp<"MeshGrid"> {
  let extraArguments = (ins
  MgbStringAttr:$indexing
  );
}
556 557 558 559

def RegionRestrictedConvolution: MgbHashableOp<"RegionRestrictedConvolution", [ConvolutionParam]>;

def RegionRestrictedConvolutionBackwardData: MgbHashableOp<"RegionRestrictedConvolutionBackwardData", [ConvolutionParam]>;
M
Megvii Engine Team 已提交
560
def MaskedFill: MgbHashableOp<"MaskedFill", [FillParam]>;
561

562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614
def MultiHeadAttn: MgbHashableOp<"MultiHeadAttn", [MultiHeadAttnParam]> {
  let extraArguments = (ins
    MgbSizeTAddr:$handle
  );
  let hashFunction = [{
    return mgb::hash_pair_combine(
      mgb::hash($_self.dyn_typeinfo()),
      mgb::hash_pair_combine(
        mgb::hash($_self.handle),
        mgb::hash_pair_combine(
          mgb::hash($_self.num_heads),
          mgb::hash_pair_combine(
            mgb::hash($_self.sm_scaler),
            mgb::hash_pair_combine(
              mgb::hash($_self.input_order),
              mgb::hash_pair_combine(
                mgb::hash($_self.reslink),
                mgb::hash_pair_combine(
                  mgb::hash($_self.training),
                  mgb::hash_pair_combine(
                    mgb::hash($_self.bias),
                    mgb::hash_pair_combine(
                      mgb::hash($_self.attn_mask),
                      mgb::hash_pair_combine(
                        mgb::hash($_self.enable_qproj),
                        mgb::hash_pair_combine(
                          mgb::hash($_self.enable_kproj),
                          mgb::hash_pair_combine(
                            mgb::hash($_self.enable_vproj),
                            mgb::hash_pair_combine(
                              mgb::hash($_self.enable_oproj),
                              mgb::hash_pair_combine(
                                mgb::hash($_self.attn_prob),
                                mgb::hash($_self.out_prob)
                                )
                              )
                            )
                          )
                        )
                      )
                    )
                  )
                )
              )
            )
          )
        )
      );
  }];
  let cmpFunction = [{return $0.handle == $1.handle && $0.num_heads == $1.num_heads && $0.sm_scaler == $1.sm_scaler && $0.input_order == $1.input_order && $0.reslink == $1.reslink && $0.training == $1.training && $0.bias == $1.bias && $0.attn_mask == $1.attn_mask && $0.enable_qproj == $1.enable_qproj && $0.enable_kproj == $1.enable_kproj && $0.enable_vproj == $1.enable_vproj && $0.enable_oproj == $1.enable_oproj && $0.attn_prob == $1.attn_prob && $0.out_prob == $1.out_prob;}];

}

615
#endif // MGB_OPS