Skip to content

Commit

Permalink
Removed explicit values/enumeration in fbs enums (#1426)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmitrovicTT authored Nov 28, 2024
1 parent ae987d5 commit 0585abd
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 103 deletions.
94 changes: 48 additions & 46 deletions include/ttmlir/Target/Common/types.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,67 +11,67 @@ struct Dim2dRange {
}

enum Arch: uint {
Grayskull = 0,
Wormhole_b0 = 1,
Blackhole = 2,
Grayskull,
Wormhole_b0,
Blackhole
}

enum DataType: uint16 {
Float32 = 0,
Float16 = 1,
BFloat16 = 2,
BFP_Float8 = 3,
BFP_BFloat8 = 4,
BFP_Float4 = 5,
BFP_BFloat4 = 6,
BFP_Float2 = 7,
BFP_BFloat2 = 8,
UInt32 = 9,
UInt16 = 10,
UInt8 = 11,
Float32,
Float16,
BFloat16,
BFP_Float8,
BFP_BFloat8,
BFP_Float4,
BFP_BFloat4,
BFP_Float2,
BFP_BFloat2,
UInt32,
UInt16,
UInt8,
}

enum OOBVal: ushort {
Undef = 0,
Zero = 1,
One = 2,
Inf = 3,
NegInf = 4,
Undef,
Zero,
One,
Inf,
NegInf,
}

enum MemorySpace: ushort {
System = 0,
SystemMMIO = 1,
DeviceDRAM = 2,
DeviceL1 = 3,
System,
SystemMMIO,
DeviceDRAM,
DeviceL1,
}

enum ChipCapability: uint32 (bit_flags) {
PCIE = 0,
HostMMIO = 1,
PCIE,
HostMMIO,
}

enum TensorMemoryLayout: ushort {
None = 0,
Interleaved = 1,
SingleBank = 2,
HeightSharded = 3,
WidthSharded = 4,
BlockSharded = 5,
None,
Interleaved,
SingleBank,
HeightSharded,
WidthSharded,
BlockSharded,
}

enum TensorLayout: ushort {
RowMajor = 0,
Tile = 1,
Invalid = 2,
RowMajor,
Tile,
Invalid,
}

enum BufferType: ushort {
DRAM = 0,
L1 = 1,
SystemMemory = 2,
L1Small = 3,
Trace = 4,
DRAM,
L1,
SystemMemory,
L1Small,
Trace,
}

// TODO (#620): Add other fields like core_ranges, shard orientation etc.
Expand Down Expand Up @@ -197,8 +197,8 @@ table ChipPhysicalCores {

enum CPURole: uint8
{
Host = 0,
Device = 1,
Host,
Device,
}

table CPUDesc {
Expand All @@ -223,9 +223,11 @@ table EventRef {
global_id: uint32;
}

// Explicit non-sequential enumeration copied over from tt-metal definition of
// `enum class MathFidelity`.
enum MathFidelity : uint8 {
LoFi = 0,
HiFi2 = 2,
HiFi3 = 3,
HiFi4 = 4,
LoFi = 0,
HiFi2 = 2,
HiFi3 = 3,
HiFi4 = 4,
}
28 changes: 14 additions & 14 deletions include/ttmlir/Target/TTMetal/program.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ include "Common/types.fbs";
namespace tt.target.metal;

enum NocIndex : ushort {
Noc0 = 0,
Noc1 = 1,
Noc0,
Noc1,
}

enum EthType : ushort {
Sender = 0,
Receiver = 1,
Sender,
Receiver,
}

enum UnpackToDestMode : uint8 {
UnpackToDestFp32 = 0,
Default = 1,
UnpackToDestFp32,
Default,
}

table NocConfig {
Expand Down Expand Up @@ -45,17 +45,17 @@ table KernelSource {
}

enum BinaryType : ushort {
BRISC = 0,
NCRISC = 1,
TRISC0 = 2,
TRISC1 = 3,
TRISC2 = 4,
ERISC = 5,
BRISC,
NCRISC,
TRISC0,
TRISC1,
TRISC2,
ERISC,
}

enum CoreType : ushort {
WORKER = 0,
ETH = 1,
WORKER,
ETH,
}

table KernelBinary {
Expand Down
86 changes: 43 additions & 43 deletions include/ttmlir/Target/TTNN/program.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -72,46 +72,46 @@ table ArangeOp {
}

enum EltwiseOpType: uint32 {
Add = 0,
Multiply = 1,
Subtract = 2,
Relu = 3,
GreaterEqual = 4,
Sqrt = 5,
Div = 6,
Sigmoid = 7,
Reciprocal = 8,
Exp = 9,
Maximum = 10,
Abs = 11,
Neg = 12,
Rsqrt = 13,
Typecast = 14,
Equal = 15,
NotEqual = 16,
LessEqual = 17,
LessThan = 18,
GreaterThan = 19,
LogicalAnd = 20,
LogicalOr = 21,
LogicalNot = 22,
Cbrt = 23,
Minimum = 24,
Ceil = 25,
Sin = 26,
Cos = 27,
Log = 28,
Log1p = 29,
Expm1 = 30,
Sign = 31,
Remainder = 32,
IsFinite = 33,
Floor = 34,
Where = 35,
Gelu = 36,
LogicalXor = 37,
Clamp = 38,
LeakyRelu = 39,
Add,
Multiply,
Subtract,
Relu,
GreaterEqual,
Sqrt,
Div,
Sigmoid,
Reciprocal,
Exp,
Maximum,
Abs,
Neg,
Rsqrt,
Typecast,
Equal,
NotEqual,
LessEqual,
LessThan,
GreaterThan,
LogicalAnd,
LogicalOr,
LogicalNot,
Cbrt,
Minimum,
Ceil,
Sin,
Cos,
Log,
Log1p,
Expm1,
Sign,
Remainder,
IsFinite,
Floor,
Where,
Gelu,
LogicalXor,
Clamp,
LeakyRelu,
}

table ClampOpParams {
Expand All @@ -136,9 +136,9 @@ table EltwiseOp {
}

enum ReductionOpType: uint32 {
Sum = 0,
Mean = 1,
Max = 2,
Sum,
Mean,
Max,
}

table ReductionOp {
Expand Down

0 comments on commit 0585abd

Please sign in to comment.