Introduce per-channel sequence number for invalidation tracking

For cases like shaders, which may be uploaded through I2M (which no longer causes an execution) we need a way to cause an invalidation on all writes
This commit is contained in:
Billy Laws 2022-11-12 13:58:15 +00:00
parent 97e3f7fd34
commit 06095918a9
4 changed files with 10 additions and 1 deletions

View File

@ -13,5 +13,9 @@ namespace skyline::soc::gm20b {
keplerCompute{state, *this}, keplerCompute{state, *this},
inline2Memory{state, *this}, inline2Memory{state, *this},
gpfifo{state, *this, numEntries}, gpfifo{state, *this, numEntries},
globalChannelLock{state.gpu->channelLock} {} globalChannelLock{state.gpu->channelLock} {
executor.AddFlushCallback([this] {
channelSequenceNumber++;
});
}
} }

View File

@ -31,6 +31,7 @@ namespace skyline::soc::gm20b {
engine::Inline2Memory inline2Memory; engine::Inline2Memory inline2Memory;
ChannelGpfifo gpfifo; ChannelGpfifo gpfifo;
std::mutex &globalChannelLock; std::mutex &globalChannelLock;
size_t channelSequenceNumber{};
ChannelContext(const DeviceState &state, std::shared_ptr<AddressSpaceContext> asCtx, size_t numEntries); ChannelContext(const DeviceState &state, std::shared_ptr<AddressSpaceContext> asCtx, size_t numEntries);

View File

@ -26,6 +26,7 @@ namespace skyline::soc::gm20b::engine {
// Wait forever for another channel to increment // Wait forever for another channel to increment
channelCtx.executor.Submit();
channelCtx.Unlock(); channelCtx.Unlock();
syncpoints.at(action.index).Wait(registers.syncpoint->payload, std::chrono::steady_clock::duration::max()); syncpoints.at(action.index).Wait(registers.syncpoint->payload, std::chrono::steady_clock::duration::max());
channelCtx.Lock(); channelCtx.Lock();
@ -44,6 +45,7 @@ namespace skyline::soc::gm20b::engine {
switch (action.operation) { switch (action.operation) {
case Registers::Semaphore::Operation::Acquire: case Registers::Semaphore::Operation::Acquire:
Logger::Debug("Acquire semaphore: 0x{:X} payload: {}", address, registers.semaphore->payload); Logger::Debug("Acquire semaphore: 0x{:X} payload: {}", address, registers.semaphore->payload);
channelCtx.executor.Submit();
channelCtx.Unlock(); channelCtx.Unlock();
while (channelCtx.asCtx->gmmu.Read<u32>(address) != registers.semaphore->payload) while (channelCtx.asCtx->gmmu.Read<u32>(address) != registers.semaphore->payload)
@ -57,6 +59,7 @@ namespace skyline::soc::gm20b::engine {
break; break;
case Registers::Semaphore::Operation::AcqGeq : case Registers::Semaphore::Operation::AcqGeq :
Logger::Debug("Acquire semaphore: 0x{:X} payload: {}", address, registers.semaphore->payload); Logger::Debug("Acquire semaphore: 0x{:X} payload: {}", address, registers.semaphore->payload);
channelCtx.executor.Submit();
channelCtx.Unlock(); channelCtx.Unlock();
while (channelCtx.asCtx->gmmu.Read<u32>(address) < registers.semaphore->payload) while (channelCtx.asCtx->gmmu.Read<u32>(address) < registers.semaphore->payload)

View File

@ -21,6 +21,7 @@ namespace skyline::soc::gm20b::engine {
if (state.launchDma.layout == RegisterState::DmaDstMemoryLayout::Pitch && state.lineCount == 1) { if (state.launchDma.layout == RegisterState::DmaDstMemoryLayout::Pitch && state.lineCount == 1) {
Logger::Debug("range: 0x{:X} -> 0x{:X}", u64{state.offsetOut}, u64{state.offsetOut} + buffer.size() * 0x4); Logger::Debug("range: 0x{:X} -> 0x{:X}", u64{state.offsetOut}, u64{state.offsetOut} + buffer.size() * 0x4);
channelCtx.channelSequenceNumber++;
interconnect.Upload(u64{state.offsetOut}, span{buffer}); interconnect.Upload(u64{state.offsetOut}, span{buffer});
} else { } else {
channelCtx.executor.Submit(); channelCtx.executor.Submit();