File: OpenCLOptions.hpp

package info (click to toggle)
intel-graphics-compiler 1.0.17791.18-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 102,312 kB
  • sloc: cpp: 935,343; lisp: 286,143; ansic: 16,196; python: 3,279; yacc: 2,487; lex: 1,642; pascal: 300; sh: 174; makefile: 27
file content (200 lines) | stat: -rw-r--r-- 8,095 bytes parent folder | download
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/*========================== begin_copyright_notice ============================

Copyright (C) 2023 Intel Corporation

SPDX-License-Identifier: MIT

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

#include "AdaptorOCL/TranslationBlock.h"
#include <optional>
#include <vector>
#include <string>

// We should probably replace all of this with proper option parsing,
// like RS does
namespace IGC {
class InternalOptions
{
public:
    InternalOptions(const TC::STB_TranslateInputArgs* pInputArgs)
    {
        if (pInputArgs == nullptr)
            return;

        if (pInputArgs->pInternalOptions != nullptr)
        {
            parseOptions(pInputArgs->pInternalOptions);
        }
    }

    bool KernelDebugEnable                          = false;
    bool IncludeSIPCSR                              = false;
    bool IncludeSIPKernelDebug                      = false;
    bool IntelGreaterThan4GBBufferRequired          = false;
    bool IntelDisableA64WA                          = false;
    bool IntelForceEnableA64WA                      = false;
    bool Use32BitPtrArith                           = false;
    bool IncludeSIPKernelDebugWithLocalMemory       = false;

    // stateless to stateful optimization
    bool IntelHasPositivePointerOffset              = false;
    bool IntelHasBufferOffsetArg                    = false;
    bool IntelBufferOffsetArgOptional               = true;

    bool replaceGlobalOffsetsByZero                 = false;
    bool IntelEnablePreRAScheduling                 = true;
    bool PromoteStatelessToBindless                 = false;
    bool PreferBindlessImages                       = false;
    bool UseBindlessMode                            = false;
    bool UseBindlessPrintf                          = false;
    bool UseBindlessLegacyMode                      = true;
    bool ExcludeIRFromZEBinary                      = false;
    bool EmitZeBinVISASections                      = false;
    bool NoSpill                                    = false;
    bool DisableNoMaskWA                            = false;
    bool IgnoreBFRounding                           = false;   // If true, ignore BFloat rounding when folding bf operations
    bool CompileOneKernelAtTime                     = false;

    // Generic address related
    bool ForceGlobalMemoryAllocation                = false;

    // -1 : initial value that means it is not set from cmdline
    // 0-5: valid values set from the cmdline
    int16_t VectorCoalescingControl                 = -1;

    bool Intel128GRFPerThread                       = false;
    bool Intel256GRFPerThread                       = false;
    bool IntelNumThreadPerEU                        = false;
    int32_t numThreadsPerEU                         = -1;

    bool IntelExpGRFSize                            = false;
    uint32_t expGRFSize                             = 0;
     bool IntelEnableAutoLargeGRF = false;

     // IntelForceInt32DivRemEmu is used only if fp64 is supported natively.
     // IntelForceInt32DivRemEmu wins if both are set and can be applied.
     bool IntelForceInt32DivRemEmu                   = false;
     bool IntelForceInt32DivRemEmuSP                 = false;
     bool IntelForceDisable4GBBuffer                 = false;
     // user-controled option to disable EU Fusion
     bool DisableEUFusion                            = false;
     // Function Control (same as IGC key FunctionControl)
     int FunctionControl                             = -1;
     // Fail comilation if spills are present in compiled kernel
     bool FailOnSpill                                = false;
     // This option enables FP64 emulation for platforms that
     // cannot HW support for double operations
     bool EnableFP64GenEmu                           = false;
     // Cache default. -1 menans not set (thus not used by igc);
     // Valid values are defined as enum type LSC_L1_L3_CC in
     //   visa\include\visa_igc_common_header.h, which are from
     //   macro definitions in igc\common\igc_regkeys_enums_defs.h
     int StoreCacheDefault                           = -1;
     int LoadCacheDefault                            = -1;
     // Force high-accuracy math functions from BiFModule
     bool UseHighAccuracyMathFuncs                   = false;

     bool AllowRelocAdd                              = true;
     // LdStCombine
     //   EnableLdStCombine:
     //      0: disable LdStCombine
     //      1: enable LdStCombine for LSC
     //      2: enable LdStCombine for LSC and Non-LSC
     //      otherwise: ignored
     //   MaxStoreBytes:
     //   MaxLoadBytes:
     //     4, 8, 16, 32 : set max bytes for combining
     //     otherwise: ignored.
     int LdStCombine                                 = -1; // default
     uint32_t MaxStoreBytes                          = 0;  // default
     uint32_t MaxLoadBytes                           = 0;  // default

     uint32_t IntelPrivateMemoryMinimalSizePerThread = 0;
     uint32_t IntelScratchSpacePrivateMemoryMinimalSizePerThread = 0;

     bool EnableDivergentBarrierHandling             = false;
     bool DisableZEBinary                            = false;
     bool EnableBufferBoundsChecking                 = false;

     // Compile only up to vISA stage.
     bool EmitVisaOnly                               = false;


    uint64_t MinimumValidAddress              = 0;

private:
     void parseOptions(const char* internalOpts);
     };

class Options
{
public:
    Options(const TC::STB_TranslateInputArgs* pInputArgs)
    {
        if (pInputArgs == nullptr)
            return;

        if (pInputArgs->pOptions != nullptr)
        {
            parseOptions(pInputArgs->pOptions);
        }
    }

    bool CorrectlyRoundedSqrt               = false;
    bool NoSubgroupIFP                      = false;
    bool UniformWGS                         = false;
    bool EnableTakeGlobalAddress            = false;
    bool IsLibraryCompilation               = false;
    uint32_t LibraryCompileSIMDSize         = 0;
    bool IntelRequiredEUThreadCount         = false;
    bool EmitErrorsForLibCompilation        = false;
    uint32_t requiredEUThreadCount          = 0;

    bool GTPinReRA                          = false;
    bool GTPinGRFInfo                       = false;
    bool GTPinScratchAreaSize               = false;
    bool GTPinIndirRef                      = false;
    // Skip emission of Frame Descriptor Entry in VISA.
    bool SkipFDE                            = false;
    bool NoFusedCallWA                      = false;
    bool DisableCompaction                  = false;
    uint32_t GTPinScratchAreaSizeValue      = 0;

    std::vector<std::string> LargeGRFKernels;
    std::vector<std::string> RegularGRFKernels;

    bool Xfinalizer                         = false;
    std::string XfinalizerOption;

       // Enable compiler heuristics ("-autoGRFSelection" in VISA) for large GRF selection.
    bool IntelEnableAutoLargeGRF            = false;

    bool IntelLargeRegisterFile             = false;

    bool Intel128GRFPerThread               = false;
    bool Intel256GRFPerThread               = false;
    bool IntelGreaterThan4GBBufferRequired  = false;

    bool IntelExpGRFSize                    = false;
    uint32_t expGRFSize                     = 0;

    // Generic address related
    bool NoLocalToGeneric                   = false;

    // This option forces IGC to poison kernels using fp64
    // operations on platforms without HW support for fp64.
    bool EnableUnsupportedFP64Poisoning = false;
    // This option enables FP64 emulation for platforms that
    // cannot HW support for double operations
    bool EnableFP64GenEmu = false;
    // This option enables FP64 emulation for conversions
    // This applies to platforms that cannot HW support for double operations
    bool EnableFP64GenConvEmu = false;
    // This option enables static profile-guided trimming
    bool StaticProfileGuidedTrimming = false;

private:
    void parseOptions(const char* opts);
};
} // namespace IGC