shader/memory: Minor fixes in ATOM
This commit is contained in:
parent
e6f02d5725
commit
79970c9174
|
@ -27,29 +27,26 @@ using Tegra::Shader::StoreType;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
Node GetAtomOperation(AtomicOp op, bool is_signed, Node memory, Node data) {
|
OperationCode GetAtomOperation(AtomicOp op) {
|
||||||
const OperationCode operation_code = [op] {
|
switch (op) {
|
||||||
switch (op) {
|
case AtomicOp::Add:
|
||||||
case AtomicOp::Add:
|
return OperationCode::AtomicIAdd;
|
||||||
return OperationCode::AtomicIAdd;
|
case AtomicOp::Min:
|
||||||
case AtomicOp::Min:
|
return OperationCode::AtomicIMin;
|
||||||
return OperationCode::AtomicIMin;
|
case AtomicOp::Max:
|
||||||
case AtomicOp::Max:
|
return OperationCode::AtomicIMax;
|
||||||
return OperationCode::AtomicIMax;
|
case AtomicOp::And:
|
||||||
case AtomicOp::And:
|
return OperationCode::AtomicIAnd;
|
||||||
return OperationCode::AtomicIAnd;
|
case AtomicOp::Or:
|
||||||
case AtomicOp::Or:
|
return OperationCode::AtomicIOr;
|
||||||
return OperationCode::AtomicIOr;
|
case AtomicOp::Xor:
|
||||||
case AtomicOp::Xor:
|
return OperationCode::AtomicIXor;
|
||||||
return OperationCode::AtomicIXor;
|
case AtomicOp::Exch:
|
||||||
case AtomicOp::Exch:
|
return OperationCode::AtomicIExchange;
|
||||||
return OperationCode::AtomicIExchange;
|
default:
|
||||||
default:
|
UNIMPLEMENTED_MSG("op={}", static_cast<int>(op));
|
||||||
UNIMPLEMENTED_MSG("op={}", static_cast<int>(op));
|
return OperationCode::AtomicIAdd;
|
||||||
return OperationCode::AtomicIAdd;
|
}
|
||||||
}
|
|
||||||
}();
|
|
||||||
return SignedOperation(operation_code, is_signed, std::move(memory), std::move(data));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsUnaligned(Tegra::Shader::UniformType uniform_type) {
|
bool IsUnaligned(Tegra::Shader::UniformType uniform_type) {
|
||||||
|
@ -392,7 +389,9 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) {
|
||||||
instr.atom.operation == AtomicOp::SafeAdd,
|
instr.atom.operation == AtomicOp::SafeAdd,
|
||||||
"operation={}", static_cast<int>(instr.atom.operation.Value()));
|
"operation={}", static_cast<int>(instr.atom.operation.Value()));
|
||||||
UNIMPLEMENTED_IF_MSG(instr.atom.type == GlobalAtomicType::S64 ||
|
UNIMPLEMENTED_IF_MSG(instr.atom.type == GlobalAtomicType::S64 ||
|
||||||
instr.atom.type == GlobalAtomicType::U64,
|
instr.atom.type == GlobalAtomicType::U64 ||
|
||||||
|
instr.atom.type == GlobalAtomicType::F16x2_FTZ_RN ||
|
||||||
|
instr.atom.type == GlobalAtomicType::F32_FTZ_RN,
|
||||||
"type={}", static_cast<int>(instr.atom.type.Value()));
|
"type={}", static_cast<int>(instr.atom.type.Value()));
|
||||||
|
|
||||||
const auto [real_address, base_address, descriptor] =
|
const auto [real_address, base_address, descriptor] =
|
||||||
|
@ -403,11 +402,11 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool is_signed =
|
const bool is_signed =
|
||||||
instr.atoms.type == AtomicType::S32 || instr.atoms.type == AtomicType::S64;
|
instr.atom.type == GlobalAtomicType::S32 || instr.atom.type == GlobalAtomicType::S64;
|
||||||
Node gmem = MakeNode<GmemNode>(real_address, base_address, descriptor);
|
Node gmem = MakeNode<GmemNode>(real_address, base_address, descriptor);
|
||||||
Node value = GetAtomOperation(static_cast<AtomicOp>(instr.atom.operation), is_signed, gmem,
|
SetRegister(bb, instr.gpr0,
|
||||||
GetRegister(instr.gpr20));
|
SignedOperation(GetAtomOperation(instr.atom.operation), is_signed, gmem,
|
||||||
SetRegister(bb, instr.gpr0, std::move(value));
|
GetRegister(instr.gpr20)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OpCode::Id::ATOMS: {
|
case OpCode::Id::ATOMS: {
|
||||||
|
@ -422,10 +421,9 @@ u32 ShaderIR::DecodeMemory(NodeBlock& bb, u32 pc) {
|
||||||
const s32 offset = instr.atoms.GetImmediateOffset();
|
const s32 offset = instr.atoms.GetImmediateOffset();
|
||||||
Node address = GetRegister(instr.gpr8);
|
Node address = GetRegister(instr.gpr8);
|
||||||
address = Operation(OperationCode::IAdd, std::move(address), Immediate(offset));
|
address = Operation(OperationCode::IAdd, std::move(address), Immediate(offset));
|
||||||
Node value =
|
SetRegister(bb, instr.gpr0,
|
||||||
GetAtomOperation(static_cast<AtomicOp>(instr.atoms.operation), is_signed,
|
SignedOperation(GetAtomOperation(instr.atoms.operation), is_signed,
|
||||||
GetSharedMemory(std::move(address)), GetRegister(instr.gpr20));
|
GetSharedMemory(std::move(address)), GetRegister(instr.gpr20)));
|
||||||
SetRegister(bb, instr.gpr0, std::move(value));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OpCode::Id::AL2P: {
|
case OpCode::Id::AL2P: {
|
||||||
|
|
Loading…
Reference in New Issue