| 1 | //===-- IntelGPUTargetParser.h - Parser for Intel GPU targets ---*- C++ -*-===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file provides access to the Intel GPU list in IntelGPUTargetParser.def. |
| 10 | // Only what is needed to name the device a driver reports is declared here; the |
| 11 | // table itself carries more, and a consumer that needs the rest either declares |
| 12 | // it here as well or expands the table directly. |
| 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #ifndef LLVM_TARGETPARSER_INTELGPUTARGETPARSER_H |
| 17 | #define LLVM_TARGETPARSER_INTELGPUTARGETPARSER_H |
| 18 | |
| 19 | #include "llvm/ADT/StringRef.h" |
| 20 | #include "llvm/Support/Compiler.h" |
| 21 | #include <cstdint> |
| 22 | #include <string> |
| 23 | |
| 24 | namespace llvm { |
| 25 | namespace IntelGPU { |
| 26 | |
| 27 | /// Intel GPU architecture names, covering both physical devices and the |
| 28 | /// compatibility names that stand for a whole product line. |
| 29 | enum GPUKind : uint8_t { |
| 30 | GK_NONE = 0, |
| 31 | #define INTEL_GPU(NAME, KIND, MAJOR, MINOR, IGCA_TARGET, IGCA_FEATURE_SETS) \ |
| 32 | GK_##KIND, |
| 33 | #define INTEL_GPU_COMPAT(NAME, KIND, IGCA_TARGET, IGCA_FEATURE_SETS) GK_##KIND, |
| 34 | #include "llvm/TargetParser/IntelGPUTargetParser.def" |
| 35 | }; |
| 36 | |
| 37 | /// \return the device name that \p GPUIPVersion identifies, as reported by the |
| 38 | /// driver, e.g. "xe-pvc". If the table lists no such device, return an empty |
| 39 | /// string. Only the major and minor versions are looked at, so every revision |
| 40 | /// of a device resolves to the same name. |
| 41 | /// If several rows match, the first one in IntelGPUTargetParser.def wins. |
| 42 | LLVM_ABI StringRef getArchName(uint32_t GPUIPVersion); |
| 43 | |
| 44 | /// \return the numeric name of \p GPUIPVersion, e.g. "xe_35.11.0". |
| 45 | LLVM_ABI std::string getNumericArchName(uint32_t GPUIPVersion); |
| 46 | |
| 47 | } // namespace IntelGPU |
| 48 | } // namespace llvm |
| 49 | |
| 50 | #endif // LLVM_TARGETPARSER_INTELGPUTARGETPARSER_H |
| 51 | |