/* * Copyright (C) 2023 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once #include "shared/source/helpers/hw_ip_version.h" #include namespace NEO { class ReleaseHelper; enum class ReleaseType; inline constexpr uint32_t maxArchitecture = 64; using createReleaseHelperFunctionType = std::unique_ptr (*)(HardwareIpVersion hardwareIpVersion); inline createReleaseHelperFunctionType *releaseHelperFactory[maxArchitecture]{}; class ReleaseHelper { public: static std::unique_ptr create(HardwareIpVersion hardwareIpVersion); virtual ~ReleaseHelper() = default; virtual bool isAdjustWalkOrderAvailable() const = 0; virtual bool isMatrixMultiplyAccumulateSupported() const = 0; virtual bool isPipeControlPriorToNonPipelinedStateCommandsWARequired() const = 0; virtual bool isPrefetchDisablingRequired() const = 0; virtual int getProductMaxPreferredSlmSize(int preferredEnumValue) const = 0; protected: ReleaseHelper(HardwareIpVersion hardwareIpVersion) : hardwareIpVersion(hardwareIpVersion) {} HardwareIpVersion hardwareIpVersion{}; }; template class ReleaseHelperHw : public ReleaseHelper { public: static std::unique_ptr create(HardwareIpVersion hardwareIpVersion) { return std::unique_ptr(new ReleaseHelperHw{hardwareIpVersion}); } bool isAdjustWalkOrderAvailable() const override; bool isMatrixMultiplyAccumulateSupported() const override; bool isPipeControlPriorToNonPipelinedStateCommandsWARequired() const override; bool isPrefetchDisablingRequired() const override; int getProductMaxPreferredSlmSize(int preferredEnumValue) const override; private: ReleaseHelperHw(HardwareIpVersion hardwareIpVersion) : ReleaseHelper(hardwareIpVersion) {} }; template struct EnableReleaseHelperArchitecture { EnableReleaseHelperArchitecture(createReleaseHelperFunctionType *releaseTable) { releaseHelperFactory[architecture] = releaseTable; } }; template struct EnableReleaseHelper { EnableReleaseHelper(createReleaseHelperFunctionType &releaseTableEntry) { using ReleaseHelperType = ReleaseHelperHw; releaseTableEntry = ReleaseHelperType::create; } }; } // namespace NEO