fix: define preferred allocation method per hw release

Related-To: HSD-18033144631
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2023-09-11 09:05:49 +00:00
committed by Compute-Runtime-Automation
parent 1579c69316
commit aa6b837a67
15 changed files with 126 additions and 40 deletions

View File

@@ -43,9 +43,6 @@ enum class DriverModelType;
using ProductHelperCreateFunctionType = std::unique_ptr<ProductHelper> (*)();
extern ProductHelperCreateFunctionType productHelperFactory[IGFX_MAX_PRODUCT];
enum class GfxMemoryAllocationMethod : uint32_t;
enum class AllocationType;
enum class UsmAccessCapabilities {
Host = 0,
Device,
@@ -210,7 +207,6 @@ class ProductHelper {
virtual bool isSkippingStatefulInformationRequired(const KernelDescriptor &kernelDescriptor) const = 0;
virtual bool getMediaFrequencyTileIndex(const ReleaseHelper *releaseHelper, uint32_t &tileIndex) const = 0;
virtual bool isResolvingSubDeviceIDNeeded(const ReleaseHelper *releaseHelper) const = 0;
virtual std::optional<GfxMemoryAllocationMethod> getPreferredAllocationMethod(AllocationType allocationType) const = 0;
virtual uint64_t overridePatIndex(bool isUncachedType, uint64_t patIndex) const = 0;
virtual ~ProductHelper() = default;

View File

@@ -803,11 +803,6 @@ bool ProductHelperHw<gfxProduct>::isSkippingStatefulInformationRequired(const Ke
return false;
}
template <PRODUCT_FAMILY gfxProduct>
std::optional<GfxMemoryAllocationMethod> ProductHelperHw<gfxProduct>::getPreferredAllocationMethod(AllocationType allocationType) const {
return {};
}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isResolvingSubDeviceIDNeeded(const ReleaseHelper *releaseHelper) const {
if (releaseHelper) {

View File

@@ -160,7 +160,6 @@ class ProductHelperHw : public ProductHelper {
bool isSkippingStatefulInformationRequired(const KernelDescriptor &kernelDescriptor) const override;
bool getMediaFrequencyTileIndex(const ReleaseHelper *releaseHelper, uint32_t &tileIndex) const override;
bool isResolvingSubDeviceIDNeeded(const ReleaseHelper *releaseHelper) const override;
std::optional<GfxMemoryAllocationMethod> getPreferredAllocationMethod(AllocationType allocationType) const override;
uint64_t overridePatIndex(bool isUncachedType, uint64_t patIndex) const override;
~ProductHelperHw() override = default;

View File

@@ -40,6 +40,7 @@
#include "shared/source/os_interface/windows/wddm_allocation.h"
#include "shared/source/os_interface/windows/wddm_residency_allocations_container.h"
#include "shared/source/os_interface/windows/wddm_residency_controller.h"
#include "shared/source/release_helper/release_helper.h"
#include <algorithm>
#include <emmintrin.h>
@@ -78,8 +79,8 @@ GfxMemoryAllocationMethod WddmMemoryManager::getPreferredAllocationMethod(const
}
auto rootDeviceEnvironment = executionEnvironment.rootDeviceEnvironments[allocationProperties.rootDeviceIndex].get();
UNRECOVERABLE_IF(!rootDeviceEnvironment);
auto &productHelper = rootDeviceEnvironment->getHelper<ProductHelper>();
auto preference = productHelper.getPreferredAllocationMethod(allocationProperties.allocationType);
auto releaseHelper = rootDeviceEnvironment->releaseHelper.get();
auto preference = releaseHelper ? releaseHelper->getPreferredAllocationMethod(allocationProperties.allocationType) : std::nullopt;
if (preference) {
return *preference;
}