SWDEV-232428 - PAL Hostcall support

Since the majority of the Hostcall implementation now sits in the
commmon layer, the PAL backend simply just needs to invoke it. One thing
that is missing though is HSA signal support.

The newly added pal::Signal class is a light emulaion of what HSA
signals provide. The current implementation is just enough to get
Hostcall working, but it can be expanded in the future if needed to
fully emulate HSA signals.

The major difference for now between PAL and ROCm hostcall
implemenations is that PAL doesn't support blocking signals. This will
be enabled in the near future. For now use active wait for PAL.

Change-Id: I746557354ab9d71a7d4a31f9320fcc2fee5aee7f
This commit is contained in:
Vladislav Sytchenko
2021-03-08 13:48:44 -05:00
parent d9020e3416
commit 99e8ac55cd
12 changed files with 232 additions and 9 deletions
+9 -4
View File
@@ -300,7 +300,7 @@ class HostcallListener {
}
void terminate();
bool initialize(amd::Device &dev);
bool initialize(const amd::Device &dev);
};
HostcallListener* hostcallListener = nullptr;
@@ -360,9 +360,14 @@ void HostcallListener::removeBuffer(HostcallBuffer* buffer) {
buffers_.erase(buffer);
}
bool HostcallListener::initialize(amd::Device &dev) {
bool HostcallListener::initialize(const amd::Device &dev) {
doorbell_ = dev.createSignal();
if ((doorbell_ == nullptr) || !doorbell_->Init(SIGNAL_INIT, device::Signal::WaitState::Blocked)) {
#ifdef WITH_PAL_DEVICE
auto ws = device::Signal::WaitState::Active;
#elif WITH_HSA_DEVICE
auto ws = device::Signal::WaitState::Blocked;
#endif
if ((doorbell_ == nullptr) || !doorbell_->Init(dev, SIGNAL_INIT, ws)) {
return false;
}
@@ -377,7 +382,7 @@ bool HostcallListener::initialize(amd::Device &dev) {
return true;
}
bool enableHostcalls(amd::Device &dev, void* bfr, uint32_t numPackets) {
bool enableHostcalls(const amd::Device &dev, void* bfr, uint32_t numPackets) {
auto buffer = reinterpret_cast<HostcallBuffer*>(bfr);
buffer->initialize(numPackets);