mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Pass proper device bitfield when allocating global/constant surface
Related-To: NEO-4484 Change-Id: Iecb968bfc6ed3f7e3dc216dab3f26693c1b949d6 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
b58371df4e
commit
a604eee07b
@ -182,6 +182,20 @@ TEST_F(ProgramDataTest, AllocateConstantMemorySurfaceProgramBinaryInfo) {
|
||||
EXPECT_EQ(0, memcmp(constValue, pProgram->getConstantSurface()->getUnderlyingBuffer(), constSize));
|
||||
}
|
||||
|
||||
TEST_F(ProgramDataTest, givenProgramWhenAllocatingConstantMemorySurfaceThenProperDeviceBitfieldIsPassed) {
|
||||
auto executionEnvironment = pProgram->getDevice().getExecutionEnvironment();
|
||||
auto memoryManager = new MockMemoryManager(*executionEnvironment);
|
||||
|
||||
std::unique_ptr<MemoryManager> memoryManagerBackup(memoryManager);
|
||||
std::swap(memoryManagerBackup, executionEnvironment->memoryManager);
|
||||
EXPECT_NE(pProgram->getDevice().getDeviceBitfield(), memoryManager->recentlyPassedDeviceBitfield);
|
||||
setupConstantAllocation();
|
||||
buildAndDecodeProgramPatchList();
|
||||
EXPECT_NE(nullptr, pProgram->getConstantSurface());
|
||||
EXPECT_EQ(pProgram->getDevice().getDeviceBitfield(), memoryManager->recentlyPassedDeviceBitfield);
|
||||
std::swap(memoryManagerBackup, executionEnvironment->memoryManager);
|
||||
}
|
||||
|
||||
TEST_F(ProgramDataTest, whenGlobalConstantsAreExportedThenAllocateSurfacesAsSvm) {
|
||||
if (this->pContext->getSVMAllocsManager() == nullptr) {
|
||||
return;
|
||||
@ -354,6 +368,20 @@ TEST_F(ProgramDataTest, AllocateGlobalMemorySurfaceProgramBinaryInfo) {
|
||||
EXPECT_NE(nullptr, pProgram->getGlobalSurface());
|
||||
EXPECT_EQ(0, memcmp(globalValue, pProgram->getGlobalSurface()->getUnderlyingBuffer(), globalSize));
|
||||
}
|
||||
TEST_F(ProgramDataTest, givenProgramWhenAllocatingGlobalMemorySurfaceThenProperDeviceBitfieldIsPassed) {
|
||||
auto executionEnvironment = pProgram->getDevice().getExecutionEnvironment();
|
||||
auto memoryManager = new MockMemoryManager(*executionEnvironment);
|
||||
|
||||
std::unique_ptr<MemoryManager> memoryManagerBackup(memoryManager);
|
||||
std::swap(memoryManagerBackup, executionEnvironment->memoryManager);
|
||||
EXPECT_NE(pProgram->getDevice().getDeviceBitfield(), memoryManager->recentlyPassedDeviceBitfield);
|
||||
|
||||
setupGlobalAllocation();
|
||||
buildAndDecodeProgramPatchList();
|
||||
EXPECT_NE(nullptr, pProgram->getGlobalSurface());
|
||||
EXPECT_EQ(pProgram->getDevice().getDeviceBitfield(), memoryManager->recentlyPassedDeviceBitfield);
|
||||
std::swap(memoryManagerBackup, executionEnvironment->memoryManager);
|
||||
}
|
||||
|
||||
TEST_F(ProgramDataTest, Given32BitDeviceWhenGlobalMemorySurfaceIsPresentThenItHas32BitStorage) {
|
||||
char globalValue[] = "55667788";
|
||||
|
Reference in New Issue
Block a user