Commit f2ce70b1 authored by Chen, Weiyu's avatar Chen, Weiyu

Add global atomics patch token for OCL

Change-Id: Ifb1063300f40bc9bc32c5e452af02a686c64e6f7
parent dbdfd155
......@@ -295,6 +295,7 @@ struct ExecutionEnivronment
DWORD FixedWorkgroupSize[3];
DWORD NumGRFRequired;
DWORD WorkgroupWalkOrder[3] = { 3, 3, 3 };
bool HasGlobalAtomics = false;
};
struct KernelTypeProgramBinaryInfo
......
......@@ -861,6 +861,9 @@ void DebugPatchList(
ICBE_DPF_STR( output, GFXDBG_HARDWARE,
"\tCompiledForGreaterThan4GBBuffers = %s\n",
pPatchItem->CompiledForGreaterThan4GBBuffers ? "true" : "false" );
ICBE_DPF_STR( output, GFXDBG_HARDWARE,
"\tHasGlobalAtomics = %s\n",
pPatchItem->HasGlobalAtomics ? "true" : "false");
}
break;
......
......@@ -1967,6 +1967,8 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
patch.NumGRFRequired = annotations.m_executionEnivronment.NumGRFRequired;
patch.HasGlobalAtomics = annotations.m_executionEnivronment.HasGlobalAtomics;
retValue = AddPatchItem(
......
......@@ -206,11 +206,12 @@ struct SPatchExecutionEnvironment :
uint32_t CompiledForGreaterThan4GBBuffers;
uint32_t NumGRFRequired;
uint32_t WorkgroupWalkOrderDims; // dim0 : [0 : 1]; dim1 : [2 : 3]; dim2 : [4 : 5]
uint32_t HasGlobalAtomics;
uint32_t reserved;
};
// Update CURRENT_ICBE_VERSION when modifying the patch list
static_assert(sizeof(SPatchExecutionEnvironment) == (88 + sizeof(SPatchItemHeader)), "The size of SPatchExecutionEnvironment is not what is expected");
static_assert(sizeof(SPatchExecutionEnvironment) == (92 + sizeof(SPatchItemHeader)), "The size of SPatchExecutionEnvironment is not what is expected");
/*****************************************************************************\
STRUCT: SPatchString
......
......@@ -10250,6 +10250,11 @@ void EmitPass::emitAtomicRaw(llvm::GenIntrinsicInst* pInsn)
ResourceDescriptor resource = GetResourceVariable(pllbuffer);
AtomicOp atomic_op = EATOMIC_UNDEF;
if (pllbuffer->getType()->getPointerAddressSpace() == ADDRESS_SPACE_GLOBAL)
{
m_currShader->SetHasGlobalAtomics();
}
CVariable* pSrc0 = nullptr;
CVariable* pSrc1 = nullptr;
llvm::GenIntrinsicInst* pIntrinCall = llvm::cast<llvm::GenIntrinsicInst>(pInsn);
......
......@@ -1652,6 +1652,8 @@ void COpenCLKernel::FillKernel()
FuncInfo.CompiledSubGroupsNumber;
}
m_kernelInfo.m_executionEnivronment.HasGlobalAtomics = GetHasGlobalAtomics();
}
void COpenCLKernel::RecomputeBTLayout()
......
......@@ -362,6 +362,8 @@ public:
bool GetHasGlobalStatelessAccess() const { return m_HasGlobalStatelessMemoryAccess; }
void SetHasConstantStatelessAccess() { m_HasConstantStatelessMemoryAccess = true; }
bool GetHasConstantStatelessAccess() const { return m_HasConstantStatelessMemoryAccess; }
void SetHasGlobalAtomics() { m_HasGlobalAtomics = true; }
bool GetHasGlobalAtomics() const { return m_HasGlobalAtomics; }
private:
// Return DefInst's CVariable if it could be reused for UseInst, and return
......@@ -464,6 +466,8 @@ protected:
bool m_HasGlobalStatelessMemoryAccess;
bool m_HasConstantStatelessMemoryAccess;
bool m_HasGlobalAtomics = false;
};
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment