mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 16:24:18 +08:00
Revert "feature: Add support for euss buffer overflow on windows"
This reverts commit 703dd48038.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
8f4df0dee1
commit
5f874f45e2
@@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
namespace L0 {
|
namespace L0 {
|
||||||
|
|
||||||
#define GTDI_RET_BUFFER_OVERFLOW 13
|
|
||||||
class MetricIpSamplingWindowsImp : public MetricIpSamplingOsInterface {
|
class MetricIpSamplingWindowsImp : public MetricIpSamplingOsInterface {
|
||||||
public:
|
public:
|
||||||
MetricIpSamplingWindowsImp(Device &device);
|
MetricIpSamplingWindowsImp(Device &device);
|
||||||
@@ -32,7 +31,6 @@ class MetricIpSamplingWindowsImp : public MetricIpSamplingOsInterface {
|
|||||||
ze_result_t getMetricsTimerResolution(uint64_t &timerResolution) override;
|
ze_result_t getMetricsTimerResolution(uint64_t &timerResolution) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool overflowReported = false;
|
|
||||||
Device &device;
|
Device &device;
|
||||||
uint32_t notifyEveryNReports = 0u;
|
uint32_t notifyEveryNReports = 0u;
|
||||||
ze_result_t getNearestSupportedSamplingUnit(uint32_t &samplingPeriodNs, uint32_t &samplingRate);
|
ze_result_t getNearestSupportedSamplingUnit(uint32_t &samplingPeriodNs, uint32_t &samplingRate);
|
||||||
@@ -67,25 +65,9 @@ ze_result_t MetricIpSamplingWindowsImp::startMeasurement(uint32_t ¬ifyEveryNR
|
|||||||
}
|
}
|
||||||
|
|
||||||
ze_result_t MetricIpSamplingWindowsImp::readData(uint8_t *pRawData, size_t *pRawDataSize) {
|
ze_result_t MetricIpSamplingWindowsImp::readData(uint8_t *pRawData, size_t *pRawDataSize) {
|
||||||
// First read call to the KMD after overflow will just give the overflow status back, without any data being read from the HW buffer. This will not reset the HW overflow bit.
|
|
||||||
// Second read call to the KMD will reset the HW overflow bit, read the data from the HW buffer and return success to the UMD. This reading will make space for new reports.
|
|
||||||
bool result;
|
|
||||||
uint32_t retCode = 0;
|
|
||||||
const auto wddm = device.getOsInterface()->getDriverModel()->as<NEO::Wddm>();
|
const auto wddm = device.getOsInterface()->getDriverModel()->as<NEO::Wddm>();
|
||||||
if (!overflowReported) {
|
bool result = wddm->perfReadEuStallStream(pRawData, pRawDataSize);
|
||||||
size_t rawDataSizeTemp = 0u;
|
|
||||||
result = wddm->perfReadEuStallStream(nullptr, &rawDataSizeTemp, &retCode);
|
|
||||||
if (!result) {
|
|
||||||
return ZE_RESULT_ERROR_UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (retCode == GTDI_RET_BUFFER_OVERFLOW) {
|
|
||||||
overflowReported = true;
|
|
||||||
return ZE_RESULT_WARNING_DROPPED_DATA;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
overflowReported = false;
|
|
||||||
result = wddm->perfReadEuStallStream(pRawData, pRawDataSize, &retCode);
|
|
||||||
return result ? ZE_RESULT_SUCCESS : ZE_RESULT_ERROR_UNKNOWN;
|
return result ? ZE_RESULT_SUCCESS : ZE_RESULT_ERROR_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,9 +91,8 @@ uint32_t MetricIpSamplingWindowsImp::getUnitReportSize() {
|
|||||||
|
|
||||||
bool MetricIpSamplingWindowsImp::isNReportsAvailable() {
|
bool MetricIpSamplingWindowsImp::isNReportsAvailable() {
|
||||||
size_t bytesAvailable = 0u;
|
size_t bytesAvailable = 0u;
|
||||||
uint32_t retCode = 0;
|
|
||||||
const auto wddm = device.getOsInterface()->getDriverModel()->as<NEO::Wddm>();
|
const auto wddm = device.getOsInterface()->getDriverModel()->as<NEO::Wddm>();
|
||||||
bool result = wddm->perfReadEuStallStream(nullptr, &bytesAvailable, &retCode);
|
bool result = wddm->perfReadEuStallStream(nullptr, &bytesAvailable);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
METRICS_LOG_ERR("wddm perfReadEuStallStream() call failed.");
|
METRICS_LOG_ERR("wddm perfReadEuStallStream() call failed.");
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ HWTEST2_F(MetricIpSamplingWindowsFixtureXe2, givenPerfDisableEuStallStreamFailsW
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(MetricIpSamplingWindowsFixtureXe2, givenReadSucceedsWhenReadDataIsCalledThenReturnSuccess, IsXe2HpgCore) {
|
HWTEST2_F(MetricIpSamplingWindowsFixtureXe2, givenReadSucceedsWhenReadDataIsCalledThenReturnSuccess, IsXe2HpgCore) {
|
||||||
VariableBackup<decltype(NEO::pPerfReadEuStallStream)> mockPerfReadEuStallStream(&NEO::pPerfReadEuStallStream, [](uint8_t *pRawData, size_t *pRawDataSize, uint32_t *pOutRetCode) -> bool {
|
VariableBackup<decltype(NEO::pPerfReadEuStallStream)> mockPerfReadEuStallStream(&NEO::pPerfReadEuStallStream, [](uint8_t *pRawData, size_t *pRawDataSize) -> bool {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
uint8_t pRawData = 0u;
|
uint8_t pRawData = 0u;
|
||||||
@@ -116,7 +116,7 @@ HWTEST2_F(MetricIpSamplingWindowsFixtureXe2, givenReadSucceedsWhenReadDataIsCall
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(MetricIpSamplingWindowsFixtureXe2, givenPerfReadEuStallStreamFailsWhenReadDataIsCalledThenReturnFailure, IsXe2HpgCore) {
|
HWTEST2_F(MetricIpSamplingWindowsFixtureXe2, givenPerfReadEuStallStreamFailsWhenReadDataIsCalledThenReturnFailure, IsXe2HpgCore) {
|
||||||
VariableBackup<decltype(NEO::pPerfReadEuStallStream)> mockPerfReadEuStallStream(&NEO::pPerfReadEuStallStream, [](uint8_t *pRawData, size_t *pRawDataSize, uint32_t *pOutRetCode) -> bool {
|
VariableBackup<decltype(NEO::pPerfReadEuStallStream)> mockPerfReadEuStallStream(&NEO::pPerfReadEuStallStream, [](uint8_t *pRawData, size_t *pRawDataSize) -> bool {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
uint8_t pRawData = 0u;
|
uint8_t pRawData = 0u;
|
||||||
@@ -124,49 +124,6 @@ HWTEST2_F(MetricIpSamplingWindowsFixtureXe2, givenPerfReadEuStallStreamFailsWhen
|
|||||||
EXPECT_EQ(metricIpSamplingOsInterface->readData(&pRawData, &pRawDataSize), ZE_RESULT_ERROR_UNKNOWN);
|
EXPECT_EQ(metricIpSamplingOsInterface->readData(&pRawData, &pRawDataSize), ZE_RESULT_ERROR_UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST2_F(MetricIpSamplingWindowsFixtureXe2, givenPerfReadEuStallStreamOverflowsWhenReadDataIsCalledThenReturnCorrectOverflowStatus, IsXe2HpgCore) {
|
|
||||||
VariableBackup<decltype(NEO::pPerfReadEuStallStream)> mockPerfReadEuStallStream(&NEO::pPerfReadEuStallStream, [](uint8_t *pRawData, size_t *pRawDataSize, uint32_t *pOutRetCode) -> bool {
|
|
||||||
*pOutRetCode = 13; // GTDI_RET_BUFFER_OVERFLOW
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
uint8_t pRawData = 0u;
|
|
||||||
size_t pRawDataSize = 0;
|
|
||||||
EXPECT_EQ(metricIpSamplingOsInterface->readData(&pRawData, &pRawDataSize), ZE_RESULT_WARNING_DROPPED_DATA);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST2_F(MetricIpSamplingWindowsFixtureXe2, givenPerfReadEuStallStreamOverflowsWhenReadDataIsCalledTwiceThenCorrectReturnStatusAreReturned, IsXe2HpgCore) {
|
|
||||||
static bool overflowRetuned = false;
|
|
||||||
VariableBackup<decltype(NEO::pPerfReadEuStallStream)> mockPerfReadEuStallStream(&NEO::pPerfReadEuStallStream, [](uint8_t *pRawData, size_t *pRawDataSize, uint32_t *pOutRetCode) -> bool {
|
|
||||||
if (!overflowRetuned) {
|
|
||||||
overflowRetuned = true;
|
|
||||||
*pOutRetCode = 13; // GTDI_RET_BUFFER_OVERFLOW
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
uint8_t pRawData = 0u;
|
|
||||||
size_t pRawDataSize = 0;
|
|
||||||
EXPECT_EQ(metricIpSamplingOsInterface->readData(&pRawData, &pRawDataSize), ZE_RESULT_WARNING_DROPPED_DATA);
|
|
||||||
EXPECT_EQ(metricIpSamplingOsInterface->readData(&pRawData, &pRawDataSize), ZE_RESULT_SUCCESS);
|
|
||||||
overflowRetuned = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST2_F(MetricIpSamplingWindowsFixtureXe2, givenPerfReadEuStallStreamOverflowsWhenReadDataIsCalledTwiceAndReadDataFailsOnScondCallThenCorrectReturnStatusAreReturned, IsXe2HpgCore) {
|
|
||||||
static bool overflowRetuned = false;
|
|
||||||
VariableBackup<decltype(NEO::pPerfReadEuStallStream)> mockPerfReadEuStallStream(&NEO::pPerfReadEuStallStream, [](uint8_t *pRawData, size_t *pRawDataSize, uint32_t *pOutRetCode) -> bool {
|
|
||||||
if (!overflowRetuned) {
|
|
||||||
overflowRetuned = true;
|
|
||||||
*pOutRetCode = 13; // GTDI_RET_BUFFER_OVERFLOW
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
uint8_t pRawData = 0u;
|
|
||||||
size_t pRawDataSize = 0;
|
|
||||||
EXPECT_EQ(metricIpSamplingOsInterface->readData(&pRawData, &pRawDataSize), ZE_RESULT_WARNING_DROPPED_DATA);
|
|
||||||
EXPECT_EQ(metricIpSamplingOsInterface->readData(&pRawData, &pRawDataSize), ZE_RESULT_ERROR_UNKNOWN);
|
|
||||||
overflowRetuned = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST2_F(MetricIpSamplingWindowsFixtureXe2, WhenGetRequiredBufferSizeIsCalledThenCorrectSizeIsReturned, IsXe2HpgCore) {
|
HWTEST2_F(MetricIpSamplingWindowsFixtureXe2, WhenGetRequiredBufferSizeIsCalledThenCorrectSizeIsReturned, IsXe2HpgCore) {
|
||||||
constexpr uint32_t unitReportSize = 64;
|
constexpr uint32_t unitReportSize = 64;
|
||||||
EXPECT_EQ(metricIpSamplingOsInterface->getRequiredBufferSize(10), unitReportSize * 10);
|
EXPECT_EQ(metricIpSamplingOsInterface->getRequiredBufferSize(10), unitReportSize * 10);
|
||||||
@@ -179,7 +136,7 @@ HWTEST2_F(MetricIpSamplingWindowsFixtureXe2, WhenisNReportsAvailableIsCalledAndE
|
|||||||
VariableBackup<decltype(NEO::pPerfOpenEuStallStream)> mockPerfOpenEuStallStream(&NEO::pPerfOpenEuStallStream, [](uint32_t sampleRate, uint32_t minBufferSize) -> bool {
|
VariableBackup<decltype(NEO::pPerfOpenEuStallStream)> mockPerfOpenEuStallStream(&NEO::pPerfOpenEuStallStream, [](uint32_t sampleRate, uint32_t minBufferSize) -> bool {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
VariableBackup<decltype(NEO::pPerfReadEuStallStream)> mockPerfReadEuStallStream(&NEO::pPerfReadEuStallStream, [](uint8_t *pRawData, size_t *pRawDataSize, uint32_t *pOutRetCode) -> bool {
|
VariableBackup<decltype(NEO::pPerfReadEuStallStream)> mockPerfReadEuStallStream(&NEO::pPerfReadEuStallStream, [](uint8_t *pRawData, size_t *pRawDataSize) -> bool {
|
||||||
*pRawDataSize = 64u;
|
*pRawDataSize = 64u;
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
@@ -199,7 +156,7 @@ HWTEST2_F(MetricIpSamplingWindowsFixtureXe2, WhenisNReportsAvailableIsCalledAndE
|
|||||||
VariableBackup<decltype(NEO::pPerfOpenEuStallStream)> mockPerfOpenEuStallStream(&NEO::pPerfOpenEuStallStream, [](uint32_t sampleRate, uint32_t minBufferSize) -> bool {
|
VariableBackup<decltype(NEO::pPerfOpenEuStallStream)> mockPerfOpenEuStallStream(&NEO::pPerfOpenEuStallStream, [](uint32_t sampleRate, uint32_t minBufferSize) -> bool {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
VariableBackup<decltype(NEO::pPerfReadEuStallStream)> mockPerfReadEuStallStream(&NEO::pPerfReadEuStallStream, [](uint8_t *pRawData, size_t *pRawDataSize, uint32_t *pOutRetCode) -> bool {
|
VariableBackup<decltype(NEO::pPerfReadEuStallStream)> mockPerfReadEuStallStream(&NEO::pPerfReadEuStallStream, [](uint8_t *pRawData, size_t *pRawDataSize) -> bool {
|
||||||
*pRawDataSize = 192u;
|
*pRawDataSize = 192u;
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ bool Wddm::perfOpenEuStallStream(uint32_t sampleRate, uint32_t minBufferSize) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Wddm::perfReadEuStallStream(uint8_t *pRawData, size_t *pRawDataSize, uint32_t *pOutRetCode) {
|
bool Wddm::perfReadEuStallStream(uint8_t *pRawData, size_t *pRawDataSize) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ class Wddm : public DriverModel {
|
|||||||
|
|
||||||
MOCKABLE_VIRTUAL bool perfOpenEuStallStream(uint32_t sampleRate, uint32_t minBufferSize);
|
MOCKABLE_VIRTUAL bool perfOpenEuStallStream(uint32_t sampleRate, uint32_t minBufferSize);
|
||||||
MOCKABLE_VIRTUAL bool perfDisableEuStallStream();
|
MOCKABLE_VIRTUAL bool perfDisableEuStallStream();
|
||||||
MOCKABLE_VIRTUAL bool perfReadEuStallStream(uint8_t *pRawData, size_t *pRawDataSize, uint32_t *pOutRetCode);
|
MOCKABLE_VIRTUAL bool perfReadEuStallStream(uint8_t *pRawData, size_t *pRawDataSize);
|
||||||
|
|
||||||
PhysicalDevicePciBusInfo getPciBusInfo() const override;
|
PhysicalDevicePciBusInfo getPciBusInfo() const override;
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ NTSTATUS(*pCallEscape)
|
|||||||
uint32_t (*pGetTimestampFrequency)() = nullptr;
|
uint32_t (*pGetTimestampFrequency)() = nullptr;
|
||||||
bool (*pPerfOpenEuStallStream)(uint32_t sampleRate, uint32_t minBufferSize) = nullptr;
|
bool (*pPerfOpenEuStallStream)(uint32_t sampleRate, uint32_t minBufferSize) = nullptr;
|
||||||
bool (*pPerfDisableEuStallStream)() = nullptr;
|
bool (*pPerfDisableEuStallStream)() = nullptr;
|
||||||
bool (*pPerfReadEuStallStream)(uint8_t *pRawData, size_t *pRawDataSize, uint32_t *pOutRetCode) = nullptr;
|
bool (*pPerfReadEuStallStream)(uint8_t *pRawData, size_t *pRawDataSize) = nullptr;
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|
||||||
struct MockHwDeviceId : public HwDeviceIdWddm {
|
struct MockHwDeviceId : public HwDeviceIdWddm {
|
||||||
@@ -385,11 +385,11 @@ bool WddmMock::perfDisableEuStallStream() {
|
|||||||
return Wddm::perfDisableEuStallStream();
|
return Wddm::perfDisableEuStallStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WddmMock::perfReadEuStallStream(uint8_t *pRawData, size_t *pRawDataSize, uint32_t *pOutRetCode) {
|
bool WddmMock::perfReadEuStallStream(uint8_t *pRawData, size_t *pRawDataSize) {
|
||||||
if (pPerfReadEuStallStream != nullptr) {
|
if (pPerfReadEuStallStream != nullptr) {
|
||||||
return pPerfReadEuStallStream(pRawData, pRawDataSize, pOutRetCode);
|
return pPerfReadEuStallStream(pRawData, pRawDataSize);
|
||||||
}
|
}
|
||||||
return Wddm::perfReadEuStallStream(pRawData, pRawDataSize, pOutRetCode);
|
return Wddm::perfReadEuStallStream(pRawData, pRawDataSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t WddmMock::getTimestampFrequency() const {
|
uint32_t WddmMock::getTimestampFrequency() const {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ extern NTSTATUS (*pCallEscape)(D3DKMT_ESCAPE &escapeCommand);
|
|||||||
extern uint32_t (*pGetTimestampFrequency)();
|
extern uint32_t (*pGetTimestampFrequency)();
|
||||||
extern bool (*pPerfOpenEuStallStream)(uint32_t sampleRate, uint32_t minBufferSize);
|
extern bool (*pPerfOpenEuStallStream)(uint32_t sampleRate, uint32_t minBufferSize);
|
||||||
extern bool (*pPerfDisableEuStallStream)();
|
extern bool (*pPerfDisableEuStallStream)();
|
||||||
extern bool (*pPerfReadEuStallStream)(uint8_t *pRawData, size_t *pRawDataSize, uint32_t *pOutRetCode);
|
extern bool (*pPerfReadEuStallStream)(uint8_t *pRawData, size_t *pRawDataSize);
|
||||||
|
|
||||||
class GraphicsAllocation;
|
class GraphicsAllocation;
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ class WddmMock : public Wddm {
|
|||||||
uint32_t getTimestampFrequency() const override;
|
uint32_t getTimestampFrequency() const override;
|
||||||
bool perfOpenEuStallStream(uint32_t sampleRate, uint32_t minBufferSize) override;
|
bool perfOpenEuStallStream(uint32_t sampleRate, uint32_t minBufferSize) override;
|
||||||
bool perfDisableEuStallStream() override;
|
bool perfDisableEuStallStream() override;
|
||||||
bool perfReadEuStallStream(uint8_t *pRawData, size_t *pRawDataSize, uint32_t *pOutRetCode) override;
|
bool perfReadEuStallStream(uint8_t *pRawData, size_t *pRawDataSize) override;
|
||||||
|
|
||||||
WddmMockHelpers::MakeResidentCall makeResidentResult;
|
WddmMockHelpers::MakeResidentCall makeResidentResult;
|
||||||
WddmMockHelpers::CallResult evictResult;
|
WddmMockHelpers::CallResult evictResult;
|
||||||
|
|||||||
@@ -20,10 +20,9 @@ TEST_F(WddmPerfTests, givenCorrectArgumentsWhenPerfOpenEuStallStreamIsCalledThen
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WddmPerfTests, givenCorrectArgumentsWhenPerfReadEuStallStreamIsCalledThenReturnFailure) {
|
TEST_F(WddmPerfTests, givenCorrectArgumentsWhenPerfReadEuStallStreamIsCalledThenReturnFailure) {
|
||||||
uint8_t rawData = 0u;
|
uint8_t pRawData = 0u;
|
||||||
size_t rawDataSize = 0;
|
size_t pRawDataSize = 0;
|
||||||
uint32_t outRetCode = 0;
|
EXPECT_FALSE(wddm->perfReadEuStallStream(&pRawData, &pRawDataSize));
|
||||||
EXPECT_FALSE(wddm->perfReadEuStallStream(&rawData, &rawDataSize, &outRetCode));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(WddmPerfTests, givenCorrectArgumentsWhenPerfDisableEuStallStreamIsCalledThenReturnFailure) {
|
TEST_F(WddmPerfTests, givenCorrectArgumentsWhenPerfDisableEuStallStreamIsCalledThenReturnFailure) {
|
||||||
|
|||||||
Reference in New Issue
Block a user