mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
User space AUBs to store GPU address in non-canonical form
This commit ensures that GPU address be stored to AUB file in decanonized form Change-Id: I6deb98e59d8c23d47d945a84c57ce81c0c5e2ba4
This commit is contained in:

committed by
sys_ocldev

parent
e3268f8a9c
commit
103b560655
@ -26,6 +26,7 @@
|
||||
#include "runtime/helpers/ptr_math.h"
|
||||
#include "runtime/memory_manager/graphics_allocation.h"
|
||||
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
#include <cstring>
|
||||
|
||||
namespace OCLRT {
|
||||
@ -405,7 +406,7 @@ void AUBCommandStreamReceiverHw<GfxFamily>::makeResident(GraphicsAllocation &gfx
|
||||
template <typename GfxFamily>
|
||||
bool AUBCommandStreamReceiverHw<GfxFamily>::writeMemory(GraphicsAllocation &gfxAllocation) {
|
||||
auto cpuAddress = gfxAllocation.getUnderlyingBuffer();
|
||||
auto gpuAddress = gfxAllocation.getGpuAddress();
|
||||
auto gpuAddress = Gmm::decanonize(gfxAllocation.getGpuAddress());
|
||||
auto size = gfxAllocation.getUnderlyingBufferSize();
|
||||
auto allocType = gfxAllocation.getAllocationType();
|
||||
|
||||
|
@ -90,6 +90,7 @@ else(MSVC)
|
||||
)
|
||||
endif(MSVC)
|
||||
|
||||
add_subdirectory(gen8)
|
||||
add_subdirectory(gen9)
|
||||
|
||||
target_link_libraries(igdrcl_aub_tests igdrcl_mocks)
|
||||
|
30
unit_tests/aub_tests/aub_tests_configuration.h
Normal file
30
unit_tests/aub_tests/aub_tests_configuration.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
struct AubTestsConfig {
|
||||
bool testCanonicalAddress;
|
||||
};
|
||||
|
||||
template <typename GfxFamily>
|
||||
AubTestsConfig GetAubTestsConfig();
|
31
unit_tests/aub_tests/aub_tests_configuration.inl
Normal file
31
unit_tests/aub_tests/aub_tests_configuration.inl
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "unit_tests/aub_tests/aub_tests_configuration.h"
|
||||
|
||||
template <typename GfxFamily>
|
||||
AubTestsConfig GetAubTestsConfig() {
|
||||
AubTestsConfig aubTestsConfig;
|
||||
aubTestsConfig.testCanonicalAddress = true;
|
||||
return aubTestsConfig;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@ -26,6 +26,7 @@
|
||||
#include "runtime/mem_obj/buffer.h"
|
||||
#include "unit_tests/aub_tests/command_queue/command_enqueue_fixture.h"
|
||||
#include "unit_tests/mocks/mock_context.h"
|
||||
#include "unit_tests/aub_tests/aub_tests_configuration.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
@ -111,3 +112,42 @@ INSTANTIATE_TEST_CASE_P(AUBReadBuffer_simple,
|
||||
1 * sizeof(cl_float),
|
||||
2 * sizeof(cl_float),
|
||||
3 * sizeof(cl_float)));
|
||||
|
||||
HWTEST_F(AUBReadBuffer, reserveCanonicalGpuAddress) {
|
||||
if (!GetAubTestsConfig<FamilyType>().testCanonicalAddress) {
|
||||
return;
|
||||
}
|
||||
|
||||
MockContext context;
|
||||
|
||||
cl_float srcMemory[] = {1.0f, 2.0f, 3.0f, 4.0f};
|
||||
cl_float dstMemory[] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
GraphicsAllocation *srcAlocation = new GraphicsAllocation(srcMemory, 0xFFFF800400001000, 0xFFFF800400001000, sizeof(srcMemory));
|
||||
|
||||
std::unique_ptr<Buffer> srcBuffer(Buffer::createBufferHw(&context,
|
||||
CL_MEM_USE_HOST_PTR,
|
||||
sizeof(srcMemory),
|
||||
srcAlocation->getUnderlyingBuffer(),
|
||||
srcMemory,
|
||||
srcAlocation,
|
||||
false,
|
||||
false,
|
||||
false));
|
||||
ASSERT_NE(nullptr, srcBuffer);
|
||||
|
||||
srcBuffer->forceDisallowCPUCopy = true;
|
||||
auto retVal = pCmdQ->enqueueReadBuffer(srcBuffer.get(),
|
||||
CL_TRUE,
|
||||
0,
|
||||
sizeof(dstMemory),
|
||||
dstMemory,
|
||||
0,
|
||||
nullptr,
|
||||
nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
GraphicsAllocation *dstAllocation = pCommandStreamReceiver->createAllocationAndHandleResidency(dstMemory, sizeof(dstMemory));
|
||||
cl_float *dstGpuAddress = reinterpret_cast<cl_float *>(dstAllocation->getGpuAddress());
|
||||
|
||||
AUBCommandStreamFixture::expectMemory<FamilyType>(dstGpuAddress, srcMemory, sizeof(dstMemory));
|
||||
}
|
||||
|
25
unit_tests/aub_tests/gen8/CMakeLists.txt
Normal file
25
unit_tests/aub_tests/gen8/CMakeLists.txt
Normal file
@ -0,0 +1,25 @@
|
||||
# Copyright (c) 2018, Intel Corporation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
if(TESTS_GEN8)
|
||||
target_sources(igdrcl_aub_tests PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_tests_configuration.cpp
|
||||
)
|
||||
endif(TESTS_GEN8)
|
28
unit_tests/aub_tests/gen8/aub_tests_configuration.cpp
Normal file
28
unit_tests/aub_tests/gen8/aub_tests_configuration.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "unit_tests/aub_tests/aub_tests_configuration.inl"
|
||||
#include "runtime/gen_common/hw_cmds.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
template AubTestsConfig GetAubTestsConfig<BDWFamily>();
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2017, Intel Corporation
|
||||
# Copyright (c) 2018, Intel Corporation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
@ -18,12 +18,11 @@
|
||||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR)
|
||||
|
||||
project(igdrcl_aub_tests)
|
||||
|
||||
if(TESTS_GEN9)
|
||||
add_subdirectory(batch_buffer)
|
||||
add_subdirectory(execution_model)
|
||||
add_subdirectory(skl)
|
||||
target_sources(igdrcl_aub_tests PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_tests_configuration.cpp
|
||||
)
|
||||
endif(TESTS_GEN9)
|
||||
|
28
unit_tests/aub_tests/gen9/aub_tests_configuration.cpp
Normal file
28
unit_tests/aub_tests/gen9/aub_tests_configuration.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "unit_tests/aub_tests/aub_tests_configuration.inl"
|
||||
#include "runtime/gen_common/hw_cmds.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
template AubTestsConfig GetAubTestsConfig<SKLFamily>();
|
Reference in New Issue
Block a user