mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
fix(ocl): Fix potential mem leak + simplify code
- Fix potential memleak in case ASSERT returns false and test gets aborted - Remove not needed function argument Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
5936734550
commit
f1c64adb3c
@@ -461,17 +461,13 @@ void EncodeSurfaceState<Family>::getSshAlignedPointer(uintptr_t &ptr, size_t &of
|
||||
// Returned binding table pointer is relative to given heap (which is assumed to be the Surface state base addess)
|
||||
// as required by the INTERFACE_DESCRIPTOR_DATA.
|
||||
template <typename Family>
|
||||
size_t EncodeSurfaceState<Family>::pushBindingTableAndSurfaceStates(IndirectHeap &dstHeap, size_t bindingTableCount,
|
||||
size_t EncodeSurfaceState<Family>::pushBindingTableAndSurfaceStates(IndirectHeap &dstHeap,
|
||||
const void *srcKernelSsh, size_t srcKernelSshSize,
|
||||
size_t numberOfBindingTableStates, size_t offsetOfBindingTable) {
|
||||
using BINDING_TABLE_STATE = typename Family::BINDING_TABLE_STATE;
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename Family::INTERFACE_DESCRIPTOR_DATA;
|
||||
using RENDER_SURFACE_STATE = typename Family::RENDER_SURFACE_STATE;
|
||||
|
||||
if (bindingTableCount == 0) {
|
||||
// according to compiler, kernel does not reference BTIs to stateful surfaces, so there's nothing to patch
|
||||
return 0;
|
||||
}
|
||||
size_t sshSize = srcKernelSshSize;
|
||||
DEBUG_BREAK_IF(srcKernelSsh == nullptr);
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
|
||||
ssh = container.getHeapWithRequiredSizeAndAlignment(HeapType::SURFACE_STATE, args.dispatchInterface->getSurfaceStateHeapDataSize(), BINDING_TABLE_STATE::SURFACESTATEPOINTER_ALIGN_SIZE);
|
||||
}
|
||||
bindingTablePointer = static_cast<uint32_t>(EncodeSurfaceState<Family>::pushBindingTableAndSurfaceStates(
|
||||
*ssh, bindingTableStateCount,
|
||||
*ssh,
|
||||
args.dispatchInterface->getSurfaceStateHeapData(),
|
||||
args.dispatchInterface->getSurfaceStateHeapDataSize(), bindingTableStateCount,
|
||||
kernelDescriptor.payloadMappings.bindingTable.tableOffset));
|
||||
|
||||
@@ -121,7 +121,7 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
|
||||
ssh = container.getHeapWithRequiredSizeAndAlignment(HeapType::SURFACE_STATE, args.dispatchInterface->getSurfaceStateHeapDataSize(), BINDING_TABLE_STATE::SURFACESTATEPOINTER_ALIGN_SIZE);
|
||||
}
|
||||
bindingTablePointer = static_cast<uint32_t>(EncodeSurfaceState<Family>::pushBindingTableAndSurfaceStates(
|
||||
*ssh, bindingTableStateCount,
|
||||
*ssh,
|
||||
args.dispatchInterface->getSurfaceStateHeapData(),
|
||||
args.dispatchInterface->getSurfaceStateHeapDataSize(), bindingTableStateCount,
|
||||
kernelDescriptor.payloadMappings.bindingTable.tableOffset));
|
||||
|
||||
@@ -44,7 +44,7 @@ struct EncodeSurfaceState {
|
||||
static bool doBindingTablePrefetch();
|
||||
static bool isBindingTablePrefetchPreferred();
|
||||
|
||||
static size_t pushBindingTableAndSurfaceStates(IndirectHeap &dstHeap, size_t bindingTableCount,
|
||||
static size_t pushBindingTableAndSurfaceStates(IndirectHeap &dstHeap,
|
||||
const void *srcKernelSsh, size_t srcKernelSshSize,
|
||||
size_t numberOfBindingTableStates, size_t offsetOfBindingTable);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user