Skip to content

Commit

Permalink
Internal Feature
Browse files Browse the repository at this point in the history
Change-Id: I840ea18703660c3d77b08cecb49db6e0f5c23eaa
  • Loading branch information
mmerecki authored and gfxbot committed Jan 9, 2019
1 parent f7b9732 commit 312ccf2
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 35 deletions.
26 changes: 12 additions & 14 deletions IGC/Compiler/CISACodeGen/CISABuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ VISA_PredOpnd* CEncoder::GetFlagOperand(const SFlag& flag)
VISA_PREDICATE_STATE predState = (flag.invertFlag)
? PredState_INVERSE : PredState_NO_INVERSE;
VISA_PREDICATE_CONTROL predCtrl = PRED_CTRL_NON;

switch (flag.mode)
{
case EPRED_ALL: predCtrl = PRED_CTRL_ALL; break;
Expand Down Expand Up @@ -889,7 +889,7 @@ Common_VISA_EMask_Ctrl CEncoder::GetAluEMask(CVariable* dst)
noMask = true;
}
}
}
}

return ConvertMaskToVisaType(mask, noMask);
}
Expand Down Expand Up @@ -1515,7 +1515,7 @@ void CEncoder::LogicOp(
if(src1 != NULL)
src1Dcl = src1->visaPredVariable;

// Try to use NOT instruction for predicate, we won't have phi on
// Try to use NOT instruction for predicate, we won't have phi on
// predicate since Legalization pass convert i1 phi to i32.
if (opcode == ISA_NOT)
SetNoMask();
Expand Down Expand Up @@ -2424,7 +2424,7 @@ void CEncoder::Gather4Inst(
if (!isIdxLT16)
{
uint16_t aoffimmiVal = (uint16_t)offset->GetImmediateValue() | BIT(15);
V(vKernel->CreateVISAImmediate(aoffimmi, &aoffimmiVal, ISA_TYPE_UW));
V(vKernel->CreateVISAImmediate(aoffimmi, &aoffimmiVal, ISA_TYPE_UW));
}

V(vKernel->AppendVISA3dGather4(
Expand Down Expand Up @@ -2498,7 +2498,7 @@ void CEncoder::Fence(bool CommitEnable,
( L3_Flush_Constant_Data << 3 ) |
( L3_Flush_RW_Data << 4 ) |
( (!Global_Mem_Fence) << 5 ) | // bit 5: 1 -- local, 0 -- global
( L1_Flush_Constant_Data << 6 ) |
( L1_Flush_Constant_Data << 6 ) |
( SWFence << 7 ) |
( CommitEnable << 0 );

Expand Down Expand Up @@ -3472,18 +3472,18 @@ void CEncoder::InitEncoder( bool canAbortOnSpill )
SetVISAWaTable(m_program->m_Platform->getWATable());

bool enableVISADump = IGC_IS_FLAG_ENABLED(EnableVISASlowpath) || IGC_IS_FLAG_ENABLED(ShaderDumpEnable);
V(CreateVISABuilder(vbuilder, vISA_3D, enableVISADump ? CM_CISA_BUILDER_BOTH : CM_CISA_BUILDER_GEN,
V(CreateVISABuilder(vbuilder, vISA_3D, enableVISADump ? CM_CISA_BUILDER_BOTH : CM_CISA_BUILDER_GEN,
VISAPlatform, params.size(), params.data(), &m_WaTable));

// Set up options. This must be done before creating any variable/instructions
// Set up options. This must be done before creating any variable/instructions
// since some of the options affect IR building.

if (IGC_IS_FLAG_ENABLED(ForceNoFP64bRegioning))
{
vbuilder->SetOption(vISA_forceNoFP64bRegioning, true);
}

if (context->type == ShaderType::OPENCL_SHADER && context->m_floatDenormMode32 == FLOAT_DENORM_RETAIN &&
if (context->type == ShaderType::OPENCL_SHADER && context->m_floatDenormMode32 == FLOAT_DENORM_RETAIN &&
context->m_floatDenormMode64 == FLOAT_DENORM_RETAIN)
{
vbuilder->SetOption(vISA_hasRNEandDenorm, true);
Expand Down Expand Up @@ -3736,7 +3736,7 @@ void CEncoder::InitEncoder( bool canAbortOnSpill )
{
/* Some tools only use 32bits hash, to maintain compatibility
across lot of unknown tool chains doing Compare for only LowerPart
*/
*/
if (IGC_GET_FLAG_VALUE(ShaderDebugHashCode) == (DWORD)context->hash.getAsmHash())
{
vbuilder->SetOption(vISA_setStartBreakPoint, true);
Expand Down Expand Up @@ -4216,9 +4216,9 @@ void CEncoder::Compile()
{
context->m_retryManager.SetSpillSize(jitInfo->numGRFSpillFill);
m_program->m_spillSize = jitInfo->numGRFSpillFill;
m_program->m_spillCost =
m_program->m_spillCost =
float(jitInfo->numGRFSpillFill) / jitInfo->numAsmCount;

context->m_retryManager.numInstructions = jitInfo->numAsmCount;
}
COMPILER_TIME_END(m_program->GetContext(), TIME_CG_vISACompile);
Expand Down Expand Up @@ -4269,9 +4269,7 @@ void CEncoder::Compile()
MEM_SNAPSHOT( IGC::SMS_AFTER_vISACompile_SIMD32 );
}

if ((context->type == ShaderType::PIXEL_SHADER ||
context->type == ShaderType::COMPUTE_SHADER )&&
m_program->m_dispatchSize == SIMDMode::SIMD16)
if (m_program->m_dispatchSize == SIMDMode::SIMD16)
{
uint sendStallCycle = 0;
uint staticCycle = 0;
Expand Down
12 changes: 7 additions & 5 deletions IGC/Compiler/CodeGenContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ bool RetryManager::PickupKernels(CodeGenContext* cgCtx)
}

unsigned RetryManager::getStateCnt()
{
return sizeof(RetryTable) / sizeof(RetryState);
{
return sizeof(RetryTable) / sizeof(RetryState);
};

CShader* RetryManager::PickCSEntryForcedFromDriver(SIMDMode& simdMode, unsigned char forcedSIMDModeFromDriver)
Expand Down Expand Up @@ -284,7 +284,7 @@ CShader* RetryManager::PickCSEntryEarly(SIMDMode& simdMode,
simdMode = SIMDMode::SIMD16;
return m_simdEntries[1];
}
assert((m_simdEntries[0] == NULL) || simd8NoSpill == true); // If SIMD16 doesn't spill, SIMD8 shouldn't, if it exists
assert((m_simdEntries[0] == NULL) || simd8NoSpill == true); // If SIMD16 doesn't spill, SIMD8 shouldn't, if it exists
}
}

Expand Down Expand Up @@ -412,9 +412,9 @@ LLVMContextWrapper::LLVMContextWrapper(bool createResourceDimTypes)
}
}

void LLVMContextWrapper::AddRef()
void LLVMContextWrapper::AddRef()
{
refCount++;
refCount++;
}

void LLVMContextWrapper::Release()
Expand Down Expand Up @@ -703,4 +703,6 @@ bool CodeGenContext::isPOSH() const
"IGC::PositionOnlyVertexShader") != nullptr;
}



}
16 changes: 8 additions & 8 deletions IGC/Compiler/CodeGenPublic.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ namespace IGC
bool isPerSample;
bool oMask;
bool VectorMask;

bool hasPrimID;
bool isCoarsePS;
bool hasCoarsePixelSize;
Expand Down Expand Up @@ -258,7 +258,7 @@ namespace IGC
OctEltUnit VertexURBEntryReadLength;
/// corresponds to 3DSTATE_VS Vertex URB Entry Read Offset
OctEltUnit VertexURBEntryReadOffset;
/// corresponds to 3DSTATE_VS VS Vertex URB Entry Output Length
/// corresponds to 3DSTATE_VS VS Vertex URB Entry Output Length
OctEltUnit VertexURBEntryOutputReadLength;
/// corresponds to 3DSTATE_VS VS Vertex URB Entry Output Offset
OctEltUnit VertexURBEntryOutputReadOffset;
Expand Down Expand Up @@ -500,7 +500,7 @@ namespace IGC

CBTILayout(
const USC::SShaderStageBTLayout* pLayout,
const std::vector<unsigned char>& colorBufferMappings) :
const std::vector<unsigned char>& colorBufferMappings) :
m_pLayout(pLayout),
m_ColorBufferMappings(colorBufferMappings)
{}
Expand Down Expand Up @@ -544,10 +544,10 @@ namespace IGC
bool IsFirstTry();
bool IsLastTry(CodeGenContext* cgCtx);
unsigned GetRetryId() const;

void Enable();
void Disable();

void SetSpillSize(unsigned int spillSize);
unsigned int GetLastSpillSize();
unsigned int numInstructions = 0;
Expand Down Expand Up @@ -577,7 +577,7 @@ namespace IGC
// cache the compiled kernel during retry
CShader* m_simdEntries[3];

CShader* PickCSEntryForcedFromDriver(SIMDMode& simdMode,
CShader* PickCSEntryForcedFromDriver(SIMDMode& simdMode,
unsigned char forcedSIMDModeFromDriver);
CShader* PickCSEntryByRegKey(SIMDMode& simdMode);
CShader* PickCSEntryEarly(SIMDMode& simdMode,
Expand Down Expand Up @@ -673,7 +673,7 @@ namespace IGC
const CPlatform& _platform, ///< IGC HW platform description
const CDriverInfo& driverInfo, ///< Queries to know runtime features support
const bool createResourceDimTypes = true,
LLVMContextWrapper* LLVMContext = nullptr)///< LLVM context to use, if null a new one will be created
LLVMContextWrapper* LLVMContext = nullptr)///< LLVM context to use, if null a new one will be created
: type(_type), platform(_platform), btiLayout(_bitLayout), m_DriverInfo(driverInfo), llvmCtxWrapper(LLVMContext)
{
if (llvmCtxWrapper == nullptr)
Expand Down Expand Up @@ -989,7 +989,7 @@ namespace IGC
const COCLBTILayout& btiLayout,
const CPlatform& platform,
const TC::STB_TranslateInputArgs* pInputArgs,
const CDriverInfo& driverInfo,
const CDriverInfo& driverInfo,
LLVMContextWrapper* llvmContext = nullptr,
bool shouldUseNonCoherentStatelessBTI = false,
const bool createResourceDimTypes = true)
Expand Down
5 changes: 3 additions & 2 deletions IGC/common/MDFrameWork.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ namespace IGC
std::vector<int> colorOutputMask;
};


struct SInputDesc
{
unsigned int index = 0;
Expand Down Expand Up @@ -194,7 +195,7 @@ namespace IGC
int alignment;
std::vector<unsigned char> Buffer;
};

struct ImmConstantInfo
{
std::vector<char> data;
Expand Down Expand Up @@ -244,7 +245,7 @@ namespace IGC

// When true compiler can assume that resources bound to two different
// bindings do not alias.
bool statefullResourcesNotAliased = false;
bool statefullResourcesNotAliased = false;

unsigned int privateMemoryPerWI = 0;
std::array<uint64_t, NUM_SHADER_RESOURCE_VIEW_SIZE> m_ShaderResourceViewMcsMask;
Expand Down
19 changes: 13 additions & 6 deletions IGC/common/autogen.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

# usage: autogen.py <path_to_MDFrameWork.h> <path_to_MDNodeFuncs.gen>
__MDFrameWorkFile__ = sys.argv[1]
__genFile__ = sys.argv[2]
__genFile__ = sys.argv[2]

__genDir__ = os.path.dirname(__genFile__)
if not os.path.exists(__genDir__):
Expand Down Expand Up @@ -60,7 +60,7 @@
line = next(file, None)
insideIGCNameSpace = True
if insideIGCNameSpace:
line = line.split("//")[0]
line = line.split("//")[0]
if line.find("struct") != -1:
words = line.split()
structureNames.append(words[1])
Expand All @@ -79,6 +79,9 @@
if line.find("};") != -1:
insideIGCNameSpace = False

def skipLine(line):
return False

def storeVars(line):
vars = line.split()
for i in range(1, len(vars)):
Expand Down Expand Up @@ -198,7 +201,7 @@ def genCode():
foundStruct = False
insideStruct = False
output.write("}\n\n")

for item in structureNames:
foundStruct = False
insideStruct = False
Expand All @@ -222,18 +225,20 @@ def genCode():
inputFile.close()
continue
else:
if line:
if skipLine(line) == False:
line = line.split("//")[0]
while line.find("};") == -1:
extractVars(line)
line = next(file, None)
while skipLine(line) == True:
line = next(file, None)
line = line.split("//")[0]
printCalls(item)
del structDataMembers[:]
foundStruct = False
insideStruct = False
output.write("}\n\n")

for item in enumNames:
foundStruct = False
insideStruct = False
Expand Down Expand Up @@ -294,11 +299,13 @@ def genCode():
inputFile.close()
continue
else:
if line:
if skipLine(line) == False:
line = line.split("//")[0]
while line.find("};") == -1:
extractVars(line)
line = next(file, None)
while skipLine(line) == True:
line = next(file, None)
line = line.split("//")[0]
printReadCalls(item)
del structDataMembers[:]
Expand Down

0 comments on commit 312ccf2

Please sign in to comment.