Skip to content

Commit 5bee8eb

Browse files
Revert "Allow cpu buffers copy on DG2 in 32bit"
This reverts commit 2055daf. Signed-off-by: Maciej Plewka <[email protected]>
1 parent ed1506e commit 5bee8eb

File tree

10 files changed

+16
-115
lines changed

10 files changed

+16
-115
lines changed

opencl/source/mem_obj/buffer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ bool Buffer::isReadWriteOnCpuAllowed(const Device &device) {
643643
return false;
644644
}
645645

646-
if (graphicsAllocation->isAllocatedInLocalMemoryPool() && !graphicsAllocation->isAllocationLockable()) {
646+
if (graphicsAllocation->isAllocatedInLocalMemoryPool()) {
647647
return false;
648648
}
649649

opencl/test/unit_test/command_queue/read_write_buffer_cpu_copy.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "shared/source/helpers/basic_math.h"
1010
#include "shared/source/helpers/local_memory_access_modes.h"
1111
#include "shared/test/common/helpers/debug_manager_state_restore.h"
12-
#include "shared/test/common/mocks/mock_gmm.h"
1312
#include "shared/test/common/test_macros/test.h"
1413

1514
#include "opencl/test/unit_test/command_queue/enqueue_read_buffer_fixture.h"
@@ -332,10 +331,7 @@ TEST(ReadWriteBufferOnCpu, whenLocalMemoryPoolAllocationIsAskedForPreferenceThen
332331
cl_int retVal = 0;
333332
std::unique_ptr<Buffer> buffer(Buffer::create(&ctx, CL_MEM_READ_WRITE, MemoryConstants::pageSize, nullptr, retVal));
334333
ASSERT_NE(nullptr, buffer.get());
335-
auto gmm = std::make_unique<MockGmm>(device->getGmmHelper());
336-
reinterpret_cast<MemoryAllocation *>(buffer->getGraphicsAllocation(device->getRootDeviceIndex()))->setGmm(gmm.release(), 0);
337334
reinterpret_cast<MemoryAllocation *>(buffer->getGraphicsAllocation(device->getRootDeviceIndex()))->overrideMemoryPool(MemoryPool::LocalMemory);
338-
reinterpret_cast<MemoryAllocation *>(buffer->getGraphicsAllocation(device->getRootDeviceIndex()))->getDefaultGmm()->resourceParams.Flags.Info.NotLockable = 1;
339335

340336
EXPECT_FALSE(buffer->isReadWriteOnCpuAllowed(device->getDevice()));
341337
EXPECT_FALSE(buffer->isReadWriteOnCpuPreferred(reinterpret_cast<void *>(0x1000), MemoryConstants::pageSize, device->getDevice()));

opencl/test/unit_test/mem_obj/buffer_tests.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ TEST(Buffer, whenBufferAllocatedInLocalMemoryThenCpuCopyIsDisallowed) {
6868
MockBuffer buffer(allocation);
6969
UltDeviceFactory factory{1, 0};
7070
auto &device = *factory.rootDevices[0];
71-
auto gmm = std::make_unique<MockGmm>(device.getGmmHelper());
72-
allocation.setGmm(gmm.get(), 0);
73-
allocation.getDefaultGmm()->resourceParams.Flags.Info.NotLockable = 1;
71+
7472
allocation.memoryPool = MemoryPool::LocalMemory;
7573
EXPECT_FALSE(buffer.isReadWriteOnCpuAllowed(device));
7674

opencl/test/unit_test/xe_hpg_core/dg2/windows/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
set(IGDRCL_SRCS_tests_xe_hpg_core_dg2_windows
88
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
9-
${CMAKE_CURRENT_SOURCE_DIR}/wddm_tests_dg2.cpp
109
)
1110
if(WIN32)
1211
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_xe_hpg_core_dg2_windows})

opencl/test/unit_test/xe_hpg_core/dg2/windows/wddm_tests_dg2.cpp

Lines changed: 0 additions & 74 deletions
This file was deleted.

shared/source/helpers/extra_allocation_data_xehp_and_later.inl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,5 @@ void HwHelperHw<Family>::setExtraAllocationData(AllocationData &allocationData,
3838
allocationData.storageInfo.isLockable = false;
3939
}
4040
}
41-
42-
if (HwInfoConfig::get(hwInfo.platform.eProductFamily)->isStorageInfoAdjustmentRequired()) {
43-
if (properties.allocationType == AllocationType::BUFFER && !properties.flags.preferCompressed && !properties.flags.shareable) {
44-
allocationData.storageInfo.isLockable = true;
45-
}
46-
}
4741
}
4842
} // namespace NEO

shared/source/os_interface/windows/wddm_memory_manager.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -860,16 +860,19 @@ bool WddmMemoryManager::isCpuCopyRequired(const void *ptr) {
860860
// function checks what is the delta between reading from cachead memory
861861
// compare to reading from provided pointer
862862
// if value is above threshold, it means that pointer is uncached.
863-
constexpr auto slownessFactor = 50u;
864-
static int64_t meassurmentOverhead = std::numeric_limits<int64_t>::max();
865-
static int64_t fastestLocalRead = std::numeric_limits<int64_t>::max();
863+
constexpr auto slownessFactor = 5u;
864+
static volatile int64_t meassurmentOverhead = std::numeric_limits<int64_t>::max();
865+
static volatile int64_t fastestLocalRead = std::numeric_limits<int64_t>::max();
866+
static volatile int64_t max = std::numeric_limits<int64_t>::min();
867+
static volatile int64_t min = std::numeric_limits<int64_t>::max();
866868

867869
// local variable that we will read for comparison
868-
int cacheable = 1;
870+
volatile int cacheable = 1;
871+
// auto hostPtr = std::make_unique<volatile int[]>(0x13000 / sizeof(int));
869872
volatile int *localVariablePointer = &cacheable;
870-
volatile const int *volatileInputPtr = static_cast<volatile const int *>(ptr);
873+
volatile int *volatileInputPtr = (volatile int *)(ptr);
871874

872-
int64_t timestamp0, timestamp1, localVariableReadDelta, inputPointerReadDelta;
875+
volatile int64_t timestamp0, timestamp1, localVariableReadDelta, inputPointerReadDelta;
873876

874877
// compute timing overhead
875878
_mm_lfence();
@@ -883,7 +886,7 @@ bool WddmMemoryManager::isCpuCopyRequired(const void *ptr) {
883886
}
884887

885888
// dummy read
886-
cacheable = *localVariablePointer;
889+
//cacheable = *localVariablePointer;
887890

888891
_mm_lfence();
889892
timestamp0 = __rdtsc();
@@ -901,7 +904,7 @@ bool WddmMemoryManager::isCpuCopyRequired(const void *ptr) {
901904
fastestLocalRead = localVariableReadDelta;
902905
}
903906
// dummy read
904-
cacheable = *volatileInputPtr;
907+
//cacheable = *volatileInputPtr;
905908

906909
_mm_lfence();
907910
timestamp0 = __rdtsc();
@@ -914,6 +917,9 @@ bool WddmMemoryManager::isCpuCopyRequired(const void *ptr) {
914917
if (inputPointerReadDelta <= 0) {
915918
inputPointerReadDelta = 1;
916919
}
920+
max = std::max(max, localVariableReadDelta);
921+
min = std::min(min, inputPointerReadDelta);
922+
// UNRECOVERABLE_IF(max > min);
917923
return inputPointerReadDelta > slownessFactor * fastestLocalRead;
918924
}
919925

shared/source/xe_hpg_core/dg2/os_agnostic_hw_info_config_dg2.inl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,3 @@ template <>
185185
bool HwInfoConfigHw<gfxProduct>::isMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const {
186186
return true;
187187
}
188-
template <>
189-
bool HwInfoConfigHw<gfxProduct>::isStorageInfoAdjustmentRequired() const {
190-
if constexpr (is32bit) {
191-
return true;
192-
} else {
193-
return false;
194-
}
195-
}

shared/test/unit_test/xe_hpg_core/dg2/excludes_xe_hpg_core_dg2.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfPipeControl
1717
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfTile64With3DSurfaceOnBCSIsSupportedThenTrueIsReturned, IGFX_DG2);
1818
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, WhenAllowRenderCompressionIsCalledThenTrueIsReturned, IGFX_DG2);
1919
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, whenConvertingTimestampsToCsDomainThenNothingIsChanged, IGFX_DG2);
20-
HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenAskedIfStorageInfoAdjustmentIsRequiredThenFalseIsReturned, IGFX_DG2);

shared/test/unit_test/xe_hpg_core/dg2/hw_info_config_tests_dg2.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -450,12 +450,3 @@ DG2TEST_F(ProductConfigTests, givenDg2G11DeviceIdWhenDifferentRevisionIsPassedTh
450450
EXPECT_EQ(productConfig, DG2_G11);
451451
}
452452
}
453-
454-
DG2TEST_F(HwInfoConfigTestDg2, givenHwInfoConfigWhenAskedIfStorageInfoAdjustmentIsRequiredThenTrueIsReturned) {
455-
auto hwInfoConfig = HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
456-
if constexpr (is32bit) {
457-
EXPECT_TRUE(hwInfoConfig->isStorageInfoAdjustmentRequired());
458-
} else {
459-
EXPECT_FALSE(hwInfoConfig->isStorageInfoAdjustmentRequired());
460-
}
461-
}

0 commit comments

Comments
 (0)