Commit acd338e5 authored by Alex's avatar Alex Committed by gbsbuild

Internal Feature and bug fix for Atomics

Change-Id: Ie5d6334ab85de8c31cc3b1c80e0f661a7015a26f
parent f6fd34c4
......@@ -3866,7 +3866,6 @@ void __builtin_spirv_OpAtomicFlagClear_p3i32_i32_i32(volatile local uint *Pointe
#if (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
void __builtin_spirv_OpAtomicFlagClear_p4i32_i32_i32(volatile generic uint *Pointer, uint Scope, uint Semantics);
#endif // __OPENCL_C_VERSION__ >= CL_VERSION_2_0
// Barrier Instructions
void __builtin_spirv_OpControlBarrier_i32_i32_i32(Scope_t Execution, Scope_t Memory, uint Semantics);
......
......@@ -306,7 +306,7 @@ atomic_init_function(float)
// atomic_fetch()
#define atomic_fetch_function_addrspace(KEY, TYPE, OPTYPE, FUNC, ADDRSPACE, ABBR_ADDRSPACE) \
#define atomic_fetch_function_addrspace(KEY, TYPE, OPTYPE, FUNC, ADDRSPACE, ABBR_ADDRSPACE, ABBR_TYPE, PTR_TYPE) \
INLINE TYPE OVERLOADABLE atomic_fetch_##KEY(volatile ADDRSPACE atomic_##TYPE *object, OPTYPE operand) \
{ \
return atomic_fetch_##KEY##_explicit(object, operand, memory_order_seq_cst); \
......@@ -317,11 +317,11 @@ INLINE TYPE OVERLOADABLE atomic_fetch_##KEY##_explicit(volatile ADDRSPACE atomic
} \
INLINE TYPE OVERLOADABLE atomic_fetch_##KEY##_explicit(volatile ADDRSPACE atomic_##TYPE *object, OPTYPE operand, memory_order order, memory_scope scope) \
{ \
return __builtin_spirv_##FUNC##_##ABBR_ADDRSPACE##i32_i32_i32_i32((volatile ADDRSPACE uint*)object, get_spirv_mem_scope(scope), get_spirv_mem_order(order) | get_spirv_mem_fence(get_fence((const ADDRSPACE void*)object)), operand);\
return __builtin_spirv_##FUNC##_##ABBR_ADDRSPACE##ABBR_TYPE##_i32_i32_##ABBR_TYPE((volatile ADDRSPACE PTR_TYPE*)object, get_spirv_mem_scope(scope), get_spirv_mem_order(order) | get_spirv_mem_fence(get_fence((const ADDRSPACE void*)object)), operand);\
}
#define atomic_fetch_function(KEY, TYPE, OPTYPE, FUNC) \
atomic_fetch_function_addrspace(KEY, TYPE, OPTYPE, FUNC, generic, p4)
atomic_fetch_function_addrspace(KEY, TYPE, OPTYPE, FUNC, generic, p4, i32, uint)
#define atomic_fetch_supported_types(KEY, FUNC) \
atomic_fetch_function(KEY, int, int, FUNC) \
......
......@@ -10316,7 +10316,7 @@ void EmitPass::emitAtomicRaw(llvm::GenIntrinsicInst* pInsn)
else
{
CVariable* pDst = returnsImmValue ?
m_currShader->GetNewVariable(numLanes(m_currShader->m_SIMDSize), m_destination->GetType(), EALIGN_GRF) :
m_currShader->GetNewVariable(numLanes(m_currShader->m_SIMDSize), bitwidth != 64 ? ISA_TYPE_UD : ISA_TYPE_UQ, EALIGN_GRF) :
nullptr;
PointerType *PtrTy = dyn_cast<PointerType>(pllDstAddr->getType());
......@@ -10339,7 +10339,7 @@ void EmitPass::emitAtomicRaw(llvm::GenIntrinsicInst* pInsn)
m_encoder->Push();
}
if (returnsImmValue)
if (returnsImmValue) //This is needed for repacking of 16bit atomics otherwise it will be a vanilla mov
{
m_encoder->Cast(
m_currShader->BitCast(m_destination, GetUnsignedIntegerType(m_destination->GetType())),
......
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