File: PlatformInfo.h

package info (click to toggle)
intel-graphics-compiler2 2.28.4-3
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 792,656 kB
  • sloc: cpp: 5,761,745; ansic: 466,928; lisp: 312,143; python: 114,790; asm: 44,736; pascal: 10,930; sh: 8,033; perl: 7,914; ml: 3,625; awk: 3,523; yacc: 2,747; javascript: 2,667; lex: 1,898; f90: 1,028; cs: 573; xml: 474; makefile: 344; objc: 162
file content (115 lines) | stat: -rw-r--r-- 4,090 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*========================== begin_copyright_notice ============================

Copyright (C) 2022 Intel Corporation

SPDX-License-Identifier: MIT

============================= end_copyright_notice ===========================*/

#ifndef _PLATFORMINFO_H_
#define _PLATFORMINFO_H_

#include "G4_Opcode.h"
#include "common.h"

namespace vISA {

class PlatformInfo {
private:
  static const PlatformInfo ALL_PLATFORMS[];
  static const char *kUnknownPlatformStr;

public:
  TARGET_PLATFORM platform;
  PlatformGen family;
  int encoding;
  unsigned char grfSize;
  const char *symbols[8];

  constexpr PlatformInfo(TARGET_PLATFORM p, PlatformGen f, int enc,
                         unsigned char grf_size, const char *str0,
                         const char *str1 = nullptr, const char *str2 = nullptr,
                         const char *str3 = nullptr, const char *str4 = nullptr)
      : platform(p), family(f), encoding(enc),
        grfSize(grf_size), symbols{str0, str1, str2, str3, str4, nullptr} {}

  template <G4_Type T> unsigned numEltPerGRF() const {
    vASSERT(grfSize == 32 || grfSize == 64);
    if (grfSize == 64)
      return 64 / TypeSize(T);
    return 32 / TypeSize(T);
  }
  unsigned numEltPerGRF(G4_Type t) const { return grfSize / TypeSize(t); }

  unsigned getMaxVariableSize() const { return 256 * grfSize; }

  G4_SubReg_Align getGRFAlign() const {
    vASSERT(grfSize == 32 || grfSize == 64);
    return grfSize == 64 ? ThirtyTwo_Word : Sixteen_Word;
  }

  G4_SubReg_Align getHalfGRFAlign() const {
    vASSERT(grfSize == 32 || grfSize == 64);
    return grfSize == 64 ? Sixteen_Word : Eight_Word;
  }

  unsigned getGenxDataportIOSize() const {
    vASSERT(grfSize == 32 || grfSize == 64);
    return grfSize == 64 ? 16 : 8;
  }

  unsigned getGenxSamplerIOSize() const { return getGenxDataportIOSize(); }

  // The max number of named barriers allowed
  unsigned getMaxNumOfBarriers() const {
    if (platform >= Xe_PVC)
      return 32;
    // Set the number to 8 for pre-PVC now to align with IGC.
    return 8;
  }

  const char *getGenxPlatformString() const;

  /*************** internal jitter functions ********************/
  static const PlatformInfo *LookupPlatformInfo(TARGET_PLATFORM p);

  // currently the supported arguments are listed in the common.cpp table
  // generally the symbol suffix is the preferred name:
  //   e.g. GENX_SKL  means "SKL"
  //             ^^^
  static TARGET_PLATFORM getVisaPlatformFromStr(const char *platformName);

  // returns an array of all supported platforms
  static const TARGET_PLATFORM *getGenxAllPlatforms(int *num);

  static const char *getGenxPlatformString(TARGET_PLATFORM);

  // returns nullptr terminated array of strings that can be parsed
  // for the platform name
  static const char *const *getGenxPlatformStrings(TARGET_PLATFORM);

  // returns the vISA encoding bits for encoding
  // NOTE: encoding values are not necessarily in order
  static int getGenxPlatformEncoding(TARGET_PLATFORM platform);

  // return the platform generation that can be used for comparison
  static PlatformGen getPlatformGeneration(TARGET_PLATFORM platform);
}; // PlatformInfo

template unsigned PlatformInfo::numEltPerGRF<Type_UD>() const;
template unsigned PlatformInfo::numEltPerGRF<Type_D>() const;
template unsigned PlatformInfo::numEltPerGRF<Type_UW>() const;
template unsigned PlatformInfo::numEltPerGRF<Type_W>() const;
template unsigned PlatformInfo::numEltPerGRF<Type_UB>() const;
template unsigned PlatformInfo::numEltPerGRF<Type_B>() const;
template unsigned PlatformInfo::numEltPerGRF<Type_F>() const;
template unsigned PlatformInfo::numEltPerGRF<Type_VF>() const;
template unsigned PlatformInfo::numEltPerGRF<Type_V>() const;
template unsigned PlatformInfo::numEltPerGRF<Type_DF>() const;
template unsigned PlatformInfo::numEltPerGRF<Type_BOOL>() const;
template unsigned PlatformInfo::numEltPerGRF<Type_UV>() const;
template unsigned PlatformInfo::numEltPerGRF<Type_Q>() const;
template unsigned PlatformInfo::numEltPerGRF<Type_UQ>() const;
} // namespace vISA

#endif // _PLATFORMINFO_H_