SWDEV-467102 - Hidden heap init for graph capture
If the graph has kernels that does device side allocation, during packet capture, heap is
allocated because heap pointer has to be added to the AQL packet, and initialized during
graph launch.
Handle race with wait when 2 kernels with device heap are enqueued on multiple streams.
Change-Id: I45933b77fcaf7bc8fdf1bc906462e32b5d8d3688
[ROCm/clr commit: 57156c524d]
This commit is contained in:
committed by
Anusha Godavarthy Surya
parent
c8bc9e3f2e
commit
291f079669
@@ -2962,6 +2962,8 @@ static inline void nontemporalMemcpy(
|
||||
#endif
|
||||
}
|
||||
|
||||
void VirtualGPU::HiddenHeapInit() { const_cast<Device&>(dev()).HiddenHeapInit(*this); }
|
||||
|
||||
// ================================================================================================
|
||||
bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes,
|
||||
const amd::Kernel& kernel, const_address parameters, void* eventHandle,
|
||||
@@ -3016,7 +3018,7 @@ bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes,
|
||||
|
||||
amd::Memory* const* memories =
|
||||
reinterpret_cast<amd::Memory* const*>(parameters + kernelParams.memoryObjOffset());
|
||||
|
||||
bool isGraphCapture = vcmd != nullptr && vcmd->getCapturingState();
|
||||
for (int j = 0; j < iteration; j++) {
|
||||
// Reset global size for dimension dim if split is needed
|
||||
if (dim != -1) {
|
||||
@@ -3143,6 +3145,10 @@ bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes,
|
||||
const_cast<Device&>(dev()).HiddenHeapAlloc(*this);
|
||||
}
|
||||
if (dev().HeapBuffer() != nullptr) {
|
||||
// Initialize hidden heap buffer
|
||||
if (!isGraphCapture) {
|
||||
const_cast<Device&>(dev()).HiddenHeapInit(*this);
|
||||
}
|
||||
// Add heap pointer to the code
|
||||
size_t heap_ptr = static_cast<size_t>(dev().HeapBuffer()->virtualAddress());
|
||||
WriteAqlArgAt(hidden_arguments, heap_ptr, it.size_, it.offset_);
|
||||
@@ -3225,7 +3231,6 @@ bool VirtualGPU::submitKernelInternal(const amd::NDRangeContainer& sizes,
|
||||
}
|
||||
|
||||
address argBuffer = hidden_arguments;
|
||||
bool isGraphCapture = vcmd != nullptr && vcmd->getCapturingState();
|
||||
size_t argSize = std::min(gpuKernel.KernargSegmentByteSize(), signature.paramsSize());
|
||||
|
||||
// Find all parameters for the current kernel
|
||||
|
||||
Reference in New Issue
Block a user