mirror of
https://github.com/intel/intel-graphics-compiler.git
synced 2025-11-04 08:21:06 +08:00
Remaining DX11 & DX12 int64 typed atomics extenions
Adding remaining DX11 & DX12 int64 typed atomics extenions min, and, or, add, xor, xchange, compare xchange
This commit is contained in:
@ -353,7 +353,7 @@ int IntelExt_WavePrefixSum(int value)
|
||||
return g_IntelExt[opcode].dst0u.x;
|
||||
}
|
||||
|
||||
// uint64 atomics
|
||||
// uint64 typed atomics
|
||||
// Interlocked max
|
||||
uint2 IntelExt_InterlockedMaxUint64(RWTexture2D<uint2> uav, uint2 address, uint2 value)
|
||||
{
|
||||
@ -366,3 +366,95 @@ uint2 IntelExt_InterlockedMaxUint64(RWTexture2D<uint2> uav, uint2 address, uint2
|
||||
|
||||
return g_IntelExt[opcode].dst0u.xy;
|
||||
}
|
||||
|
||||
// Interlocked Min
|
||||
uint2 IntelExt_InterlockedMinUint64(RWTexture2D<uint2> uav, uint2 address, uint2 value)
|
||||
{
|
||||
uint opcode = g_IntelExt.IncrementCounter();
|
||||
uav[uint2(opcode, opcode)] = uint2(0, 0); //dummy instruction to get the resource handle
|
||||
g_IntelExt[opcode].opcode = INTEL_EXT_UINT64_ATOMIC;
|
||||
g_IntelExt[opcode].src0u.xy = address;
|
||||
g_IntelExt[opcode].src1u.xy = value;
|
||||
g_IntelExt[opcode].src2u.x = INTEL_EXT_ATOMIC_MIN;
|
||||
|
||||
return g_IntelExt[opcode].dst0u.xy;
|
||||
}
|
||||
|
||||
// Interlocked and
|
||||
uint2 IntelExt_InterlockedAndUint64(RWTexture2D<uint2> uav, uint2 address, uint2 value)
|
||||
{
|
||||
uint opcode = g_IntelExt.IncrementCounter();
|
||||
uav[uint2(opcode, opcode)] = uint2(0, 0); //dummy instruction to get the resource handle
|
||||
g_IntelExt[opcode].opcode = INTEL_EXT_UINT64_ATOMIC;
|
||||
g_IntelExt[opcode].src0u.xy = address;
|
||||
g_IntelExt[opcode].src1u.xy = value;
|
||||
g_IntelExt[opcode].src2u.x = INTEL_EXT_ATOMIC_AND;
|
||||
|
||||
return g_IntelExt[opcode].dst0u.xy;
|
||||
}
|
||||
|
||||
// Interlocked or
|
||||
uint2 IntelExt_InterlockedOrUint64(RWTexture2D<uint2> uav, uint2 address, uint2 value)
|
||||
{
|
||||
uint opcode = g_IntelExt.IncrementCounter();
|
||||
uav[uint2(opcode, opcode)] = uint2(0, 0); //dummy instruction to get the resource handle
|
||||
g_IntelExt[opcode].opcode = INTEL_EXT_UINT64_ATOMIC;
|
||||
g_IntelExt[opcode].src0u.xy = address;
|
||||
g_IntelExt[opcode].src1u.xy = value;
|
||||
g_IntelExt[opcode].src2u.x = INTEL_EXT_ATOMIC_OR;
|
||||
|
||||
return g_IntelExt[opcode].dst0u.xy;
|
||||
}
|
||||
|
||||
// Interlocked add
|
||||
uint2 IntelExt_InterlockedAddUint64(RWTexture2D<uint2> uav, uint2 address, uint2 value)
|
||||
{
|
||||
uint opcode = g_IntelExt.IncrementCounter();
|
||||
uav[uint2(opcode, opcode)] = uint2(0, 0); //dummy instruction to get the resource handle
|
||||
g_IntelExt[opcode].opcode = INTEL_EXT_UINT64_ATOMIC;
|
||||
g_IntelExt[opcode].src0u.xy = address;
|
||||
g_IntelExt[opcode].src1u.xy = value;
|
||||
g_IntelExt[opcode].src2u.x = INTEL_EXT_ATOMIC_ADD;
|
||||
|
||||
return g_IntelExt[opcode].dst0u.xy;
|
||||
}
|
||||
|
||||
// Interlocked xor
|
||||
uint2 IntelExt_InterlockedXorUint64(RWTexture2D<uint2> uav, uint2 address, uint2 value)
|
||||
{
|
||||
uint opcode = g_IntelExt.IncrementCounter();
|
||||
uav[uint2(opcode, opcode)] = uint2(0, 0); //dummy instruction to get the resource handle
|
||||
g_IntelExt[opcode].opcode = INTEL_EXT_UINT64_ATOMIC;
|
||||
g_IntelExt[opcode].src0u.xy = address;
|
||||
g_IntelExt[opcode].src1u.xy = value;
|
||||
g_IntelExt[opcode].src2u.x = INTEL_EXT_ATOMIC_XOR;
|
||||
|
||||
return g_IntelExt[opcode].dst0u.xy;
|
||||
}
|
||||
|
||||
// Interlocked exchange
|
||||
uint2 IntelExt_InterlockedExchangeUint64(RWTexture2D<uint2> uav, uint2 address, uint2 value)
|
||||
{
|
||||
uint opcode = g_IntelExt.IncrementCounter();
|
||||
uav[uint2(opcode, opcode)] = uint2(0, 0); //dummy instruction to get the resource handle
|
||||
g_IntelExt[opcode].opcode = INTEL_EXT_UINT64_ATOMIC;
|
||||
g_IntelExt[opcode].src0u.xy = address;
|
||||
g_IntelExt[opcode].src1u.xy = value;
|
||||
g_IntelExt[opcode].src2u.x = INTEL_EXT_ATOMIC_XCHG;
|
||||
|
||||
return g_IntelExt[opcode].dst0u.xy;
|
||||
}
|
||||
|
||||
// Interlocked compare exchange
|
||||
uint2 IntelExt_InterlockedCompareExchangeUint64(RWTexture2D<uint2> uav, uint2 address, uint2 cmp_value, uint2 xchg_value)
|
||||
{
|
||||
uint opcode = g_IntelExt.IncrementCounter();
|
||||
uav[uint2(opcode, opcode)] = uint2(0, 0); //dummy instruction to get the resource handle
|
||||
g_IntelExt[opcode].opcode = INTEL_EXT_UINT64_ATOMIC;
|
||||
g_IntelExt[opcode].src0u.xy = address;
|
||||
g_IntelExt[opcode].src1u.xy = cmp_value;
|
||||
g_IntelExt[opcode].src1u.zw = xchg_value;
|
||||
g_IntelExt[opcode].src2u.x = INTEL_EXT_ATOMIC_CMPXCHG;
|
||||
|
||||
return g_IntelExt[opcode].dst0u.xy;
|
||||
}
|
||||
@ -72,7 +72,7 @@ void IntelExt_Init()
|
||||
}
|
||||
|
||||
|
||||
// uint64 atomics
|
||||
// uint64 typed atomics
|
||||
// Interlocked max
|
||||
uint2 IntelExt_InterlockedMaxUint64(RWTexture2D<uint2> uav, uint2 address, uint2 value)
|
||||
{
|
||||
@ -85,3 +85,95 @@ uint2 IntelExt_InterlockedMaxUint64(RWTexture2D<uint2> uav, uint2 address, uint2
|
||||
|
||||
return g_IntelExt[opcode].dst0u.xy;
|
||||
}
|
||||
|
||||
// Interlocked min
|
||||
uint2 IntelExt_InterlockedMinUint64(RWTexture2D<uint2> uav, uint2 address, uint2 value)
|
||||
{
|
||||
uint opcode = g_IntelExt.IncrementCounter();
|
||||
uav[uint2(opcode, opcode)] = uint2(0, 0); //dummy instruction to get the resource handle
|
||||
g_IntelExt[opcode].opcode = INTEL_EXT_UINT64_ATOMIC;
|
||||
g_IntelExt[opcode].src0u.xy = address;
|
||||
g_IntelExt[opcode].src1u.xy = value;
|
||||
g_IntelExt[opcode].src2u.x = INTEL_EXT_ATOMIC_MIN;
|
||||
|
||||
return g_IntelExt[opcode].dst0u.xy;
|
||||
}
|
||||
|
||||
// Interlocked and
|
||||
uint2 IntelExt_InterlockedAndUint64(RWTexture2D<uint2> uav, uint2 address, uint2 value)
|
||||
{
|
||||
uint opcode = g_IntelExt.IncrementCounter();
|
||||
uav[uint2(opcode, opcode)] = uint2(0, 0); //dummy instruction to get the resource handle
|
||||
g_IntelExt[opcode].opcode = INTEL_EXT_UINT64_ATOMIC;
|
||||
g_IntelExt[opcode].src0u.xy = address;
|
||||
g_IntelExt[opcode].src1u.xy = value;
|
||||
g_IntelExt[opcode].src2u.x = INTEL_EXT_ATOMIC_AND;
|
||||
|
||||
return g_IntelExt[opcode].dst0u.xy;
|
||||
}
|
||||
|
||||
// Interlocked or
|
||||
uint2 IntelExt_InterlockedOrUint64(RWTexture2D<uint2> uav, uint2 address, uint2 value)
|
||||
{
|
||||
uint opcode = g_IntelExt.IncrementCounter();
|
||||
uav[uint2(opcode, opcode)] = uint2(0, 0); //dummy instruction to get the resource handle
|
||||
g_IntelExt[opcode].opcode = INTEL_EXT_UINT64_ATOMIC;
|
||||
g_IntelExt[opcode].src0u.xy = address;
|
||||
g_IntelExt[opcode].src1u.xy = value;
|
||||
g_IntelExt[opcode].src2u.x = INTEL_EXT_ATOMIC_OR;
|
||||
|
||||
return g_IntelExt[opcode].dst0u.xy;
|
||||
}
|
||||
|
||||
// Interlocked add
|
||||
uint2 IntelExt_InterlockedAddUint64(RWTexture2D<uint2> uav, uint2 address, uint2 value)
|
||||
{
|
||||
uint opcode = g_IntelExt.IncrementCounter();
|
||||
uav[uint2(opcode, opcode)] = uint2(0, 0); //dummy instruction to get the resource handle
|
||||
g_IntelExt[opcode].opcode = INTEL_EXT_UINT64_ATOMIC;
|
||||
g_IntelExt[opcode].src0u.xy = address;
|
||||
g_IntelExt[opcode].src1u.xy = value;
|
||||
g_IntelExt[opcode].src2u.x = INTEL_EXT_ATOMIC_ADD;
|
||||
|
||||
return g_IntelExt[opcode].dst0u.xy;
|
||||
}
|
||||
|
||||
// Interlocked xor
|
||||
uint2 IntelExt_InterlockedXorUint64(RWTexture2D<uint2> uav, uint2 address, uint2 value)
|
||||
{
|
||||
uint opcode = g_IntelExt.IncrementCounter();
|
||||
uav[uint2(opcode, opcode)] = uint2(0, 0); //dummy instruction to get the resource handle
|
||||
g_IntelExt[opcode].opcode = INTEL_EXT_UINT64_ATOMIC;
|
||||
g_IntelExt[opcode].src0u.xy = address;
|
||||
g_IntelExt[opcode].src1u.xy = value;
|
||||
g_IntelExt[opcode].src2u.x = INTEL_EXT_ATOMIC_XOR;
|
||||
|
||||
return g_IntelExt[opcode].dst0u.xy;
|
||||
}
|
||||
|
||||
// Interlocked xor
|
||||
uint2 IntelExt_InterlockedExchangeUint64(RWTexture2D<uint2> uav, uint2 address, uint2 value)
|
||||
{
|
||||
uint opcode = g_IntelExt.IncrementCounter();
|
||||
uav[uint2(opcode, opcode)] = uint2(0, 0); //dummy instruction to get the resource handle
|
||||
g_IntelExt[opcode].opcode = INTEL_EXT_UINT64_ATOMIC;
|
||||
g_IntelExt[opcode].src0u.xy = address;
|
||||
g_IntelExt[opcode].src1u.xy = value;
|
||||
g_IntelExt[opcode].src2u.x = INTEL_EXT_ATOMIC_XCHG;
|
||||
|
||||
return g_IntelExt[opcode].dst0u.xy;
|
||||
}
|
||||
|
||||
// Interlocked compare exchange
|
||||
uint2 IntelExt_InterlockedCompareExchangeUint64(RWTexture2D<uint2> uav, uint2 address, uint2 cmp_value, uint2 xchg_value)
|
||||
{
|
||||
uint opcode = g_IntelExt.IncrementCounter();
|
||||
uav[uint2(opcode, opcode)] = uint2(0, 0); //dummy instruction to get the resource handle
|
||||
g_IntelExt[opcode].opcode = INTEL_EXT_UINT64_ATOMIC;
|
||||
g_IntelExt[opcode].src0u.xy = address;
|
||||
g_IntelExt[opcode].src1u.xy = cmp_value;
|
||||
g_IntelExt[opcode].src1u.zw = xchg_value;
|
||||
g_IntelExt[opcode].src2u.x = INTEL_EXT_ATOMIC_CMPXCHG;
|
||||
|
||||
return g_IntelExt[opcode].dst0u.xy;
|
||||
}
|
||||
Reference in New Issue
Block a user