[Mlir-commits] [mlir] [mlir] Target Description and Cost Model in MLIR (PR #85141)

Mehdi Amini llvmlistbot at llvm.org
Wed Mar 13 19:34:09 PDT 2024


================
@@ -0,0 +1,514 @@
+//===- SYSTEMDESC.h - class to represent hardware configuration --*- C++
+//-*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+// Hardware configuration provides commonly used hardware information to
+// different users, such as optimization passes.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_SUPPORT_SYSTEMDESC_H
+#define MLIR_SUPPORT_SYSTEMDESC_H
+
+#include <map>
+#include <memory>
+#include <vector>
+
+#include "mlir/IR/MLIRContext.h"
+#include "mlir/Support/FileUtilities.h"
+#include "mlir/Support/LogicalResult.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/JSON.h"
+
+/// Sytem description file contains a list of device descriptions that
+/// each describe a device (e.g., CPU, GPU, ASIC, etc.) in the system.
+/// Example:
+/// [
+///  {
+///    "ID": 1,
+///    "TYPE": "CPU",
+///    "DESCRIPTION": "Intel Xeon 8480",
+///    "L1_CACHE_SIZE_IN_BYTES": 8192,
+///    ...
+///  },
+///  {
+///
+///  },
+///  ...
+/// ]
+namespace mlir {
+
+/// Describes the individual device from the system description
+class DeviceDesc {
+public:
+  /// Some typedefs
+  using DeviceID = uint32_t;
+  using DevicePropertyName = std::string;
+  struct DevicePropertyValue {
+    enum Tag { INT, DOUBLE, INT_VECTOR, DOUBLE_VECTOR } tag;
----------------
joker-eph wrote:

Seems to me like re-inventing the attributes in MLIR: what am I missing? Why wouldn't the attribute structure be already flexible enough here?

https://github.com/llvm/llvm-project/pull/85141


More information about the Mlir-commits mailing list