mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Prefer CPU transfer for Local Memory 32 bit applications.
Change-Id: Icdb1333c0d0123be3d26329088d7ed44df37c84e Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
4987ac71c4
commit
33d5f504c6
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@ -1,5 +1,5 @@
|
||||
#!groovy
|
||||
dependenciesRevision='b67325e72bcd5baa03886d87cac9afe6aea8cebd-1371'
|
||||
strategy='EQUAL'
|
||||
allowedCD=222
|
||||
allowedCD=223
|
||||
allowedF=11
|
||||
|
@ -528,7 +528,8 @@ bool Buffer::isReadWriteOnCpuPreffered(void *ptr, size_t size) {
|
||||
}
|
||||
|
||||
//if we are not in System Memory Pool, it is more beneficial to do the transfer on GPU
|
||||
if (!MemoryPool::isSystemMemoryPool(graphicsAllocation->getMemoryPool())) {
|
||||
//for 32 bit applications, utilize CPU transfers here.
|
||||
if (!MemoryPool::isSystemMemoryPool(graphicsAllocation->getMemoryPool()) && is64bit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -228,5 +228,25 @@ TEST(ReadWriteBufferOnCpu, givenNoHostPtrAndAlignedSizeWhenMemoryAllocationIsInN
|
||||
reinterpret_cast<MemoryAllocation *>(buffer->getGraphicsAllocation())->overrideMemoryPool(MemoryPool::SystemCpuInaccessible);
|
||||
//read write on CPU is allowed, but not preffered. We can access this memory via Lock.
|
||||
EXPECT_TRUE(buffer->isReadWriteOnCpuAllowed());
|
||||
EXPECT_FALSE(buffer->isReadWriteOnCpuPreffered(reinterpret_cast<void *>(0x1000), MemoryConstants::pageSize));
|
||||
if (is32bit) {
|
||||
EXPECT_TRUE(buffer->isReadWriteOnCpuPreffered(reinterpret_cast<void *>(0x1000), MemoryConstants::pageSize));
|
||||
} else {
|
||||
EXPECT_FALSE(buffer->isReadWriteOnCpuPreffered(reinterpret_cast<void *>(0x1000), MemoryConstants::pageSize));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ReadWriteBufferOnCpu, given32BitApplicationWhenLocalMemoryPoolAllocationIsAskedForPreferenceThenCpuIsChoosen) {
|
||||
if (is64bit) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
MockContext ctx(device.get());
|
||||
|
||||
cl_int retVal = 0;
|
||||
std::unique_ptr<Buffer> buffer(Buffer::create(&ctx, CL_MEM_READ_WRITE, MemoryConstants::pageSize, nullptr, retVal));
|
||||
ASSERT_NE(nullptr, buffer.get());
|
||||
reinterpret_cast<MemoryAllocation *>(buffer->getGraphicsAllocation())->overrideMemoryPool(MemoryPool::LocalMemory);
|
||||
|
||||
EXPECT_TRUE(buffer->isReadWriteOnCpuAllowed());
|
||||
EXPECT_TRUE(buffer->isReadWriteOnCpuPreffered(reinterpret_cast<void *>(0x1000), MemoryConstants::pageSize));
|
||||
}
|
||||
|
@ -467,7 +467,9 @@ TEST(Buffer, givenClMemCopyHostPointerPassedToBufferCreateWhenAllocationIsNotInS
|
||||
std::unique_ptr<Buffer> buffer(Buffer::create(&ctx, flags, sizeof(memory), memory, retVal));
|
||||
ASSERT_NE(nullptr, buffer.get());
|
||||
auto taskCountSent = device->getGpgpuCommandStreamReceiver().peekLatestFlushedTaskCount();
|
||||
EXPECT_LT(taskCount, taskCountSent);
|
||||
if (is64bit) {
|
||||
EXPECT_LT(taskCount, taskCountSent);
|
||||
}
|
||||
}
|
||||
struct RenderCompressedBuffersTests : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
|
Reference in New Issue
Block a user