/*===================== begin_copyright_notice ==================================

Copyright (c) 2017 Intel Corporation

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


======================= end_copyright_notice ==================================*/
DECLARE_IGC_GROUP("VISA optimization")
DECLARE_IGC_REGKEY(bool, DisableSendS,                  false, "Setting this to 1/true adds a compiler switch to not generate sends commands, default is to enable sends ")
DECLARE_IGC_REGKEY(bool, EnablePreemption,              true,  "Enable generating preeemptable code (SKL+)")
DECLARE_IGC_REGKEY(bool, EnableVISANoSchedule,          false, "Enable VISA No-Schedule")
DECLARE_IGC_REGKEY(bool, EnableVISAPreSched,            true,  "Enable VISA Pre-RA Scheduler")
DECLARE_IGC_REGKEY(DWORD, VISAPreSchedCtrl,             0,     "Configure Pre-RA Scheduler, default(0), logging(1), latency(2), pressure(4)")
DECLARE_IGC_REGKEY(bool, ForceVISAPreSched,             false, "Force enabling of VISA Pre-RA Scheduler")
DECLARE_IGC_REGKEY(DWORD, VISAPreSchedRPThreshold,      0,     "Configure how aggressive pre-RA Scheduler is, 0 for the default")
DECLARE_IGC_REGKEY(bool, DisableCSEL,                   false, "disable csel peep-hole")
DECLARE_IGC_REGKEY(bool, DisableFlagOpt,                false, "Disable optimization cmp with logic op")
DECLARE_IGC_REGKEY(bool, DisableIfCvt,                  false, "Disable ifcvt")
DECLARE_IGC_REGKEY(bool, EnableVISANoBXMLEncoder,       false, "Enable VISA No-BXML encoder")
DECLARE_IGC_REGKEY(bool, EnableIGAEncoder,              false, "Enable VISA IGA encoder")
DECLARE_IGC_REGKEY(bool, EnableVISADumpCommonISA,       false, "Enable VISA Dump Common ISA")
DECLARE_IGC_REGKEY(bool, EnableVISABinary,              false, "Enable VISA Binary")
DECLARE_IGC_REGKEY(bool, EnableVISAOutput,              false, "Enable VISA GenISA output")
DECLARE_IGC_REGKEY(bool, EnableVISASlowpath,            false, "Enable VISA Slowpath. Needed to dump .visaasm")
DECLARE_IGC_REGKEY(bool, EnableVISADotAll,              false, "Enable VISA DotAll. Dumps dot files for intermediate stages")
DECLARE_IGC_REGKEY(bool, EnableVISADebug,               false, "Runs VISA in debug mode, all optimizations disabled")
DECLARE_IGC_REGKEY(DWORD, EnableVISAStructurizer,       1,     "Enable/Disable VISA structurizer. See value defs in igc_flags.hpp.")
DECLARE_IGC_REGKEY(bool, EnableVISAJmpi,                true,  "Enable/Disable VISA generating jmpi (scalar jump).")
DECLARE_IGC_REGKEY(DWORD,UnifiedSendCycle,              0,     "Using unified send cycle.")
DECLARE_IGC_REGKEY(DWORD,DisableMixMode,                0,     "Disables mix mode in vISA BE.")
DECLARE_IGC_REGKEY(DWORD,DisableHFMath,                 0,     "Disables HF math instructions.")
DECLARE_IGC_REGKEY(debugString, VISAOptions,            0,     "Options to vISA. Space-separated options.")
DECLARE_IGC_REGKEY(DWORD,disableIGASyntax,              false, "Disables GEN isa text output using IGA and new syntax.")
DECLARE_IGC_REGKEY(DWORD,disableCompaction,             false, "Disables compaction.")
DECLARE_IGC_REGKEY(DWORD,TotalGRFNum,                   0,     "Total GRF used for register allocation.")
DECLARE_IGC_REGKEY(DWORD,ReservedRegisterNum,           0,     "Reserve regsiter number for spill cost testing.")
DECLARE_IGC_REGKEY(DWORD, GRFNumToUse,                  0,     "Set the number of general registers to use (64 to totalGRFNum)")
DECLARE_IGC_REGKEY(bool, ExpandPlane,                   0,     "Enable pln to mad macro expansion.")
DECLARE_IGC_REGKEY(bool, EnableBCR,                     false,  "Enable bank conflict reduction.")
DECLARE_IGC_REGKEY(bool, GlobalSendVarSplit, false, "Enable global send variable splitting when we are about to spill")
DECLARE_IGC_REGKEY(DWORD,EnableSendFusion,              1,     "Enable(!=0)/disable(0)/force(2) send fusion. Valid for simd8 shader/kernel only.")
DECLARE_IGC_REGKEY(bool, EnableAtomicFusion,            false, "To enable/disable atomic send fusion (simd8 shaders). Valid if EnableSendFusion is on.")
DECLARE_IGC_REGKEY(bool, Use16ByteBindlessSampler,      false, "True if 16-byte aligned bindless sampler state is used")

DECLARE_IGC_GROUP("IGC Optimization")
DECLARE_IGC_REGKEY(bool, DisableIGCOptimizations,       false, "Setting this to 1/true adds a compiler switch to disables all the above IGC optimizations")
DECLARE_IGC_REGKEY(bool, DisableLLVMGenericOptimizations, false, "Disable LLVM generic optimization passes")
DECLARE_IGC_REGKEY(bool, DisableCodeSinking,            false, "Setting this to 1/true adds a compiler switch to disable code-sinking")
DECLARE_IGC_REGKEY(DWORD, LoopSinkMinSave,              5,  "If loop sink can have save more than this Minimum, do it; otherwise, skip")
DECLARE_IGC_REGKEY(DWORD, LoopSinkThresholdDelta,       50,  "Do loop sink If the estimated register pressure is higher than this + #avaialble registers")
DECLARE_IGC_REGKEY(bool, DisableCodeHoisting,           false, "Setting this to 1/true adds a compiler switch to disable code-hoisting")
DECLARE_IGC_REGKEY(bool, DisableDeSSA,                  false, "Setting this to 1/true adds a compiler switch to disable optimized De-SSA")
DECLARE_IGC_REGKEY(bool, EnableDeSSAWA,                 false,  "[tmp]Keep some piece of code to avoid perf regression")
DECLARE_IGC_REGKEY(DWORD, EnableDeSSAAlias,             0, "[tmp]Enable adding alias feature to DeSSA (using PrefCCMap, not InsEltMap")
DECLARE_IGC_REGKEY(bool, DisablePayloadCoalescing,      false, "Setting this to 1/true adds a compiler switch to disable payload coalescing optimization for all types")
DECLARE_IGC_REGKEY(bool, DisablePayloadCoalescing_RT,   false, "Setting this to 1/true adds a compiler switch to disable payload coalescing optimization for RT only")
DECLARE_IGC_REGKEY(bool, DisablePayloadCoalescing_Sample, false, "Setting this to 1/true adds a compiler switch to disable payload coalescing optimization for Samplers only")
DECLARE_IGC_REGKEY(bool, DisablePayloadCoalescing_URB,  false, "Setting this to 1/true adds a compiler switch to disable payload coalescing optimization for URB writes only")
DECLARE_IGC_REGKEY(bool, DisableUniformAnalysis,        false, "Setting this to 1/true adds a compiler switch to disable uniform_analysis")
DECLARE_IGC_REGKEY(DWORD, DisablePushConstant,           0, "Bit mask to disable push constant per shader stages. bit0 = All, Bit 1 = VS, Bit 2 = HS, Bit 3 = DS, Bit 4 = GS, Bit 5 = PS")
DECLARE_IGC_REGKEY(DWORD, DisableAttributePush,          0, "Bit mask to disable push Attribute per shader stages. bit0 = All, Bit 1 = VS, Bit 2 = HS, Bit 3 = DS, Bit 4 = GS")
DECLARE_IGC_REGKEY(bool, DisableSimplePushWithDynamicUniformBuffers, false,"Disable Simple Push Constants Optimization for dynamic uniform buffers.")
DECLARE_IGC_REGKEY(int, forcePushConstantMode,  0, "set the push constant mode, 0 is default, 1 is simple push, 2 is gather constant")
DECLARE_IGC_REGKEY(bool, DisableConstantCoalescing,     false, "Setting this to 1/true adds a compiler switch to disable constant coalesing")
DECLARE_IGC_REGKEY(bool, DisableURBWriteMerge,          false, "Setting this to 1/true adds a compiler switch to disable URB write merge")
DECLARE_IGC_REGKEY(bool, DisableEmptyBlockRemoval,      false, "Setting this to 1/true adds a compiler switch to disable empty block optimization")
DECLARE_IGC_REGKEY(bool, DisableSIMD32Slicing,          false, "Setting this to 1/true adds a compiler switch to disable emitting SIMD32 VISA code in slices")
DECLARE_IGC_REGKEY(bool, DisableMatchMad,               false, "Setting this to 1/true adds a compiler switch to disable mul+add = mad optimization")
DECLARE_IGC_REGKEY(bool, DisableMatchPow,               false, "Setting this to 1/true adds a compiler switch to disable log2/mul/exp2 = pow optimization")
DECLARE_IGC_REGKEY(bool, DisableIRVerification,         false, "Setting this to 1/true adds a compiler switch to disable IGC IR verification.")
DECLARE_IGC_REGKEY(bool, DisableLoopUnroll,             false, "Setting this to 1/true adds a compiler switch to disable loop unrolling.")
DECLARE_IGC_REGKEY(bool, DisableRuntimeLoopUnrolling,   false, "Setting this to 1/true adds a compiler switch to disable runtime loop unrolling.")
DECLARE_IGC_REGKEY(DWORD,SetLoopUnrollThreshold,        0,     "Set the loop unroll threshold. Value 0 will use the default threshold.")
DECLARE_IGC_REGKEY(debugString, LLVMCommandLine,        0,     "applies LLVM command line")
DECLARE_IGC_REGKEY(bool, DisableDX9LowPrecision,        true,  "Disables HF in DX9.")
DECLARE_IGC_REGKEY(bool, EnablePingPongTextureOpt,      true,  "Enables the Ping Pong texture optimization which is used only for Compute Shaders for back to back dispatches")
DECLARE_IGC_REGKEY(bool, EnableSamplerChannelReturn,    true,  "Setting this to 1/true adds a compiler switch to enable using header to return selective channels from sampler")
DECLARE_IGC_REGKEY(bool, EnableThreadCombiningOpt,      true,  "Enables the thread combining optimization which is used only for Compute Shaders for combining a number of software threads to dispatch smaller number of hardware threads")
DECLARE_IGC_REGKEY(bool, DisablePromotePrivMem,         false, "Setting this to 1/true adds a compiler switch to disable IGC private array promotion")
DECLARE_IGC_REGKEY(bool, EnableSimplifyGEP,             true,  "Enable IGC to simplify indices expr of GEP.")
DECLARE_IGC_REGKEY(bool, DisableCustomUnsafeOpt,        false, "Disable IGC to run custom unsafe optimizations")
DECLARE_IGC_REGKEY(bool, EnableFastMath,                false, "Enable fast math optimizations in IGC")
DECLARE_IGC_REGKEY(bool, DisableFlattenSmallSwitch,     false, "Disable the flatten small switch pass")
DECLARE_IGC_REGKEY(bool, DisableImmConstantOpt,         false, "Disable IGC IndirectICBPropagaion optimization")
DECLARE_IGC_REGKEY(DWORD,MaxImmConstantSizePushed,      256,   "Set the max size of immediate constant buffer pushed")
DECLARE_IGC_REGKEY(bool, EnableCustomLoopVersioning,    true,  "Enable IGC to do custom loop versioning")
DECLARE_IGC_REGKEY(bool, DisableMCSOpt,                 false,  "Disable IGC to run MCS optimization")
DECLARE_IGC_REGKEY(bool, DisableGatingSimilarSamples,   false,  "Disable Gating of similar sample instructions")
DECLARE_IGC_REGKEY(bool, EnableSoftwareVertexFetch,     false, "Enable software vertex fetch for VS.")
DECLARE_IGC_REGKEY(bool, EnableSoftwareStencil,         false, "Enable software stencil for PS.")
DECLARE_IGC_REGKEY(bool, EnableSumFractions,            false, "Enable SumFractions optimization in CustomUnsafeOptPass.")
DECLARE_IGC_REGKEY(bool, EnableExtractCommonMultiplier, false, "Enable ExtractCommonMultiplier optimization in CustomUnsafeOptPass.")
DECLARE_IGC_REGKEY(bool, EnablePowToLogMulExp,          false, "Enable pow to exp(log(x)*y) optimization in CustomUnsafeOptPass.")
DECLARE_IGC_REGKEY(bool, DisablePullConstantHeuristics, true, "Disable the heuristics to determine the no. push constants based on payload size.")
DECLARE_IGC_REGKEY(DWORD,PayloadSizeThreshold,          11,    "Set the max payload size threshold for short shades that have PSD bottleneck.")
DECLARE_IGC_REGKEY(bool, PSSIMD32HeuristicFP16, true, "enable PS SIMD32 heuristic based on fp16 characteristic ")
DECLARE_IGC_REGKEY(bool, PSSIMD32HeuristicLoopAndDiscard, true, "enable PS SIMD32 heuristic based on loop info and discard")
DECLARE_IGC_REGKEY(bool, EnableBlendToDiscard,          true,  "Enable blend to discard based on blend state.")
DECLARE_IGC_REGKEY(bool, EnableBlendToFill,             true,  "Enable blend to fill based on blend state.")
DECLARE_IGC_REGKEY(bool, UseTiledCSThreadOrder,         true,  "Use 4x4 disaptch for CS order when it seems beneficial")
DECLARE_IGC_REGKEY(bool, EnableSLMConstProp,            true,   "Enable SLM constant propagation (compute shader only).")
DECLARE_IGC_REGKEY(bool, EnableStatelessToStatefull,    true,  "Enable Stateless To Statefull transformation for global and constant address space in OpenCL kernels")
DECLARE_IGC_REGKEY(bool, EnableStatefulToken,           true,  "Enable generating patch token to indicate a ptr argument is fully converted to stateful (temporary)")
DECLARE_IGC_REGKEY(bool, EnableGenUpdateCB,             false, "Enable derived constant optimization.")
DECLARE_IGC_REGKEY(bool, EnableGenUpdateCBResInfo,      false, "Enable derived constant optimization with resinfo.")
DECLARE_IGC_REGKEY(bool, EnableHighestSIMDForNoSpill,   false,   "When there is no spill choose highest SIMD (compute shader only).")
DECLARE_IGC_REGKEY(DWORD,FoldsToZeroPropThreshold,      1,     "Set the threshold for finding interesting constant. This is for the number of instructions that gets folded to zero when propagating a dynamic constant value")
DECLARE_IGC_REGKEY(DWORD,FoldsToConstPropThreshold,     1,     "Set the threshold for finding interesting constant. This is for the number of instructions that gets folded to constant or gets simplified incase of select instruction, when propagating a dynamic constant value")
DECLARE_IGC_REGKEY(DWORD,FoldsToSourceThreshold,        1,     "Set the threshold for finding interesting constant. This is for the number of instructions that translate to a mov. i.e., Multiplication or Division by 1")
DECLARE_IGC_REGKEY(bool, DisableDynamicConstantFolding, false,  "Disable Dynamic Constant Folding")
DECLARE_IGC_REGKEY(bool, DisableDynamicTextureFolding,  false,  "Disable Dynamic Texture Folding")
DECLARE_IGC_REGKEY(bool, DisableRectListOpt,            false, "Disable Rect List optimization")

DECLARE_IGC_REGKEY(bool, DispatchOCLWGInLinearOrder,    false, "If set, dispatch HW threads based on the linearized order of WI in a WG; \
                                                                ie, let localSize=(lx, ly, lz), localId=(ix, iy, iz). And \
                                                                   linearLocalId = ix + lx * (iy + ly * iz); \
                                                                And linear order means that \
                                                                   linearLocalId(lane[x+1])=linearLocalId(lane[x])+1")
DECLARE_IGC_REGKEY(DWORD, EnableCodeAssumption,         1, \
    "If set (> 0), generate llvm.assume to help certain optimizations. It is OCL only for now. \
	 Only 1 and 2 are valid. 2 will be 1 plus additional assumption. It also does other minor changes.")
DECLARE_IGC_REGKEY(bool, EnableHoistMulInLoop, true,
    "Hoist multiply with loop invirant out of loop, FP unsafe")
DECLARE_IGC_REGKEY(bool, EnableGVN, true,
    "Enable LLVM global value numbering")
DECLARE_IGC_REGKEY(bool, EnableLogicalAndToBranch, true,
    "Enable convert logical AND to conditional branch")
DECLARE_IGC_REGKEY(bool, DisableMovingInstanceIDIndexOfVS,  false,   "Disable moving index of InstanceID in VS to last location.")
DECLARE_IGC_REGKEY(bool, EnableSplitUnalignedVector,    true,    "Enable Splitting of unaligned vectors for loads and stores")

DECLARE_IGC_GROUP("Shader debugging")
DECLARE_IGC_REGKEY(bool, ShaderDebugHashCodeInKernel,   false, "Append hash code to the binary")
DECLARE_IGC_REGKEY(int,  ShaderDebugHashCode,           false, "The driver will set a breakpoint in the first instruction of the shader which has the provided hash code.\
                                                                It works only when the value is different then 0 and SystemThreadEnable is set to TRUE.\
                                                                Ex: VS_asm2df26246434553ad_nos0000000000000000 , only the LowPart Need \
                                                                to be Enterd in Registry Ex : 0x434553ad ,i.e Lower 8 Hex Digits of the 16 Digit Hash Code \
                                                                for Compatibilty Reasons")
DECLARE_IGC_REGKEY(DWORD, ShaderDisableOptPassesAfter,  0,     "Will only run first N optimization passes, any further passes will be ignored. This flag can be used to bisect optimization passes.")
DECLARE_IGC_REGKEY(bool, ShaderOverride,                false, "Will override any LLVM shader with matching name in c:\\Intel\\IGC\\ShaderOverride")
DECLARE_IGC_REGKEY(bool, SystemThreadEnable,            false, "This key forces software to create a system thread. The system thread may still be created by software even \
                                                                if this control is set to false.The system thread is invoked if either the software requires \
                                                                exception handling or if kernel debugging is active and a breakpoint is hit." )

DECLARE_IGC_REGKEY(bool, EnableSIPOverride,             false, "This key forces load of SIP from a a Local File.")
DECLARE_IGC_REGKEY(debugString, SIPOverrideFilePath,    0,     "This key when enabled with EnableSIPOverride load of SIP from a specified path.")
DECLARE_IGC_REGKEY(bool, DumpPayloadToScratch,          false, "Setting this to 1/true dumps thread payload to scartch space. Used for  workloads which doesnt use scartch space for other purposes")
DECLARE_IGC_REGKEY(DWORD, DebugInternalSwitch,          0,     "Code pass selection, debug only")
DECLARE_IGC_REGKEY(bool, SToSProducesPositivePointer,   false, "This key is for StatelessToStatefull optimization if the  user knows the pointer offset is postive to the kernel argument.")
DECLARE_IGC_REGKEY(bool, EnableSupportBufferOffset,     false, "[Temporary]For StatelessToStatefull optimization [OCL], support implicit buffer offset argument (same as -cl-intel-has-buffer-offset-arg).")
DECLARE_IGC_REGKEY(bool, EnableOptionalBufferOffset,    true,  "[Temporary]For StatelessToStatefull optimization [OCL], if true, make buffer offset optional. Valid only if buffer offset is supported.")
DECLARE_IGC_REGKEY(bool, EnableTestIGCBuiltin,          false, "Enable testing igc builtin (precompiled kernels) using OCL.")
DECLARE_IGC_REGKEY(bool, EnableCSSIMD32, false, "Enable computer shader SIMD32 mode, and fall back to lower SIMD when spill")
DECLARE_IGC_REGKEY(bool, ForceCSSIMD32, false, "Force computer shader SIMD32 mode")
DECLARE_IGC_REGKEY(bool, ForceCSSIMD16, false, "Force computer shader SIMD16 mode if allowed, otherwise it will use SIMD32")
DECLARE_IGC_REGKEY(bool, ForceCSLeastSIMD, false, "Force computer shader to the lowest allowed SIMD mode")
DECLARE_IGC_REGKEY(bool, EnableTrivialEmulateSinCos,   false, "Enable Emulation for Sine and Cosine instructions")
DECLARE_IGC_REGKEY(DWORD, ld2dmsInstsClubbingThreshold, 3, "Do not club more than these ld2dms insts into the new BB during MCSOpt")
DECLARE_IGC_REGKEY(DWORD, ForcePerThreadPrivateMemorySize, 0, "Useful for ensuring a certain amount of private memory when doing a shader override.")
DECLARE_IGC_REGKEY(DWORD, RetryManagerFirstStateId, 0, "For debugging purposes, it can be useful to start on a particular id rather than id 0.")
DECLARE_IGC_REGKEY(bool, DisableSendSrcDstOverlapWA, false, "Disable Send Source/destination overlap WA which is enabled for GEN10/GEN11 and whenever Wddm2Svm is set in WATable")

DECLARE_IGC_GROUP("Shader dumping")
DECLARE_IGC_REGKEY(bool, EnableCosDump, false, "Enable cos dump")
DECLARE_IGC_REGKEY(bool, DumpLLVMIR,                    false, "dump LLVM IR")
DECLARE_IGC_REGKEY(bool, QualityMetricsEnable,          false, "Enable Quality Metrics for IGC")
DECLARE_IGC_REGKEY(bool, ShaderDumpEnable,              false, "dump LLVM IR, visaasm, and GenISA")
DECLARE_IGC_REGKEY(bool, InterleaveSourceShader,        true, "Interleave the source shader in asm dump")
DECLARE_IGC_REGKEY(bool, ShaderDumpEnableAll,           false, "dump all LLVM IR passes, visaasm, and GenISA")
DECLARE_IGC_REGKEY(bool, ShaderDumpPidDisable,          false, "disabled adding PID to the name of shader dump directory" )
DECLARE_IGC_REGKEY(bool, DumpToCurrentDir,              false, "dump shaders to the current directory")
DECLARE_IGC_REGKEY(bool, PrintToConsole,                false, "dump to console")
DECLARE_IGC_REGKEY(bool, DumpCompilerStats,             false, "dump compiler statistics")
DECLARE_IGC_REGKEY(bool, EnableCapsDump,                false, "Enable hardware caps dump")
DECLARE_IGC_REGKEY(bool, EnableLivenessDump,            false, "Enable dumping out liveness info on stderr.")
DECLARE_IGC_REGKEY(DWORD, ForceRPE,                     0,     "Force RPE (RegisterEstimator) computation if > 0. If 2, force RPE per inst.")
DECLARE_IGC_REGKEY(DWORD, RPEDumpLevel,                 0,     "> 0 : dump info of register pressure estimate on stderr. See igc_flags.hpp level defs.")
DECLARE_IGC_REGKEY(bool, DumpOCLProgramInfo,            false, "dump OpenCL Patch Tokens, Kernel/Program Binary Header")
DECLARE_IGC_REGKEY(bool, DebugSurfaceStateOutput,       false, "Enable dumping of surface state output when building driver.")
DECLARE_IGC_REGKEY(bool, DumpVariableAlias,             false, "Dump variable alias info, valid if EnableVariableAlias is on)")

DECLARE_IGC_GROUP("Debugging features")
DECLARE_IGC_REGKEY(bool, InitializeUndefValueEnable,    false, "Setting this to 1/true initializes all undefs in URB payload to 0")
DECLARE_IGC_REGKEY(bool, InitializeRegistersEnable,     false, "Setting this to 1/true initializes all GRFs, Flag and address registers to 0 at the beginning of the shader")

DECLARE_IGC_GROUP("IGC Features")
DECLARE_IGC_REGKEY(bool, EnableOCLSIMD16,               true,  "Enable OCL SIMD16 mode")
DECLARE_IGC_REGKEY(bool, EnableOCLSIMD32,               true,  "Enable OCL SIMD32 mode")
DECLARE_IGC_REGKEY(DWORD, ForceOCLSIMDWidth,            0,     "Force using SIMD width specified. 0 : no forcing. This overrides driver forced SIMD value(if any) and runtime behaviour could be different if driver expects something fixed")
DECLARE_IGC_REGKEY(bool, SendMultipleSIMDModesCS,       true,  "Send multiple SIMD modes for CS")
DECLARE_IGC_REGKEY(DWORD, OCLSIMD16SelectionMask,       6,     "Select SIMD 16 heuristics. Valid values are 0, 1, 2 and 3")
DECLARE_IGC_REGKEY(bool, EnableHSSinglePatchDispatch,   false, "Setting this to 1/true enables SIMD8 single-patch dispatch in HullShader. Default is either SIMD8 single patch/dual patch dispatch based on control point count")
DECLARE_IGC_REGKEY(bool, DisableGPGPUIndirectPayload,   false, "Disable OCL indirect GPGPU payload")
DECLARE_IGC_REGKEY(bool, DisableDSDualPatch,            false, "Setting it to true with enable Single and Dual Patch dispatch mode for Domain Shader")
DECLARE_IGC_REGKEY(bool, DisableMemOpt,                 false, "Disable MemOpt, merging load/store")
DECLARE_IGC_REGKEY(bool, DisableMemOpt2,                false, "Disable MemOpt2")
DECLARE_IGC_REGKEY(bool, DisablePreRAScheduler,         false, "Disable Pre RA Scheduling")
DECLARE_IGC_REGKEY(DWORD,MaxLiveOutThreshold,           0,     "Max LiveOut Threshold in MemOpt2")
DECLARE_IGC_REGKEY(bool, DisableScalarAtomics,          false, "Disable the Scalar Atomics optimization")
DECLARE_IGC_REGKEY(bool, HoistPSConstBufferValues,      true,  "Hoists up down converts for contant buffer accesses, so they an be vectorized more easily.")
DECLARE_IGC_REGKEY(bool, EnableSingleVertexDispatch,    false, "Vertex Shader Single Patch Dispatch Regkey")
DECLARE_IGC_REGKEY(bool, allowLICM,                     true,  "Enable LICM in IGC.")
DECLARE_IGC_REGKEY(DWORD, CSSpillThresholdSLM,          12,    "Spill Threshold for CS SIMD16 with SLM")
DECLARE_IGC_REGKEY(DWORD, CSSpillThresholdNoSLM,        5,     "Spill Threshold for CS SIMD16 without SLM")
DECLARE_IGC_REGKEY(bool, EnableTypeDemotion,            true,  "Enable Type Demotion")
DECLARE_IGC_REGKEY(bool, EnablePreRARematFlag,          true,  "Enable PreRA Rematerialization of Flag")
DECLARE_IGC_REGKEY(bool, EnableGASResolver,             true,  "Enable GAS Resolver")
DECLARE_IGC_REGKEY(bool, DisableRecompilation,          false, "Disable recompilation")
DECLARE_IGC_REGKEY(bool, DisableEarlyOutPatterns,       false, "Disable optimization trying to create an early out after sampleC messages")
DECLARE_IGC_REGKEY(DWORD, EarlyOutPatternSelectPS,      0xf,   "Each bit selects a pattern match to enable/disable.")
DECLARE_IGC_REGKEY(DWORD, EarlyOutPatternSelectCS,      0x8,   "Each bit selects a pattern match to enable/disable.")
DECLARE_IGC_REGKEY(bool, EnableReasso,                  false,  "Enable reassociation")
DECLARE_IGC_REGKEY(bool, EnableOCLScratchPrivateMemory, true,  "Enable the use of scratch space for private memory [OCL only]")
DECLARE_IGC_REGKEY(bool, Enable64BitEmulation,          false, "Enable 64-bit emulation")
DECLARE_IGC_REGKEY(bool, Enable64BitEmulationOnSelectedPlatform, true, "Enable 64-bit emulation on selected platforms")
DECLARE_IGC_REGKEY(bool, EnableOptimPhiMov,             false, "Enable generating Phi mov not in phi's immediate predecessors for perf reason.")
DECLARE_IGC_REGKEY(bool, EnableRecursionOpenCL,         false, "Enable recursion with OpenCL user functions")
DECLARE_IGC_REGKEY(bool, DisableBufferToResPromotionAir,true, "Disable promoting beffers to resources")
DECLARE_IGC_REGKEY(bool, ForceDPEmulation,              false, "Force double emulation for testing purpose")
DECLARE_IGC_REGKEY(bool, DPEmuNeedI64Emu,               true,  "Double Emulation needs I64 emulation. Unsetting it to disable I64 Emulation for testing.")
DECLARE_IGC_REGKEY(bool, ForceSPDivEmulation,          false, "Force SP Div emulation for testing purpose")
DECLARE_IGC_REGKEY(bool, EnableGen11TwoStackTSG,       false, "Enable Two stack TSG gen11 feature")
DECLARE_IGC_REGKEY(bool, EnableFallbackToBindless,      true,  "This key enables fallback to bindless mode on all shaders")
DECLARE_IGC_REGKEY(bool, EnableFallbackToStateless,     true,  "This key enables fallback to stateless mode on all shaders")
DECLARE_IGC_REGKEY(bool, DisablePromoteToDirectAS,      false, "This key disables the PromoteResourceToDirectAS pass")
DECLARE_IGC_REGKEY(bool, EnableAdvCodeMotion,           true,  "Enable advanced code motion")
DECLARE_IGC_REGKEY(bool, AdvCodeMotionControl,          1,     "Control bits to fine-tune advanced code motion")
DECLARE_IGC_REGKEY(bool, EnableAdvRuntimeUnroll,        true,  "Enable advanced runtime unroll")
DECLARE_IGC_REGKEY(bool, AdvRuntimeUnrollCount,         0,     "Advanced runtime unroll count")
DECLARE_IGC_REGKEY(bool, EnableAdvMemOpt,               true,  "Enable advanced memory optimization")
DECLARE_IGC_REGKEY(bool, UniformMemOptLimit,            0,     "Limit of uniform memory optimization in bits")
DECLARE_IGC_REGKEY(bool, EnableFunctionPointer,         false,  "Enables support for function pointers and indirect calls")

DECLARE_IGC_REGKEY(bool, EnableReadGTPinInput,          true,  "Enables setting GTPin context flags by reading the input to the compiler adapters")

DECLARE_IGC_GROUP("Performance experiments")
DECLARE_IGC_REGKEY(bool, ForceNonCoherentStatelessBTI,  false, "Enable gneeration of non cache coherent stateless messages")
DECLARE_IGC_REGKEY(bool, ForceSendsSupportOnSKLA0,      false, "Allow sends on SKL A0, may be unsafe")
DECLARE_IGC_REGKEY(bool, DisableWaSendSEnableIndirectMsgDesc, false, "Disable a C0 WA WaSendSEnableIndirectMsgDesc, may be unsafe")
DECLARE_IGC_REGKEY(bool, DisableWaDisableSIMD16On3SrcInstr, false, "Disable C0 WA WaDisableSIMD16On3SrcInstr, may be unsafe")
DECLARE_IGC_REGKEY(bool, DisableDualBlendSource,        false, "Force the compiler to never use dual blend source messages")
DECLARE_IGC_REGKEY(bool, ForceDisableSrc0Alpha,        false, "Force the compiler to skip sending src0 alpha. Only works if we are sure alpha to coverage and alpha test is off")
DECLARE_IGC_REGKEY(bool, EnableLTO,                     true,  "Enable link time optimization")
DECLARE_IGC_REGKEY(bool, EnableLTODebug,                false, "Enable debug information for LTO")
DECLARE_IGC_REGKEY(DWORD, FunctionControl,              0,     "Control function inlining/subroutine/stackcall. See value defs in igc_flags.hpp.")
DECLARE_IGC_REGKEY(DWORD, OCLInlineThreshold,           512,   "Setting OCL inline thershold")
DECLARE_IGC_REGKEY(bool, EnableForceGroupSize,          false, "Enable forcing thread Group Size ForceGroupSizeX and ForceGroupSizeY")
DECLARE_IGC_REGKEY(DWORD, ForceGroupSizeX,              8, "force group size along X")
DECLARE_IGC_REGKEY(DWORD, ForceGroupSizeY,              8, "force group size along Y")
DECLARE_IGC_REGKEY(bool, EnableThreadCombiningWithNoSLM, false, "Enable thread combining opt for shader without SLM")
DECLARE_IGC_REGKEY(DWORD, SubroutineThreshold,          110000, "Minimal kernel size to enable subroutines")
DECLARE_IGC_REGKEY(DWORD, SubroutineInlinerThreshold,   3000, "Subroutine inliner threshold")
DECLARE_IGC_REGKEY(bool, EnableConstantPromotion,       true, "Enable global constant data to register promotion")
DECLARE_IGC_REGKEY(DWORD, ConstantPromotionSize,        2, "Threshold in number of GRFs")
DECLARE_IGC_REGKEY(DWORD, ConstantPromotionCmpSelSize,  4, "Array size threshold for cmp-sel transform")
DECLARE_IGC_REGKEY(bool, EnableVariableReuse,           true, "Enable local variable reuse")
DECLARE_IGC_REGKEY(bool, EnableVariableAlias,           true, "Enable variable aliases (part of VariableReuse Pass, but separate functionality)")
DECLARE_IGC_REGKEY(DWORD, EnableVATemp,                 0, "[temp]Enable variable aliases sub-optimization, once it is stable, remove this key")
DECLARE_IGC_REGKEY(DWORD, VariableReuseByteSize,        64, "The byte size threshold for variable reuse")
DECLARE_IGC_REGKEY(bool, EnableGather4cpoWA,            true, "Enable WA transforming gather4cpo/gather4po into gather4c/gather4")
DECLARE_IGC_REGKEY(bool, EnableIntelFast,               false, "Enable intel fast, experimental flag.")
DECLARE_IGC_REGKEY(bool, disableUnormTypedReadWA,       false, "disable software conversion for UNORM surface in Dx10")
DECLARE_IGC_REGKEY(bool, forceGlobalRA,                 false, "force global register allocator")
DECLARE_IGC_REGKEY(bool, disableVarSplit,               false, "disable variable splitting")
DECLARE_IGC_REGKEY(bool, disableRemat,                  false, "disable re-materialization")
DECLARE_IGC_REGKEY(bool, EnableDisableMidThreadPreemptionOpt,    true,  "Disable mid thread preemption")
DECLARE_IGC_REGKEY(DWORD, MidThreadPreemptionDisableThreshold,   600, "Threshold to disable mid thread preemption")
DECLARE_IGC_REGKEY(bool, DispatchGPGPUWalkerAlongYFirst, true, "dispatch GPGPU walker along Y first")
DECLARE_IGC_REGKEY(bool, SetMaxPreRASchedulerRegPressureThreshold, false,  "set Max PreRA Scheduler Threshold")
DECLARE_IGC_REGKEY(bool, LimitConstantBuffersPushed, true, "Limit max number of CBs pushed when SupportIndirectConstantBuffer is true")
DECLARE_IGC_REGKEY(DWORD, MaxPreRASchedulerRegPressureThreshold, 60,  "Max PreRA Scheduler Threshold")
DECLARE_IGC_REGKEY(bool, EnablePreRASampleCluster, false,  "Enabling helps cluster sample instructions with identical texture index which are ready to be scheduled, to be scheduled together")
DECLARE_IGC_REGKEY(bool, forceSamplerHeader, false, "force sampler messages to use header")
DECLARE_IGC_REGKEY(bool, VFPackingDisablePartialElements, false, "disable packing for partial vertex element as it causes performance drops")
DECLARE_IGC_REGKEY(bool, cl_khr_srgb_image_writes, false,  "Enable cl_khr_srgb_image_writes extension")
DECLARE_IGC_REGKEY(bool, MSAA16BitPayloadEnable, true,  "Enable support for MSAA 16 bit payload , a hardware DCN supporting this from ICL+ to improve perf on MSAA workloads")
DECLARE_IGC_REGKEY(bool, EnableInsertElementScalarCoalescing, false,  "Enable coalescing on the scalar operand of insertelement")
DECLARE_IGC_REGKEY(bool, EnableMixIntOperands,          true,  "Enable generating mix-sized operands for int ALU")
DECLARE_IGC_REGKEY(bool, PixelShaderDoNotAbortOnSpill, false,  "Do not abort on a spill")
DECLARE_IGC_REGKEY(DWORD, ForcePixelShaderSIMDMode,  0, "Setting it to values def in igc.h will force SIMD mode compilation for pixel shaders. Note that only SIMD8 is compiled unless other ForcePixelShaderSIMD* are also selected")
DECLARE_IGC_REGKEY(bool, SkipTREarlyExitCheck, false, "Skip SIMD16 early exit check in ShaderCodeGen")
DECLARE_IGC_REGKEY(bool, EnableTCSHWBarriers, false,  "Enable TCS pass with HW barriers support. Default TCS pass is TCS pass with multiple continuation functions.")
DECLARE_IGC_REGKEY(bool, ForceMCFBarriers, false,  "Force TCS pass with MCF (SW) barriers support. Default TCS pass is TCS pass with multiple continuation functions.")
DECLARE_IGC_REGKEY(bool, EnableAccSub, true, "Enable accumulator substitution")
DECLARE_IGC_REGKEY(bool, EnableAccSubDF, false, "Enable accumulator substitution for DF type")
DECLARE_IGC_REGKEY(bool, EnableAccSubMadm, false, "Enable accumulator substitution for madm")
DECLARE_IGC_REGKEY(DWORD, NumGeneralAcc, 0, "set the number [1-8] of general acc for accumulator substitution. 0 means using the platform-default value")
DECLARE_IGC_REGKEY(bool, ForceSWCoalescingOfAtomicCounter, false, "Force software coalescing of atomic counter")
DECLARE_IGC_REGKEY(bool, EnableNoDD, false, "Enable NoDD flags")
DECLARE_IGC_REGKEY(bool, ForceMixMode, false, "force enable mix mode even on platforms that do not support it")
DECLARE_IGC_REGKEY(bool, DisableFDIV, false, "Disable fdiv support")
DECLARE_IGC_REGKEY(bool, EmulateFDIV, false, "Emulate fdiv instructions")
DECLARE_IGC_REGKEY(bool, UpConvertF16Sampler, true, "up-convert fp16 sampler mesasge to return fp32")
DECLARE_IGC_REGKEY(bool, FuseTypedWrite, false, "Enable fusing of simd8 typed write")
DECLARE_IGC_REGKEY(bool, EnableUndefAlphaOutputAsRed, true, "Output red for undefined alpha output")
DECLARE_IGC_REGKEY(bool, EnableHalfPromotion, true, "Enable pass that replaces instructions using halfs with corresponding float counterparts for pre-SKL")
DECLARE_IGC_REGKEY(bool, ForceHalfPromotion, false, "Force enable pass that replaces instructions using halfs with corresponding float counterparts")
DECLARE_IGC_REGKEY(bool, DisbleLocalFences, false, "On CNL+ we need to emit local fences. Setting this to true removes those. It may be functionaly not correct.")
DECLARE_IGC_REGKEY(bool, FastSpill, false, "fast spill code gen. This may produce worse equality code for the spilling shader")
DECLARE_IGC_REGKEY(bool, EnableGSURBEntryPadding, true,  "Enable padding of GS URB Entry by adding extra portions of Control Data Header.")
DECLARE_IGC_REGKEY(bool, EnableGSVtxCountMsgHalfCLSize, true,  "Enable the Vertex Count msg of half CL size, instead of 1DW size.")
DECLARE_IGC_REGKEY(bool, EnableTEFactorsPadding, true,  "Enable padding of the TE factors.")
DECLARE_IGC_REGKEY(bool, EnableSubroutineForEmulation,  true,  "Enable subroutine call support when emulation(double) is on. Heuristic decides which use subroutine calls.")
DECLARE_IGC_REGKEY(bool, ForceSubroutineForEmulation,   false,  "Force subroutine call for all emulation functions if emulation(double) is on.")
DECLARE_IGC_REGKEY(int, ByPassAllocaSizeHeuristic,   0,  "Force some Alloca to pass the pressure heuristic until the given size")
DECLARE_IGC_REGKEY(DWORD, MemOptWindowSize,   150,  "Change the size of the window in which we allow load/stores to be coalesced. We keep it limited in order to avoid creating long liveranges. Default value is 150")
DECLARE_IGC_REGKEY(bool, ForceNoFP64bRegioning, false, "force regioning rules for FP and 64b FPU instructions")
DECLARE_IGC_REGKEY(bool, EnableOneStepElf, true, "Enable generation of direct elf mapping src->Gen ISA")
DECLARE_IGC_REGKEY(bool, EmitDebugRanges, false, "Emit .debug_ranges section when instructions in a block are non-consecutive")
DECLARE_IGC_REGKEY(bool, EmitDebugLoc, false, "Enable generation of .debug_loc section")

DECLARE_IGC_GROUP("Generating precompiled headers")
DECLARE_IGC_REGKEY(bool, ApplyConservativeRastWAHeader, true,
"Apply WaConservativeRasterization for the platforms enabled")



DECLARE_IGC_GROUP("OGL Frontend")
        DECLARE_IGC_REGKEY(bool, OGLMinimumDump, false,"Minimum dump for testing - first and last .ll, .cos and compiler output")
