Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions mlir/include/mlir/Dialect/DXSA/IR/DXSADialect.td
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ def DXSADialect : Dialect {

let useDefaultTypePrinterParser = 1;
let useDefaultAttributePrinterParser = 1;

let extraClassDeclaration = [{
// Defined in DXSAOperand.cpp where GET_ATTRDEF_CLASSES is instantiated.
void registerAttributes();
}];
}

#endif // DXSA_DIALECT_TD
59 changes: 59 additions & 0 deletions mlir/include/mlir/Dialect/DXSA/IR/DXSAFPArithOps.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//===- DXSAFPArithOps.td - DXSA float arithmetic ops ----*- tablegen -*-===//
//
// Part of the LLVM 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
//
//===----------------------------------------------------------------------===//
//
// Floating-point arithmetic instructions of the DXSA dialect.
//
//===----------------------------------------------------------------------===//

#ifndef MLIR_DIALECT_DXSA_IR_DXSAFPARITHOPS
#define MLIR_DIALECT_DXSA_IR_DXSAFPARITHOPS

include "mlir/Dialect/DXSA/IR/DXSAOpBase.td"

//===----------------------------------------------------------------------===//
// dxsa.add
//===----------------------------------------------------------------------===//

def DXSA_Add : DXSA_BinaryOp<"add"> {
let summary = "component-wise floating-point add";
let description = [{
The `dxsa.add` operation computes the component-wise floating-point
sum `$dst = $lhs + $rhs`.

Example:

```mlir
dxsa.add r<0>, r<1>, r<2>
dxsa.add r<0>, -r<1>, -|r<2>|
dxsa.add r<0, <x, y>>, r<1, <y, z, x, w>>, |r<2, <z, z, z, z>>|
```
}];
}

//===----------------------------------------------------------------------===//
// dxsa.add_sat
//===----------------------------------------------------------------------===//

def DXSA_AddSat : DXSA_BinaryOp<"add_sat"> {
let summary = "component-wise floating-point add, saturated to [0, 1]";
let description = [{
The `dxsa.add_sat` operation computes the component-wise floating-point
sum of `$lhs` and `$rhs`, clamps each component of the result to
`[0.0, 1.0]`, and writes it to `$dst`.

Example:

```mlir
dxsa.add_sat r<0>, r<1>, r<2>
dxsa.add_sat r<0>, -r<1>, -|r<2>|
dxsa.add_sat r<0, <x, y>>, r<1, <y, z, x, w>>, |r<2, <z, z, z, z>>|
```
}];
}

#endif // MLIR_DIALECT_DXSA_IR_DXSAFPARITHOPS
41 changes: 41 additions & 0 deletions mlir/include/mlir/Dialect/DXSA/IR/DXSAOpBase.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//===- DXSAOpBase.td - DXSA op base classes --------------*- tablegen -*-===//
//
// Part of the LLVM 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
//
//===----------------------------------------------------------------------===//
//
// Base classes shared by the DXSA operation families.
//
//===----------------------------------------------------------------------===//

#ifndef MLIR_DIALECT_DXSA_IR_DXSAOPBASE
#define MLIR_DIALECT_DXSA_IR_DXSAOPBASE

include "mlir/Dialect/DXSA/IR/DXSADialect.td"
include "mlir/Dialect/DXSA/IR/DXSAOperand.td"

//===----------------------------------------------------------------------===//
// DXSA op base class
//===----------------------------------------------------------------------===//

// Base class for all operations in this dialect.
class DXSA_Op<string mnemonic, list<Trait> traits = []> :
Op<DXSADialect, mnemonic, traits>;

//===----------------------------------------------------------------------===//
// DXSA shared bases for ops with inline operands
//===----------------------------------------------------------------------===//

class DXSA_BinaryOp<string mnemonic> : DXSA_Op<mnemonic> {
let arguments = (ins
DXSA_DstOperandAttr:$dst,
DXSA_SrcOperandAttr:$lhs,
DXSA_SrcOperandAttr:$rhs,
OptionalAttr<DXSA_ComponentMaskAttr>:$precise);
let results = (outs);
let assemblyFormat = "$dst `,` $lhs `,` $rhs attr-dict";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assemblyFormat does not use $precise. Unused?

}

#endif // MLIR_DIALECT_DXSA_IR_DXSAOPBASE
Loading