mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-12 20:55:56 +00:00
Support for BUFFER_ATOMIC_S/UMIN_X2 (#3182)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / linux-qt-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / linux-qt-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
* Fix BufferAtomicS/UMax64 SPIR-V emitting * Support for BUFFER_ATOMIC_S/UMIN_X2
This commit is contained in:
parent
9eae6b57ce
commit
7431b30005
8 changed files with 40 additions and 2 deletions
|
@ -200,10 +200,18 @@ Id EmitBufferAtomicSMin32(EmitContext& ctx, IR::Inst* inst, u32 handle, Id addre
|
||||||
return BufferAtomicU32(ctx, inst, handle, address, value, &Sirit::Module::OpAtomicSMin);
|
return BufferAtomicU32(ctx, inst, handle, address, value, &Sirit::Module::OpAtomicSMin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Id EmitBufferAtomicSMin64(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value) {
|
||||||
|
return BufferAtomicU64(ctx, inst, handle, address, value, &Sirit::Module::OpAtomicSMin);
|
||||||
|
}
|
||||||
|
|
||||||
Id EmitBufferAtomicUMin32(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value) {
|
Id EmitBufferAtomicUMin32(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value) {
|
||||||
return BufferAtomicU32(ctx, inst, handle, address, value, &Sirit::Module::OpAtomicUMin);
|
return BufferAtomicU32(ctx, inst, handle, address, value, &Sirit::Module::OpAtomicUMin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Id EmitBufferAtomicUMin64(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value) {
|
||||||
|
return BufferAtomicU64(ctx, inst, handle, address, value, &Sirit::Module::OpAtomicUMin);
|
||||||
|
}
|
||||||
|
|
||||||
Id EmitBufferAtomicFMin32(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value) {
|
Id EmitBufferAtomicFMin32(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value) {
|
||||||
if (ctx.profile.supports_buffer_fp32_atomic_min_max) {
|
if (ctx.profile.supports_buffer_fp32_atomic_min_max) {
|
||||||
return BufferAtomicU32<true>(ctx, inst, handle, address, value,
|
return BufferAtomicU32<true>(ctx, inst, handle, address, value,
|
||||||
|
|
|
@ -91,7 +91,9 @@ Id EmitBufferAtomicIAdd32(EmitContext& ctx, IR::Inst* inst, u32 handle, Id addre
|
||||||
Id EmitBufferAtomicIAdd64(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value);
|
Id EmitBufferAtomicIAdd64(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value);
|
||||||
Id EmitBufferAtomicISub32(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value);
|
Id EmitBufferAtomicISub32(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value);
|
||||||
Id EmitBufferAtomicSMin32(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value);
|
Id EmitBufferAtomicSMin32(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value);
|
||||||
|
Id EmitBufferAtomicSMin64(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value);
|
||||||
Id EmitBufferAtomicUMin32(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value);
|
Id EmitBufferAtomicUMin32(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value);
|
||||||
|
Id EmitBufferAtomicUMin64(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value);
|
||||||
Id EmitBufferAtomicFMin32(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value);
|
Id EmitBufferAtomicFMin32(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value);
|
||||||
Id EmitBufferAtomicSMax32(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value);
|
Id EmitBufferAtomicSMax32(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value);
|
||||||
Id EmitBufferAtomicSMax64(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value);
|
Id EmitBufferAtomicSMax64(EmitContext& ctx, IR::Inst* inst, u32 handle, Id address, Id value);
|
||||||
|
|
|
@ -74,8 +74,12 @@ void Translator::EmitVectorMemory(const GcnInst& inst) {
|
||||||
return BUFFER_ATOMIC(AtomicOp::CmpSwap, inst);
|
return BUFFER_ATOMIC(AtomicOp::CmpSwap, inst);
|
||||||
case Opcode::BUFFER_ATOMIC_SMIN:
|
case Opcode::BUFFER_ATOMIC_SMIN:
|
||||||
return BUFFER_ATOMIC(AtomicOp::Smin, inst);
|
return BUFFER_ATOMIC(AtomicOp::Smin, inst);
|
||||||
|
case Opcode::BUFFER_ATOMIC_SMIN_X2:
|
||||||
|
return BUFFER_ATOMIC<IR::U64>(AtomicOp::Smin, inst);
|
||||||
case Opcode::BUFFER_ATOMIC_UMIN:
|
case Opcode::BUFFER_ATOMIC_UMIN:
|
||||||
return BUFFER_ATOMIC(AtomicOp::Umin, inst);
|
return BUFFER_ATOMIC(AtomicOp::Umin, inst);
|
||||||
|
case Opcode::BUFFER_ATOMIC_UMIN_X2:
|
||||||
|
return BUFFER_ATOMIC<IR::U64>(AtomicOp::Umin, inst);
|
||||||
case Opcode::BUFFER_ATOMIC_SMAX:
|
case Opcode::BUFFER_ATOMIC_SMAX:
|
||||||
return BUFFER_ATOMIC(AtomicOp::Smax, inst);
|
return BUFFER_ATOMIC(AtomicOp::Smax, inst);
|
||||||
case Opcode::BUFFER_ATOMIC_SMAX_X2:
|
case Opcode::BUFFER_ATOMIC_SMAX_X2:
|
||||||
|
|
|
@ -500,8 +500,16 @@ Value IREmitter::BufferAtomicISub(const Value& handle, const Value& address, con
|
||||||
|
|
||||||
Value IREmitter::BufferAtomicIMin(const Value& handle, const Value& address, const Value& value,
|
Value IREmitter::BufferAtomicIMin(const Value& handle, const Value& address, const Value& value,
|
||||||
bool is_signed, BufferInstInfo info) {
|
bool is_signed, BufferInstInfo info) {
|
||||||
return is_signed ? Inst(Opcode::BufferAtomicSMin32, Flags{info}, handle, address, value)
|
switch (value.Type()) {
|
||||||
: Inst(Opcode::BufferAtomicUMin32, Flags{info}, handle, address, value);
|
case Type::U32:
|
||||||
|
return is_signed ? Inst(Opcode::BufferAtomicSMin32, Flags{info}, handle, address, value)
|
||||||
|
: Inst(Opcode::BufferAtomicUMin32, Flags{info}, handle, address, value);
|
||||||
|
case Type::U64:
|
||||||
|
return is_signed ? Inst(Opcode::BufferAtomicSMin64, Flags{info}, handle, address, value)
|
||||||
|
: Inst(Opcode::BufferAtomicUMin64, Flags{info}, handle, address, value);
|
||||||
|
default:
|
||||||
|
ThrowInvalidType(value.Type());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Value IREmitter::BufferAtomicFMin(const Value& handle, const Value& address, const Value& value,
|
Value IREmitter::BufferAtomicFMin(const Value& handle, const Value& address, const Value& value,
|
||||||
|
|
|
@ -70,7 +70,9 @@ bool Inst::MayHaveSideEffects() const noexcept {
|
||||||
case Opcode::BufferAtomicIAdd64:
|
case Opcode::BufferAtomicIAdd64:
|
||||||
case Opcode::BufferAtomicISub32:
|
case Opcode::BufferAtomicISub32:
|
||||||
case Opcode::BufferAtomicSMin32:
|
case Opcode::BufferAtomicSMin32:
|
||||||
|
case Opcode::BufferAtomicSMin64:
|
||||||
case Opcode::BufferAtomicUMin32:
|
case Opcode::BufferAtomicUMin32:
|
||||||
|
case Opcode::BufferAtomicUMin64:
|
||||||
case Opcode::BufferAtomicFMin32:
|
case Opcode::BufferAtomicFMin32:
|
||||||
case Opcode::BufferAtomicSMax32:
|
case Opcode::BufferAtomicSMax32:
|
||||||
case Opcode::BufferAtomicSMax64:
|
case Opcode::BufferAtomicSMax64:
|
||||||
|
|
|
@ -124,7 +124,9 @@ OPCODE(BufferAtomicIAdd32, U32, Opaq
|
||||||
OPCODE(BufferAtomicIAdd64, U64, Opaque, Opaque, U64 )
|
OPCODE(BufferAtomicIAdd64, U64, Opaque, Opaque, U64 )
|
||||||
OPCODE(BufferAtomicISub32, U32, Opaque, Opaque, U32 )
|
OPCODE(BufferAtomicISub32, U32, Opaque, Opaque, U32 )
|
||||||
OPCODE(BufferAtomicSMin32, U32, Opaque, Opaque, U32 )
|
OPCODE(BufferAtomicSMin32, U32, Opaque, Opaque, U32 )
|
||||||
|
OPCODE(BufferAtomicSMin64, U64, Opaque, Opaque, U64 )
|
||||||
OPCODE(BufferAtomicUMin32, U32, Opaque, Opaque, U32 )
|
OPCODE(BufferAtomicUMin32, U32, Opaque, Opaque, U32 )
|
||||||
|
OPCODE(BufferAtomicUMin64, U64, Opaque, Opaque, U64 )
|
||||||
OPCODE(BufferAtomicFMin32, U32, Opaque, Opaque, F32 )
|
OPCODE(BufferAtomicFMin32, U32, Opaque, Opaque, F32 )
|
||||||
OPCODE(BufferAtomicSMax32, U32, Opaque, Opaque, U32 )
|
OPCODE(BufferAtomicSMax32, U32, Opaque, Opaque, U32 )
|
||||||
OPCODE(BufferAtomicSMax64, U64, Opaque, Opaque, U64 )
|
OPCODE(BufferAtomicSMax64, U64, Opaque, Opaque, U64 )
|
||||||
|
|
|
@ -20,7 +20,9 @@ bool IsBufferAtomic(const IR::Inst& inst) {
|
||||||
case IR::Opcode::BufferAtomicIAdd64:
|
case IR::Opcode::BufferAtomicIAdd64:
|
||||||
case IR::Opcode::BufferAtomicISub32:
|
case IR::Opcode::BufferAtomicISub32:
|
||||||
case IR::Opcode::BufferAtomicSMin32:
|
case IR::Opcode::BufferAtomicSMin32:
|
||||||
|
case IR::Opcode::BufferAtomicSMin64:
|
||||||
case IR::Opcode::BufferAtomicUMin32:
|
case IR::Opcode::BufferAtomicUMin32:
|
||||||
|
case IR::Opcode::BufferAtomicUMin64:
|
||||||
case IR::Opcode::BufferAtomicFMin32:
|
case IR::Opcode::BufferAtomicFMin32:
|
||||||
case IR::Opcode::BufferAtomicSMax32:
|
case IR::Opcode::BufferAtomicSMax32:
|
||||||
case IR::Opcode::BufferAtomicSMax64:
|
case IR::Opcode::BufferAtomicSMax64:
|
||||||
|
@ -97,6 +99,10 @@ IR::Type BufferDataType(const IR::Inst& inst, AmdGpu::NumberFormat num_format) {
|
||||||
case IR::Opcode::LoadBufferU64:
|
case IR::Opcode::LoadBufferU64:
|
||||||
case IR::Opcode::StoreBufferU64:
|
case IR::Opcode::StoreBufferU64:
|
||||||
case IR::Opcode::BufferAtomicIAdd64:
|
case IR::Opcode::BufferAtomicIAdd64:
|
||||||
|
case IR::Opcode::BufferAtomicSMax64:
|
||||||
|
case IR::Opcode::BufferAtomicSMin64:
|
||||||
|
case IR::Opcode::BufferAtomicUMax64:
|
||||||
|
case IR::Opcode::BufferAtomicUMin64:
|
||||||
return IR::Type::U64;
|
return IR::Type::U64;
|
||||||
case IR::Opcode::LoadBufferFormatF32:
|
case IR::Opcode::LoadBufferFormatF32:
|
||||||
case IR::Opcode::StoreBufferFormatF32:
|
case IR::Opcode::StoreBufferFormatF32:
|
||||||
|
@ -118,6 +124,10 @@ u32 BufferAddressShift(const IR::Inst& inst, AmdGpu::DataFormat data_format) {
|
||||||
case IR::Opcode::LoadBufferU64:
|
case IR::Opcode::LoadBufferU64:
|
||||||
case IR::Opcode::StoreBufferU64:
|
case IR::Opcode::StoreBufferU64:
|
||||||
case IR::Opcode::BufferAtomicIAdd64:
|
case IR::Opcode::BufferAtomicIAdd64:
|
||||||
|
case IR::Opcode::BufferAtomicSMax64:
|
||||||
|
case IR::Opcode::BufferAtomicSMin64:
|
||||||
|
case IR::Opcode::BufferAtomicUMax64:
|
||||||
|
case IR::Opcode::BufferAtomicUMin64:
|
||||||
return 3;
|
return 3;
|
||||||
case IR::Opcode::LoadBufferFormatF32:
|
case IR::Opcode::LoadBufferFormatF32:
|
||||||
case IR::Opcode::StoreBufferFormatF32: {
|
case IR::Opcode::StoreBufferFormatF32: {
|
||||||
|
|
|
@ -102,7 +102,9 @@ void Visit(Info& info, const IR::Inst& inst) {
|
||||||
break;
|
break;
|
||||||
case IR::Opcode::BufferAtomicIAdd64:
|
case IR::Opcode::BufferAtomicIAdd64:
|
||||||
case IR::Opcode::BufferAtomicSMax64:
|
case IR::Opcode::BufferAtomicSMax64:
|
||||||
|
case IR::Opcode::BufferAtomicSMin64:
|
||||||
case IR::Opcode::BufferAtomicUMax64:
|
case IR::Opcode::BufferAtomicUMax64:
|
||||||
|
case IR::Opcode::BufferAtomicUMin64:
|
||||||
info.uses_buffer_int64_atomics = true;
|
info.uses_buffer_int64_atomics = true;
|
||||||
break;
|
break;
|
||||||
case IR::Opcode::LaneId:
|
case IR::Opcode::LaneId:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue