Enhance AubTests with TBX server capability

- aub_tests started with "--tbx" option connects to TBX server
- CSR is created in dual mode: TBX + AUB to dump aub file
- with this enhancement it is possible to debug aub tests live

Change-Id: I0302f5f4bac4c293661a149f64888770dd49343c
This commit is contained in:
Hoppe, Mateusz
2018-09-18 16:45:45 -07:00
committed by sys_ocldev
parent b5b319872c
commit fe912704b8
10 changed files with 89 additions and 144 deletions

View File

@ -1,24 +1,10 @@
/* /*
* Copyright (c) 2017 - 2018, Intel Corporation * Copyright (C) 2017-2018 Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * SPDX-License-Identifier: MIT
* 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.
*/ */
// clang-format off // clang-format off
/*SIMULATION FLAGS*/ /*SIMULATION FLAGS*/
DECLARE_DEBUG_VARIABLE(std::string, TbxServer, std::string("127.0.0.1"), "TCP-IP address of TBX server") DECLARE_DEBUG_VARIABLE(std::string, TbxServer, std::string("127.0.0.1"), "TCP-IP address of TBX server")
@ -33,7 +19,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, AUBDumpSubCaptureMode, 0, "AUB dump subcapture m
DECLARE_DEBUG_VARIABLE(int32_t, AUBDumpFilterKernelStartIdx, 0, "Start index of kernel to AUB capture") DECLARE_DEBUG_VARIABLE(int32_t, AUBDumpFilterKernelStartIdx, 0, "Start index of kernel to AUB capture")
DECLARE_DEBUG_VARIABLE(int32_t, AUBDumpFilterKernelEndIdx, -1, "End index of kernel to AUB capture") DECLARE_DEBUG_VARIABLE(int32_t, AUBDumpFilterKernelEndIdx, -1, "End index of kernel to AUB capture")
DECLARE_DEBUG_VARIABLE(int32_t, AUBDumpToggleCaptureOnOff, 0, "Toggle AUB capture on/off") DECLARE_DEBUG_VARIABLE(int32_t, AUBDumpToggleCaptureOnOff, 0, "Toggle AUB capture on/off")
DECLARE_DEBUG_VARIABLE(int32_t, SetCommandStreamReceiver, 0, "Set command stream receiver") DECLARE_DEBUG_VARIABLE(int32_t, SetCommandStreamReceiver, 0, "Set command stream receiver to: 0 - HW, 1 - AUB, 2 - TBX, 3 - HW & AUB, 4 - TBX & AUB")
DECLARE_DEBUG_VARIABLE(int32_t, TbxPort, 4321, "TCP-IP port of TBX server") DECLARE_DEBUG_VARIABLE(int32_t, TbxPort, 4321, "TCP-IP port of TBX server")
DECLARE_DEBUG_VARIABLE(bool, FlattenBatchBufferForAUBDump, false, "Dump multi-level batch buffers to AUB as single, flat batch buffer") DECLARE_DEBUG_VARIABLE(bool, FlattenBatchBufferForAUBDump, false, "Dump multi-level batch buffers to AUB as single, flat batch buffer")
DECLARE_DEBUG_VARIABLE(bool, AddPatchInfoCommentsForAUBDump, false, "Dump comments containing allocations and patching information") DECLARE_DEBUG_VARIABLE(bool, AddPatchInfoCommentsForAUBDump, false, "Dump comments containing allocations and patching information")

View File

@ -1,32 +1,22 @@
/* /*
* Copyright (c) 2017 - 2018, Intel Corporation * Copyright (C) 2017-2018 Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * SPDX-License-Identifier: MIT
* 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 "runtime/command_queue/command_queue.h" #include "runtime/command_queue/command_queue.h"
#include "runtime/command_stream/command_stream_receiver.h" #include "runtime/command_stream/command_stream_receiver.h"
#include "runtime/command_stream/tbx_command_stream_receiver.h"
#include "runtime/device/device.h" #include "runtime/device/device.h"
#include "gen_cmd_parse.h"
#include "unit_tests/aub_tests/command_stream/aub_command_stream_fixture.h"
#include "unit_tests/helpers/memory_management.h" #include "unit_tests/helpers/memory_management.h"
#include "unit_tests/mocks/mock_device.h" #include "unit_tests/mocks/mock_device.h"
#include "gen_cmd_parse.h" #include "unit_tests/tests_configuration.h"
#include "unit_tests/aub_tests/command_stream/aub_command_stream_fixture.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
namespace OCLRT { namespace OCLRT {
@ -40,7 +30,11 @@ void AUBCommandStreamFixture::SetUp(CommandQueue *pCmdQ) {
strfilename << testInfo->test_case_name() << "_" << testInfo->name(); strfilename << testInfo->test_case_name() << "_" << testInfo->name();
const auto &hwInfo = device.getHardwareInfo(); const auto &hwInfo = device.getHardwareInfo();
pCommandStreamReceiver = AUBCommandStreamReceiver::create(hwInfo, strfilename.str(), true, *device.executionEnvironment); if (testMode == TestMode::AubTestsWithTbx) {
pCommandStreamReceiver = TbxCommandStreamReceiver::create(hwInfo, true, *device.executionEnvironment);
} else {
pCommandStreamReceiver = AUBCommandStreamReceiver::create(hwInfo, strfilename.str(), true, *device.executionEnvironment);
}
ASSERT_NE(nullptr, pCommandStreamReceiver); ASSERT_NE(nullptr, pCommandStreamReceiver);
device.resetCommandStreamReceiver(pCommandStreamReceiver); device.resetCommandStreamReceiver(pCommandStreamReceiver);

View File

@ -1,32 +1,20 @@
/* /*
* Copyright (c) 2017 - 2018, Intel Corporation * Copyright (C) 2017-2018 Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * SPDX-License-Identifier: MIT
* 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 #pragma once
#include "runtime/command_stream/aub_command_stream_receiver_hw.h" #include "runtime/command_stream/aub_command_stream_receiver_hw.h"
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
#include "runtime/command_stream/tbx_command_stream_receiver_hw.h"
#include "unit_tests/command_stream/command_stream_fixture.h" #include "unit_tests/command_stream/command_stream_fixture.h"
#include "unit_tests/tests_configuration.h"
#include <cstdint> #include <cstdint>
namespace OCLRT { namespace OCLRT {
class CommandStreamReceiver; class CommandStreamReceiver;
class AUBCommandStreamFixture : public CommandStreamFixture { class AUBCommandStreamFixture : public CommandStreamFixture {
@ -50,14 +38,24 @@ class AUBCommandStreamFixture : public CommandStreamFixture {
header.readMaskHigh = 0xffffffff; header.readMaskHigh = 0xffffffff;
header.dwordCount = (sizeof(header) / sizeof(uint32_t)) - 1; header.dwordCount = (sizeof(header) / sizeof(uint32_t)) - 1;
CommandStreamReceiver *csr = pCommandStreamReceiver;
if (testMode == TestMode::AubTestsWithTbx) {
csr = reinterpret_cast<CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<FamilyType>> *>(pCommandStreamReceiver)->aubCSR;
}
// Write our pseudo-op to the AUB file // Write our pseudo-op to the AUB file
auto aubCsr = reinterpret_cast<AUBCommandStreamReceiverHw<FamilyType> *>(pCommandStreamReceiver); auto aubCsr = reinterpret_cast<AUBCommandStreamReceiverHw<FamilyType> *>(csr);
aubCsr->stream->fileHandle.write(reinterpret_cast<char *>(&header), sizeof(header)); aubCsr->stream->fileHandle.write(reinterpret_cast<char *>(&header), sizeof(header));
} }
template <typename FamilyType> template <typename FamilyType>
void expectMemory(void *gfxAddress, const void *srcAddress, size_t length) { void expectMemory(void *gfxAddress, const void *srcAddress, size_t length) {
auto aubCsr = reinterpret_cast<AUBCommandStreamReceiverHw<FamilyType> *>(pCommandStreamReceiver); CommandStreamReceiver *csr = pCommandStreamReceiver;
if (testMode == TestMode::AubTestsWithTbx) {
csr = reinterpret_cast<CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<FamilyType>> *>(pCommandStreamReceiver)->aubCSR;
}
auto aubCsr = reinterpret_cast<AUBCommandStreamReceiverHw<FamilyType> *>(csr);
PageWalker walker = [&](uint64_t physAddress, size_t size, size_t offset) { PageWalker walker = [&](uint64_t physAddress, size_t size, size_t offset) {
if (offset > length) if (offset > length)
abort(); abort();

View File

@ -1,29 +1,19 @@
/* /*
* Copyright (c) 2018, Intel Corporation * Copyright (C) 2018 Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * SPDX-License-Identifier: MIT
* 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 "runtime/tbx/tbx_sockets_imp.h"
#include "unit_tests/mocks/mock_tbx_sockets.h" #include "unit_tests/mocks/mock_tbx_sockets.h"
#include "unit_tests/tests_configuration.h"
namespace OCLRT { namespace OCLRT {
TbxSockets *TbxSockets::create() { TbxSockets *TbxSockets::create() {
if (testMode == TestMode::AubTestsWithTbx) {
return new TbxSocketsImp;
}
return new MockTbxSockets; return new MockTbxSockets;
} }
} // namespace OCLRT } // namespace OCLRT

View File

@ -1,31 +1,18 @@
# Copyright (c) 2017 - 2018, Intel Corporation
# #
# Permission is hereby granted, free of charge, to any person obtaining a # Copyright (C) 2017-2018 Intel Corporation
# 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 # SPDX-License-Identifier: MIT
# 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.
set(IGDRCL_SRCS_linux_tests set(IGDRCL_SRCS_linux_tests
${CMAKE_CURRENT_SOURCE_DIR}/linux_tests_configuration.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main_linux.cpp ${CMAKE_CURRENT_SOURCE_DIR}/main_linux.cpp
${IGDRCL_SOURCE_DIR}/unit_tests/os_interface/linux/allocator_helper.cpp ${IGDRCL_SOURCE_DIR}/unit_tests/os_interface/linux/allocator_helper.cpp
${IGDRCL_SOURCE_DIR}/unit_tests/os_interface/linux/options.cpp ${IGDRCL_SOURCE_DIR}/unit_tests/os_interface/linux/options.cpp
) )
set(IGDRCL_SRCS_linux_dll_tests set(IGDRCL_SRCS_linux_dll_tests
${CMAKE_CURRENT_SOURCE_DIR}/linux_tests_configuration.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main_linux_dll.cpp ${CMAKE_CURRENT_SOURCE_DIR}/main_linux_dll.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drm_null_device_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drm_null_device_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mock_os_layer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/mock_os_layer.cpp

View File

@ -0,0 +1,12 @@
/*
* Copyright (C) 2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "unit_tests/tests_configuration.h"
namespace OCLRT {
TestMode testMode = TestMode::NotSpecified;
} // namespace OCLRT

View File

@ -1,23 +1,8 @@
/* /*
* Copyright (c) 2017 - 2018, Intel Corporation * Copyright (C) 2017-2018 Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * SPDX-License-Identifier: MIT
* 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 "global_environment.h" #include "global_environment.h"
@ -222,6 +207,10 @@ int main(int argc, char **argv) {
enable_alarm = false; enable_alarm = false;
} else if (!strcmp("--print_memory_op_cs", argv[i])) { } else if (!strcmp("--print_memory_op_cs", argv[i])) {
printMemoryOpCallStack = true; printMemoryOpCallStack = true;
} else if (!strcmp("--tbx", argv[i])) {
if (testMode == TestMode::AubTests) {
testMode = TestMode::AubTestsWithTbx;
}
} else if (!strcmp("--devices", argv[i])) { } else if (!strcmp("--devices", argv[i])) {
++i; ++i;
if (i < argc) { if (i < argc) {

View File

@ -1,26 +1,12 @@
# Copyright (c) 2017 - 2018, Intel Corporation
# #
# Permission is hereby granted, free of charge, to any person obtaining a # Copyright (C) 2017-2018 Intel Corporation
# 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 # SPDX-License-Identifier: MIT
# 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.
project(igdrcl_tbx_tests)
add_executable(igdrcl_tbx_tests add_executable(igdrcl_tbx_tests
${CMAKE_CURRENT_SOURCE_DIR}/main_tbx.cpp ${CMAKE_CURRENT_SOURCE_DIR}/main_tbx.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tbx_tests_configuration.cpp
${IGDRCL_SOURCE_DIR}/runtime/dll/create_command_stream.cpp ${IGDRCL_SOURCE_DIR}/runtime/dll/create_command_stream.cpp
${IGDRCL_SOURCE_DIR}/unit_tests/options.cpp ${IGDRCL_SOURCE_DIR}/unit_tests/options.cpp
$<TARGET_OBJECTS:igdrcl_libult> $<TARGET_OBJECTS:igdrcl_libult>

View File

@ -0,0 +1,12 @@
/*
* Copyright (C) 2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "unit_tests/tests_configuration.h"
namespace OCLRT {
TestMode testMode = TestMode::TbxTests;
} // namespace OCLRT

View File

@ -1,27 +1,18 @@
/* /*
* Copyright (c) 2018, Intel Corporation * Copyright (C) 2018 Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * SPDX-License-Identifier: MIT
* 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 #pragma once
namespace OCLRT { namespace OCLRT {
enum class TestMode { NotSpecified, UnitTests, AubTests }; enum class TestMode { NotSpecified,
UnitTests,
AubTests,
AubTestsWithTbx,
TbxTests };
extern TestMode testMode;
} // namespace OCLRT } // namespace OCLRT