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
Esse commit está contido em:
@@ -28,6 +28,8 @@
|
||||
#include "pro/prodriver.hpp"
|
||||
#endif
|
||||
#include "platform/sampler.hpp"
|
||||
#include "rochostcall.hpp"
|
||||
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
@@ -1916,10 +1918,52 @@ void Device::releaseQueue(hsa_queue_t* queue) {
|
||||
}
|
||||
ClPrint(amd::LOG_INFO, amd::LOG_QUEUE, "deleting hardware queue %p with refCount 0", queue);
|
||||
|
||||
if (qInfo.hostcallBuffer_) {
|
||||
ClPrint(amd::LOG_INFO, amd::LOG_QUEUE, "deleting hostcall buffer %p for hardware queue %p",
|
||||
qInfo.hostcallBuffer_, queue);
|
||||
disableHostcalls(qInfo.hostcallBuffer_, queue);
|
||||
context().svmFree(qInfo.hostcallBuffer_);
|
||||
}
|
||||
|
||||
ClPrint(amd::LOG_INFO, amd::LOG_QUEUE, "deleting hardware queue %p with refCount 0", queue);
|
||||
hsa_queue_destroy(queue);
|
||||
queuePool_.erase(qIter);
|
||||
}
|
||||
|
||||
void* Device::getOrCreateHostcallBuffer(hsa_queue_t* queue) {
|
||||
auto qIter = queuePool_.find(queue);
|
||||
assert(qIter != queuePool_.end());
|
||||
|
||||
auto& qInfo = qIter->second;
|
||||
if (qInfo.hostcallBuffer_) {
|
||||
return qInfo.hostcallBuffer_;
|
||||
}
|
||||
|
||||
// The number of packets required in each buffer is at least equal to the
|
||||
// maximum number of waves supported by the device.
|
||||
auto wavesPerCu = info().maxThreadsPerCU_ / info().wavefrontWidth_;
|
||||
auto numPackets = info().maxComputeUnits_ * wavesPerCu;
|
||||
|
||||
auto size = getHostcallBufferSize(numPackets);
|
||||
auto align = getHostcallBufferAlignment();
|
||||
|
||||
void* buffer = context().svmAlloc(size, align, CL_MEM_SVM_FINE_GRAIN_BUFFER | CL_MEM_SVM_ATOMICS);
|
||||
if (!buffer) {
|
||||
ClPrint(amd::LOG_ERROR, amd::LOG_QUEUE,
|
||||
"Failed to create hostcall buffer for hardware queue %p", queue);
|
||||
return nullptr;
|
||||
}
|
||||
ClPrint(amd::LOG_INFO, amd::LOG_QUEUE, "Created hostcall buffer %p for hardware queue %p", buffer,
|
||||
queue);
|
||||
qInfo.hostcallBuffer_ = buffer;
|
||||
if (!enableHostcalls(buffer, numPackets, queue)) {
|
||||
ClPrint(amd::LOG_ERROR, amd::LOG_QUEUE, "Failed to register hostcall buffer %p with listener",
|
||||
buffer);
|
||||
return nullptr;
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
bool Device::findLinkTypeAndHopCount(amd::Device* other_device,
|
||||
uint32_t* link_type, uint32_t* hop_count) {
|
||||
hsa_amd_memory_pool_link_info_t link_info;
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário