fix: unify path for getting number of grfs per thread

Related-To: NEO-8043

Signed-off-by: Naklicki, Mateusz <mateusz.naklicki@intel.com>
This commit is contained in:
Naklicki, Mateusz
2023-09-22 16:06:50 +00:00
committed by Compute-Runtime-Automation
parent 9337911742
commit 0461af492d
25 changed files with 91 additions and 41 deletions

View File

@@ -102,7 +102,7 @@ struct EncodeDispatchKernel {
const uint32_t threadsPerThreadGroup, uint32_t slmTotalSize, SlmPolicy slmPolicy);
static void setGrfInfo(INTERFACE_DESCRIPTOR_DATA *pInterfaceDescriptor, uint32_t numGrf, const size_t &sizeCrossThreadData,
const size_t &sizePerThreadData, const HardwareInfo &hwInfo);
const size_t &sizePerThreadData, const RootDeviceEnvironment &rootDeviceEnvironment);
static void *getInterfaceDescriptor(CommandContainer &container, IndirectHeap *childDsh, uint32_t &iddOffset);

View File

@@ -31,7 +31,7 @@ namespace NEO {
template <typename Family>
void EncodeDispatchKernel<Family>::setGrfInfo(INTERFACE_DESCRIPTOR_DATA *pInterfaceDescriptor, uint32_t numGrf,
const size_t &sizeCrossThreadData, const size_t &sizePerThreadData,
const HardwareInfo &hwInfo) {
const RootDeviceEnvironment &rootDeviceEnvironment) {
auto grfSize = sizeof(typename Family::GRF);
DEBUG_BREAK_IF((sizeCrossThreadData % grfSize) != 0);
auto numGrfCrossThreadData = static_cast<uint32_t>(sizeCrossThreadData / grfSize);
@@ -163,7 +163,7 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
}
EncodeDispatchKernel<Family>::setGrfInfo(&idd, kernelDescriptor.kernelAttributes.numGrfRequired, sizeCrossThreadData,
sizePerThreadData, hwInfo);
sizePerThreadData, rootDeviceEnvironment);
uint32_t sizeThreadData = sizePerThreadDataForWholeGroup + sizeCrossThreadData;
bool isHwLocalIdGeneration = false;

View File

@@ -39,7 +39,7 @@ constexpr size_t ImmWriteDestinationAddressAlignment = 8;
template <typename Family>
void EncodeDispatchKernel<Family>::setGrfInfo(INTERFACE_DESCRIPTOR_DATA *pInterfaceDescriptor, uint32_t numGrf,
const size_t &sizeCrossThreadData, const size_t &sizePerThreadData,
const HardwareInfo &hwInfo) {
const RootDeviceEnvironment &rootDeviceEnvironment) {
}
template <typename Family>
@@ -76,7 +76,7 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
auto &idd = walkerCmd.getInterfaceDescriptor();
EncodeDispatchKernel<Family>::setGrfInfo(&idd, kernelDescriptor.kernelAttributes.numGrfRequired, sizeCrossThreadData,
sizePerThreadData, hwInfo);
sizePerThreadData, rootDeviceEnvironment);
auto &productHelper = args.device->getProductHelper();
productHelper.updateIddCommand(&idd, kernelDescriptor.kernelAttributes.numGrfRequired,
kernelDescriptor.kernelAttributes.threadArbitrationPolicy);

View File

@@ -206,6 +206,7 @@ class ProductHelper {
virtual bool getMediaFrequencyTileIndex(const ReleaseHelper *releaseHelper, uint32_t &tileIndex) const = 0;
virtual bool isResolvingSubDeviceIDNeeded(const ReleaseHelper *releaseHelper) const = 0;
virtual uint64_t overridePatIndex(bool isUncachedType, uint64_t patIndex) const = 0;
virtual std::vector<uint32_t> getSupportedNumGrfs(const ReleaseHelper *releaseHelper) const = 0;
virtual ~ProductHelper() = default;

View File

@@ -806,4 +806,12 @@ uint64_t ProductHelperHw<gfxProduct>::overridePatIndex(bool isUncachedType, uint
return patIndex;
}
template <PRODUCT_FAMILY gfxProduct>
std::vector<uint32_t> ProductHelperHw<gfxProduct>::getSupportedNumGrfs(const ReleaseHelper *releaseHelper) const {
if (releaseHelper) {
return releaseHelper->getSupportedNumGrfs();
}
return {128u};
}
} // namespace NEO

View File

@@ -159,6 +159,7 @@ class ProductHelperHw : public ProductHelper {
bool getMediaFrequencyTileIndex(const ReleaseHelper *releaseHelper, uint32_t &tileIndex) const override;
bool isResolvingSubDeviceIDNeeded(const ReleaseHelper *releaseHelper) const override;
uint64_t overridePatIndex(bool isUncachedType, uint64_t patIndex) const override;
std::vector<uint32_t> getSupportedNumGrfs(const ReleaseHelper *releaseHelper) const override;
~ProductHelperHw() override = default;

View File

@@ -11,6 +11,8 @@
#include <memory>
#include <optional>
#include <vector>
namespace NEO {
class ReleaseHelper;
@@ -43,6 +45,7 @@ class ReleaseHelper {
virtual bool isDirectSubmissionSupported() const = 0;
virtual bool isRcsExposureDisabled() const = 0;
virtual std::optional<GfxMemoryAllocationMethod> getPreferredAllocationMethod(AllocationType allocationType) const = 0;
virtual std::vector<uint32_t> getSupportedNumGrfs() const = 0;
protected:
ReleaseHelper(HardwareIpVersion hardwareIpVersion) : hardwareIpVersion(hardwareIpVersion) {}
@@ -72,6 +75,7 @@ class ReleaseHelperHw : public ReleaseHelper {
bool isDirectSubmissionSupported() const override;
bool isRcsExposureDisabled() const override;
std::optional<GfxMemoryAllocationMethod> getPreferredAllocationMethod(AllocationType allocationType) const override;
std::vector<uint32_t> getSupportedNumGrfs() const override;
protected:
ReleaseHelperHw(HardwareIpVersion hardwareIpVersion) : ReleaseHelper(hardwareIpVersion) {}

View File

@@ -87,4 +87,9 @@ template <ReleaseType releaseType>
bool ReleaseHelperHw<releaseType>::isRcsExposureDisabled() const {
return false;
}
template <ReleaseType releaseType>
std::vector<uint32_t> ReleaseHelperHw<releaseType>::getSupportedNumGrfs() const {
return {128u, 256u};
}
} // namespace NEO