P4 to Git Change 2037301 by ssahasra@ssahasra-hip-vdi on 2019/11/26 22:42:25

SWDEV-204782 - introduce hostcall

	Hostcall is a service that allows a kernel to submit requests to the
	host using shared buffers, and block until a response is received. This
	will eventually replace the shared buffer currently used for printf, and
	repurposes the same hidden kernel argument.

	When the runtime launches a kernel that requires the hostcall service it
	performs the following actions:
	- Launch a hostcall listener thread if it is not already running.
	- Locate the hostcall buffer for the corresponding hardware queue, or
	  create a new one.
	- Register the new hostcall buffer with the listener thread.
	- Set the hostcall buffer pointer as an implicit argument to the kernel.

Affected files ...

... //depot/stg/opencl/drivers/opencl/make/hip.git/tests/Makefile#21 edit
... //depot/stg/opencl/drivers/opencl/make/hip.git/tests/build/Makefile.hip_tests#31 edit
... //depot/stg/opencl/drivers/opencl/make/hip.git/tests/scripts/hip_hostcall_tests.txt#1 add
... //depot/stg/opencl/drivers/opencl/make/hip.git/tests/scripts/run_all_tests.sh#22 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/devkernel.cpp#30 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/devkernel.hpp#19 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#143 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.hpp#45 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rochostcall.cpp#1 add
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rochostcall.hpp#1 add
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#92 edit


[ROCm/clr commit: 416f273e94]
This commit is contained in:
foreman
2019-11-26 22:44:29 -05:00
parent c2b60225b3
commit 9c9639a0e3
7 changed files with 539 additions and 3 deletions
@@ -13,6 +13,7 @@
#include "platform/command.hpp"
#include "platform/memory.hpp"
#include "platform/sampler.hpp"
#include "rochostcall.hpp"
#include "utils/debug.hpp"
#include "os/os.hpp"
#include "amd_hsa_kernel_code.h"
@@ -2075,6 +2076,19 @@ bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes, const
}
break;
}
case amd::KernelParameterDescriptor::HiddenHostcallBuffer: {
if (amd::IS_HIP) {
auto buffer = roc_device_.getOrCreateHostcallBuffer(gpu_queue_);
if (!buffer) {
ClPrint(amd::LOG_ERROR, amd::LOG_KERN,
"Kernel expects a hostcall buffer, but none found");
return false;
}
assert(it.size_ == sizeof(buffer) && "check the sizes");
WriteAqlArgAt(const_cast<address>(parameters), &buffer, it.size_, it.offset_);
}
break;
}
case amd::KernelParameterDescriptor::HiddenDefaultQueue: {
uint64_t vqVA = 0;
amd::DeviceQueue* defQueue = kernel.program().context().defDeviceQueue(dev());