gpu: shader: fix inout arg handling

fix shader memory changes test
This commit is contained in:
DH 2024-10-17 15:22:06 +03:00
parent f5b883aa83
commit 19939727e3
5 changed files with 33 additions and 22 deletions

View file

@ -1072,7 +1072,7 @@ Cache::Shader Cache::Tag::getShader(const ShaderKey &key,
readMemory(&result->magic, rx::AddressRange::fromBeginSize(
key.address, sizeof(result->magic)));
for (auto entry : converted->info.memoryMap) {
for (auto entry : result->info.memoryMap) {
auto entryRange =
rx::AddressRange::fromBeginEnd(entry.beginAddress, entry.endAddress);
auto &inserted = result->usedMemory.emplace_back();
@ -1194,7 +1194,8 @@ Cache::Buffer Cache::Tag::getBuffer(rx::AddressRange range, Access access) {
addressRange.beginAddress(),
addressRange.size()) ||
!mParent->isInSync(addressRange, cached->tagId)) {
mParent->flushImages(*this, range);
getScheduler().wait();
mParent->trackUpdate(EntryType::HostVisibleBuffer, addressRange, it.get(),
getReadId(), cached->expensive());
amdgpu::RemoteMemory memory{mParent->mVmId};

View file

@ -728,20 +728,6 @@ static void expToSpv(GcnConverter &converter, gcn::Stage stage,
auto channelType = context.getTypeFloat32();
if (swizzle == 0 && done) {
auto termBuilder = gcn::Builder::createAppend(
context, context.layout.getOrCreateFunctions(context));
auto terminateFn = termBuilder.createSpvFunction(
loc, context.getTypeVoid(), ir::spv::FunctionControl::None,
context.getTypeFunction(context.getTypeVoid(), {}));
termBuilder.createSpvLabel(loc);
termBuilder.createSpvKill(loc);
termBuilder.createSpvFunctionEnd(loc);
builder.createSpvFunctionCall(loc, context.getTypeVoid(), terminateFn,
{});
}
for (int channel = 0; channel < 4; ++channel) {
if (~swizzle & (1 << channel)) {
continue;
@ -1111,7 +1097,8 @@ static void instructionsToSpv(GcnConverter &converter, gcn::Import &importer,
if (resultType == ir::spv::OpTypeInt) {
auto floatType =
context.getTypeFloat(*resultType.getOperand(0).getAsInt32());
value = builder.createSpvBitcast(resultType.getLocation(), floatType, value);
value = builder.createSpvBitcast(resultType.getLocation(), floatType,
value);
resultType = floatType;
}
@ -1716,7 +1703,8 @@ gcn::convertToSpv(Context &context, ir::Region body,
ir::spv::Capability::Int64Atomics);
}
capabilities.createSpvCapability(context.getUnknownLocation(), ir::spv::Capability::ImageQuery);
capabilities.createSpvCapability(context.getUnknownLocation(),
ir::spv::Capability::ImageQuery);
extensions.createSpvExtension(context.getUnknownLocation(),
"SPV_KHR_physical_storage_buffer");

View file

@ -862,6 +862,28 @@ readSoppInst(GcnInstruction &inst, std::uint64_t &address,
}
void GcnOperand::print(std::ostream &os) const {
if (neg) {
os << '-';
}
if (abs) {
os << "abs ";
}
if (clamp) {
os << "clamp ";
}
switch (omod) {
case 1:
os << "2 * ";
break;
case 2:
os << "4 * ";
break;
case 3:
os << "0.5 * ";
break;
}
switch (kind) {
case Kind::Invalid:
os << "<invalid>";

View file

@ -561,6 +561,8 @@ ir::Value spv::Context::createOutput(ir::Location loc, int index) {
if (result == nullptr) {
auto floatType = getTypeFloat32();
auto float32x4Type = getTypeVector(floatType, 4);
auto nullValue = getNull(float32x4Type);
auto variableType =
getTypePointer(ir::spv::StorageClass::Output, float32x4Type);
@ -570,7 +572,7 @@ ir::Value spv::Context::createOutput(ir::Location loc, int index) {
Builder::createAppend(*this, layout.getOrCreateAnnotations(*this));
auto variable = globals.createSpvVariable(loc, variableType,
ir::spv::StorageClass::Output);
ir::spv::StorageClass::Output, nullValue);
annotations.createSpvDecorate(loc, variable,
ir::spv::Decoration::Location(index));

View file

@ -1283,7 +1283,7 @@ static ir::Value deserializeGcnRegion(
inst.addOperand(createOperandRead(loc, paramBuilder, uint32TV, op));
}
if (isaInst == ir::exp::EXP && isaInst.getOperand(1).value != 0) {
if (isaInst == ir::exp::EXP) {
createExecTest();
}
continue;
@ -1381,10 +1381,8 @@ static ir::Value deserializeGcnRegion(
converter.getTypePointer(ir::spv::StorageClass::Function, paramType),
ir::spv::StorageClass::Function);
if ((paramInfo.access & Access::Read) == Access::Read) {
auto result = createOperandRead(loc, builder, paramType, op);
builder.createSpvStore(loc, arg, result);
}
callArgs.push_back(arg);
}