refactor(opencl/gtpin): Extend OCL/GTPin interface for stateless kernels

Remove blocking condition disallowing GTPin instrumentation using OCL interface
for stateless kernels (where SSH size == 0). It is required in order to
reintroduce support for GTPin on platforms supporting stateless
addressing model only.
- Always allow for adding surface state for GTPin use, even if kernel
SSH size == 0,
- Correct addSurfaceState function logic
- Remove and/or modify GTPin unit tests based on previous approach
- Wrap logic for pushing BT and SSH into separate function
- Minor code refactor; remove not needed test function

Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit is contained in:
Kacper Nowak
2023-03-07 22:43:53 +00:00
committed by Compute-Runtime-Automation
parent 3c2c2ee0c4
commit bac3c93e45
9 changed files with 81 additions and 401 deletions

View File

@@ -122,5 +122,6 @@ struct HardwareCommandsHelper : public PerThreadDataHelper {
static bool inlineDataProgrammingRequired(const Kernel &kernel);
static bool kernelUsesLocalIds(const Kernel &kernel);
static size_t checkForAdditionalBTAndSetBTPointer(IndirectHeap &ssh, const Kernel &kernel);
};
} // namespace NEO

View File

@@ -228,9 +228,7 @@ size_t HardwareCommandsHelper<GfxFamily>::sendIndirectState(
ssh.align(BINDING_TABLE_STATE::SURFACESTATEPOINTER_ALIGN_SIZE);
auto dstBindingTablePointer = EncodeSurfaceState<GfxFamily>::pushBindingTableAndSurfaceStates(ssh, kernelInfo.kernelDescriptor.payloadMappings.bindingTable.numEntries,
kernel.getSurfaceStateHeap(), kernel.getSurfaceStateHeapSize(),
kernel.getNumberOfBindingTableStates(), kernel.getBindingTableOffset());
size_t dstBindingTablePointer = HardwareCommandsHelper<GfxFamily>::checkForAdditionalBTAndSetBTPointer(ssh, kernel);
// Copy our sampler state if it exists
const auto &samplerTable = kernelInfo.kernelDescriptor.payloadMappings.samplerTable;
@@ -326,4 +324,20 @@ bool HardwareCommandsHelper<GfxFamily>::kernelUsesLocalIds(const Kernel &kernel)
return kernel.getKernelInfo().kernelDescriptor.kernelAttributes.numLocalIdChannels > 0;
}
template <typename GfxFamily>
size_t HardwareCommandsHelper<GfxFamily>::checkForAdditionalBTAndSetBTPointer(IndirectHeap &ssh, const Kernel &kernel) {
size_t dstBindingTablePointer{0u};
const auto &kernelInfo = kernel.getKernelInfo();
if (isGTPinInitialized && 0u == kernelInfo.kernelDescriptor.payloadMappings.bindingTable.numEntries) {
dstBindingTablePointer = EncodeSurfaceState<GfxFamily>::pushBindingTableAndSurfaceStates(ssh, 1u,
kernel.getSurfaceStateHeap(), kernel.getSurfaceStateHeapSize(),
kernel.getNumberOfBindingTableStates(), kernel.getBindingTableOffset());
} else {
dstBindingTablePointer = EncodeSurfaceState<GfxFamily>::pushBindingTableAndSurfaceStates(ssh, kernelInfo.kernelDescriptor.payloadMappings.bindingTable.numEntries,
kernel.getSurfaceStateHeap(), kernel.getSurfaceStateHeapSize(),
kernel.getNumberOfBindingTableStates(), kernel.getBindingTableOffset());
}
return dstBindingTablePointer;
}
} // namespace NEO