# autogenerated from AMD ISA XML - do not edit
from enum import Enum, auto

class ReprEnum(Enum):
  """Enum with clean repr that roundtrips with eval()."""
  def __repr__(self): return f"{type(self).__name__}.{self.name}"

class Fmt(Enum):
  FMT_ANY = auto()
  FMT_BUF = auto()
  FMT_IMG = auto()
  FMT_IMG_BVH = auto()
  FMT_NUM_B1 = auto()
  FMT_NUM_B1024 = auto()
  FMT_NUM_B128 = auto()
  FMT_NUM_B16 = auto()
  FMT_NUM_B256 = auto()
  FMT_NUM_B32 = auto()
  FMT_NUM_B512 = auto()
  FMT_NUM_B64 = auto()
  FMT_NUM_B8 = auto()
  FMT_NUM_B96 = auto()
  FMT_NUM_BF16 = auto()
  FMT_NUM_BF6 = auto()
  FMT_NUM_BF8 = auto()
  FMT_NUM_F16 = auto()
  FMT_NUM_F32 = auto()
  FMT_NUM_F64 = auto()
  FMT_NUM_FP4 = auto()
  FMT_NUM_FP6 = auto()
  FMT_NUM_FP8 = auto()
  FMT_NUM_I16 = auto()
  FMT_NUM_I24 = auto()
  FMT_NUM_I32 = auto()
  FMT_NUM_I4 = auto()
  FMT_NUM_I64 = auto()
  FMT_NUM_I8 = auto()
  FMT_NUM_IU4 = auto()
  FMT_NUM_IU8 = auto()
  FMT_NUM_M64 = auto()
  FMT_NUM_PK16_BF16 = auto()
  FMT_NUM_PK16_BF8 = auto()
  FMT_NUM_PK16_F16 = auto()
  FMT_NUM_PK16_F32 = auto()
  FMT_NUM_PK16_FP8 = auto()
  FMT_NUM_PK16_I32 = auto()
  FMT_NUM_PK16_I8 = auto()
  FMT_NUM_PK2_B16 = auto()
  FMT_NUM_PK2_B32 = auto()
  FMT_NUM_PK2_B64 = auto()
  FMT_NUM_PK2_BF16 = auto()
  FMT_NUM_PK2_BF8 = auto()
  FMT_NUM_PK2_F16 = auto()
  FMT_NUM_PK2_F32 = auto()
  FMT_NUM_PK2_FP4 = auto()
  FMT_NUM_PK2_FP8 = auto()
  FMT_NUM_PK2_I16 = auto()
  FMT_NUM_PK2_I8 = auto()
  FMT_NUM_PK2_U16 = auto()
  FMT_NUM_PK2_U8 = auto()
  FMT_NUM_PK32_BF16 = auto()
  FMT_NUM_PK32_BF6 = auto()
  FMT_NUM_PK32_BF8 = auto()
  FMT_NUM_PK32_F16 = auto()
  FMT_NUM_PK32_F32 = auto()
  FMT_NUM_PK32_FP6 = auto()
  FMT_NUM_PK32_FP8 = auto()
  FMT_NUM_PK32_I32 = auto()
  FMT_NUM_PK32_I8 = auto()
  FMT_NUM_PK4_B8 = auto()
  FMT_NUM_PK4_BF16 = auto()
  FMT_NUM_PK4_BF8 = auto()
  FMT_NUM_PK4_F16 = auto()
  FMT_NUM_PK4_F32 = auto()
  FMT_NUM_PK4_F64 = auto()
  FMT_NUM_PK4_FP8 = auto()
  FMT_NUM_PK4_I32 = auto()
  FMT_NUM_PK4_I8 = auto()
  FMT_NUM_PK4_IU8 = auto()
  FMT_NUM_PK4_U8 = auto()
  FMT_NUM_PK8_B32 = auto()
  FMT_NUM_PK8_BF16 = auto()
  FMT_NUM_PK8_BF8 = auto()
  FMT_NUM_PK8_F16 = auto()
  FMT_NUM_PK8_FP8 = auto()
  FMT_NUM_PK8_I4 = auto()
  FMT_NUM_PK8_I8 = auto()
  FMT_NUM_PK8_IU4 = auto()
  FMT_NUM_PK8_U4 = auto()
  FMT_NUM_PK8_U8 = auto()
  FMT_NUM_PK_F16 = auto()
  FMT_NUM_PK_I16 = auto()
  FMT_NUM_PK_I8 = auto()
  FMT_NUM_PK_U16 = auto()
  FMT_NUM_PK_U8 = auto()
  FMT_NUM_U16 = auto()
  FMT_NUM_U24 = auto()
  FMT_NUM_U32 = auto()
  FMT_NUM_U4 = auto()
  FMT_NUM_U64 = auto()
  FMT_NUM_U8 = auto()
  FMT_RSRC = auto()
  FMT_RSRC_SCALAR = auto()
  FMT_RSRC_SCRATCH = auto()
  FMT_RSRC_SCRATCH_BYTE = auto()
  FMT_RSRC_SCRATCH_STRIDE = auto()
  FMT_RSRC_TYPED = auto()
  FMT_RSRC_TYPED_BYTE = auto()
  FMT_RSRC_TYPED_SCRATCH = auto()
  FMT_RSRC_TYPED_STRIDE = auto()
  FMT_RSRC_VECTOR = auto()
  FMT_RSRC_VECTOR_BYTE = auto()
  FMT_RSRC_VECTOR_STRIDE = auto()
  FMT_SAMP = auto()
  FMT_WMMA_AB_16X16_BF16 = auto()
  FMT_WMMA_AB_16X16_BF8 = auto()
  FMT_WMMA_AB_16X16_F16 = auto()
  FMT_WMMA_AB_16X16_FP8 = auto()
  FMT_WMMA_AB_16X16_IU4 = auto()
  FMT_WMMA_AB_16X16_IU8 = auto()
  FMT_WMMA_AB_16X32_BF16 = auto()
  FMT_WMMA_AB_16X32_BF8 = auto()
  FMT_WMMA_AB_16X32_F16 = auto()
  FMT_WMMA_AB_16X32_FP8 = auto()
  FMT_WMMA_AB_16X32_IU4 = auto()
  FMT_WMMA_AB_16X32_IU8 = auto()
  FMT_WMMA_AB_16X64_IU4 = auto()
  FMT_WMMA_AB_BF16 = auto()
  FMT_WMMA_AB_F16 = auto()
  FMT_WMMA_AB_IU4 = auto()
  FMT_WMMA_AB_IU8 = auto()
  FMT_WMMA_DC_16X16_BF16 = auto()
  FMT_WMMA_DC_16X16_F16 = auto()
  FMT_WMMA_DC_16X16_F32 = auto()
  FMT_WMMA_DC_16X16_I32 = auto()
  FMT_WMMA_DC_BF16 = auto()
  FMT_WMMA_DC_F16 = auto()
  FMT_WMMA_DC_F32 = auto()
  FMT_WMMA_DC_I32 = auto()
  FMT_WMMA_INDEX_SET = auto()

FMT_BITS = {
  Fmt.FMT_ANY: 1,
  Fmt.FMT_BUF: 64,
  Fmt.FMT_IMG: 256,
  Fmt.FMT_IMG_BVH: 128,
  Fmt.FMT_NUM_B1: 1,
  Fmt.FMT_NUM_B1024: 1024,
  Fmt.FMT_NUM_B128: 128,
  Fmt.FMT_NUM_B16: 16,
  Fmt.FMT_NUM_B256: 256,
  Fmt.FMT_NUM_B32: 32,
  Fmt.FMT_NUM_B512: 512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_RSRC_SCRATCH_BYTE: 128,
  Fmt.FMT_RSRC_SCRATCH_STRIDE: 128,
  Fmt.FMT_RSRC_TYPED: 128,
  Fmt.FMT_RSRC_TYPED_BYTE: 128,
  Fmt.FMT_RSRC_TYPED_SCRATCH: 128,
  Fmt.FMT_RSRC_TYPED_STRIDE: 128,
  Fmt.FMT_RSRC_VECTOR: 128,
  Fmt.FMT_RSRC_VECTOR_BYTE: 128,
  Fmt.FMT_RSRC_VECTOR_STRIDE: 128,
  Fmt.FMT_SAMP: 128,
  Fmt.FMT_WMMA_AB_16X16_BF16: 128,
  Fmt.FMT_WMMA_AB_16X16_BF8: 64,
  Fmt.FMT_WMMA_AB_16X16_F16: 128,
  Fmt.FMT_WMMA_AB_16X16_FP8: 64,
  Fmt.FMT_WMMA_AB_16X16_IU4: 32,
  Fmt.FMT_WMMA_AB_16X16_IU8: 64,
  Fmt.FMT_WMMA_AB_16X32_BF16: 256,
  Fmt.FMT_WMMA_AB_16X32_BF8: 128,
  Fmt.FMT_WMMA_AB_16X32_F16: 256,
  Fmt.FMT_WMMA_AB_16X32_FP8: 128,
  Fmt.FMT_WMMA_AB_16X32_IU4: 64,
  Fmt.FMT_WMMA_AB_16X32_IU8: 128,
  Fmt.FMT_WMMA_AB_16X64_IU4: 128,
  Fmt.FMT_WMMA_AB_BF16: 256,
  Fmt.FMT_WMMA_AB_F16: 256,
  Fmt.FMT_WMMA_AB_IU4: 64,
  Fmt.FMT_WMMA_AB_IU8: 128,
  Fmt.FMT_WMMA_DC_16X16_BF16: 128,
  Fmt.FMT_WMMA_DC_16X16_F16: 128,
  Fmt.FMT_WMMA_DC_16X16_F32: 256,
  Fmt.FMT_WMMA_DC_16X16_I32: 256,
  Fmt.FMT_WMMA_DC_BF16: 256,
  Fmt.FMT_WMMA_DC_F16: 256,
  Fmt.FMT_WMMA_DC_F32: 256,
  Fmt.FMT_WMMA_DC_I32: 256,
  Fmt.FMT_WMMA_INDEX_SET: 32,
}

class OpType(Enum):
  OPR_ACCVGPR = auto()
  OPR_ATTR = auto()
  OPR_CLAUSE = auto()
  OPR_DELAY = auto()
  OPR_EXEC = auto()
  OPR_HWREG = auto()
  OPR_LABEL = auto()
  OPR_SDST = auto()
  OPR_SDST_NULL = auto()
  OPR_SENDMSG = auto()
  OPR_SENDMSG_RTN = auto()
  OPR_SIMM16 = auto()
  OPR_SIMM24 = auto()
  OPR_SIMM4 = auto()
  OPR_SIMM5 = auto()
  OPR_SIMM8 = auto()
  OPR_SLEEP = auto()
  OPR_SMEM_OFFSET = auto()
  OPR_SMEM_OFFSET_NOK = auto()
  OPR_SRC = auto()
  OPR_SRC_ACCVGPR = auto()
  OPR_SRC_NOLDS = auto()
  OPR_SRC_NOLIT = auto()
  OPR_SRC_SIMPLE = auto()
  OPR_SRC_VGPR = auto()
  OPR_SRC_VGPR_OR_ACCVGPR = auto()
  OPR_SRC_VGPR_OR_ACCVGPR_OR_CONST = auto()
  OPR_SRC_VGPR_OR_INLINE = auto()
  OPR_SREG = auto()
  OPR_SREG_LITERAL = auto()
  OPR_SREG_M0 = auto()
  OPR_SREG_M0_INL = auto()
  OPR_SREG_NOVCC = auto()
  OPR_SSRC = auto()
  OPR_SSRC_BARRIER_ID = auto()
  OPR_SSRC_LANESEL = auto()
  OPR_SSRC_NOLIT = auto()
  OPR_TGT = auto()
  OPR_VERSION = auto()
  OPR_VGPR = auto()
  OPR_VGPR_OR_ACCVGPR = auto()
  OPR_VGPR_OR_LDS = auto()
  OPR_WAITCNT = auto()
  OPR_WAITCNT_DEPCTR = auto()
  OPR_WAIT_ALU = auto()
  OPR_WAIT_EVENT = auto()
  OPR_WAIT_MEM_DS = auto()