mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Add StateComputeModeProperties to StreamProperties
Related-To: NEO-4940, NEO-4574 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
3d7b1abe80
commit
d693d24f27
@@ -18,10 +18,11 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class GmmHelper;
|
||||
struct HardwareInfo;
|
||||
class IndirectHeap;
|
||||
class BindlessHeapsHelper;
|
||||
class GmmHelper;
|
||||
class IndirectHeap;
|
||||
struct HardwareInfo;
|
||||
struct StateComputeModeProperties;
|
||||
|
||||
template <typename GfxFamily>
|
||||
struct EncodeDispatchKernel {
|
||||
@@ -267,9 +268,7 @@ struct EncodeSurfaceState {
|
||||
|
||||
template <typename GfxFamily>
|
||||
struct EncodeComputeMode {
|
||||
using STATE_COMPUTE_MODE = typename GfxFamily::STATE_COMPUTE_MODE;
|
||||
static void adjustComputeMode(LinearStream &csr, uint32_t numGrfRequired, void *const stateComputeModePtr,
|
||||
bool isMultiOsContextCapable, bool useGlobalAtomics, bool areMultipleSubDevicesInContext);
|
||||
static void adjustComputeMode(LinearStream &csr, void *const stateComputeModePtr, StateComputeModeProperties &properties);
|
||||
|
||||
static void adjustPipelineSelect(CommandContainer &container, const NEO::KernelDescriptor &kernelDescriptor);
|
||||
};
|
||||
|
||||
@@ -68,11 +68,6 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container,
|
||||
idd.setKernelStartPointerHigh(0u);
|
||||
}
|
||||
|
||||
EncodeWA<Family>::encodeAdditionalPipelineSelect(*container.getDevice(), *container.getCommandStream(), true);
|
||||
EncodeStates<Family>::adjustStateComputeMode(*container.getCommandStream(), container.lastSentNumGrfRequired, nullptr, false, false,
|
||||
kernelDescriptor.kernelAttributes.flags.useGlobalAtomics, device->getNumAvailableDevices() > 1);
|
||||
EncodeWA<Family>::encodeAdditionalPipelineSelect(*container.getDevice(), *container.getCommandStream(), false);
|
||||
|
||||
auto numThreadsPerThreadGroup = dispatchInterface->getNumThreadsPerThreadGroup();
|
||||
idd.setNumberOfThreadsInGpgpuThreadGroup(numThreadsPerThreadGroup);
|
||||
|
||||
@@ -344,6 +339,14 @@ size_t EncodeDispatchKernel<Family>::estimateEncodeDispatchKernelCmdsSize(Device
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
void EncodeComputeMode<Family>::adjustComputeMode(LinearStream &csr, void *const stateComputeModePtr, StateComputeModeProperties &properties) {
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
void EncodeComputeMode<Family>::adjustPipelineSelect(CommandContainer &container, const NEO::KernelDescriptor &kernelDescriptor) {
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
void EncodeStateBaseAddress<Family>::encode(CommandContainer &container, STATE_BASE_ADDRESS &sbaCmd) {
|
||||
auto gmmHelper = container.getDevice()->getRootDeviceEnvironment().getGmmHelper();
|
||||
|
||||
@@ -13,15 +13,9 @@ namespace NEO {
|
||||
template <typename Family>
|
||||
void EncodeStates<Family>::adjustStateComputeMode(LinearStream &csr, uint32_t numGrfRequired, void *const stateComputeModePtr,
|
||||
bool isMultiOsContextCapable, bool requiresCoherency, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) {
|
||||
using STATE_COMPUTE_MODE = typename Family::STATE_COMPUTE_MODE;
|
||||
using FORCE_NON_COHERENT = typename STATE_COMPUTE_MODE::FORCE_NON_COHERENT;
|
||||
STATE_COMPUTE_MODE stateComputeMode = (stateComputeModePtr != nullptr) ? *(static_cast<STATE_COMPUTE_MODE *>(stateComputeModePtr)) : Family::cmdInitStateComputeMode;
|
||||
FORCE_NON_COHERENT coherencyValue = !requiresCoherency ? FORCE_NON_COHERENT::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT : FORCE_NON_COHERENT::FORCE_NON_COHERENT_FORCE_DISABLED;
|
||||
stateComputeMode.setForceNonCoherent(coherencyValue);
|
||||
|
||||
stateComputeMode.setMaskBits(stateComputeMode.getMaskBits() | Family::stateComputeModeForceNonCoherentMask);
|
||||
|
||||
EncodeComputeMode<Family>::adjustComputeMode(csr, numGrfRequired, &stateComputeMode, isMultiOsContextCapable, useGlobalAtomics, areMultipleSubDevicesInContext);
|
||||
StreamProperties properties{};
|
||||
properties.setStateComputeModeProperties(requiresCoherency, numGrfRequired, isMultiOsContextCapable, useGlobalAtomics, areMultipleSubDevicesInContext);
|
||||
EncodeComputeMode<Family>::adjustComputeMode(csr, stateComputeModePtr, properties.stateComputeMode);
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
|
||||
@@ -18,7 +18,7 @@ set(NEO_CORE_COMMAND_STREAM
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/csr_deps.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}/command_stream_receiver_hw_ext.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}/csr_properties_flags.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}/stream_properties.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}/stream_properties.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/device_command_stream.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental_command_buffer.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental_command_buffer.h
|
||||
@@ -33,6 +33,9 @@ set(NEO_CORE_COMMAND_STREAM
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scratch_space_controller.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scratch_space_controller_base.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scratch_space_controller_base.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/stream_properties.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/stream_properties.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/stream_property.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/submissions_aggregator.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/submissions_aggregator.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/thread_arbitration_policy.h
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "shared/source/command_stream/linear_stream.h"
|
||||
#include "shared/source/command_stream/preemption.h"
|
||||
#include "shared/source/command_stream/scratch_space_controller_base.h"
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/direct_submission/direct_submission_hw.h"
|
||||
@@ -32,7 +33,6 @@
|
||||
#include "shared/source/utilities/tag_allocator.h"
|
||||
|
||||
#include "command_stream_receiver_hw_ext.inl"
|
||||
#include "stream_properties.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace NEO {
|
||||
|
||||
struct StreamProperties {
|
||||
bool setCooperativeKernelProperties(int32_t cooperativeKernelProperties, const HardwareInfo &hwInfo) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t getCooperativeKernelProperties() const {
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/stream_property.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
struct StateComputeModeProperties {
|
||||
StreamProperty isCoherencyRequired{};
|
||||
|
||||
bool isDirty();
|
||||
void clearIsDirty();
|
||||
};
|
||||
|
||||
struct FrontEndProperties {
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
34
shared/source/command_stream/stream_properties.cpp
Normal file
34
shared/source/command_stream/stream_properties.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
bool StreamProperties::setCooperativeKernelProperties(int32_t cooperativeKernelProperties, const HardwareInfo &hwInfo) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t StreamProperties::getCooperativeKernelProperties() const {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void StreamProperties::setStateComputeModeProperties(bool requiresCoherency, uint32_t numGrfRequired, bool isMultiOsContextCapable,
|
||||
bool useGlobalAtomics, bool areMultipleSubDevicesInContext) {
|
||||
stateComputeMode.clearIsDirty();
|
||||
|
||||
int32_t isCoherencyRequired = (requiresCoherency ? 1 : 0);
|
||||
stateComputeMode.isCoherencyRequired.set(isCoherencyRequired);
|
||||
}
|
||||
|
||||
bool StateComputeModeProperties::isDirty() {
|
||||
return isCoherencyRequired.isDirty;
|
||||
}
|
||||
|
||||
void StateComputeModeProperties::clearIsDirty() {
|
||||
isCoherencyRequired.isDirty = false;
|
||||
}
|
||||
28
shared/source/command_stream/stream_properties.h
Normal file
28
shared/source/command_stream/stream_properties.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
|
||||
#include "stream_properties.inl"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
struct StreamProperties {
|
||||
bool setCooperativeKernelProperties(int32_t cooperativeKernelProperties, const HardwareInfo &hwInfo);
|
||||
int32_t getCooperativeKernelProperties() const;
|
||||
|
||||
void setStateComputeModeProperties(bool requiresCoherency, uint32_t numGrfRequired, bool isMultiOsContextCapable,
|
||||
bool useGlobalAtomics, bool areMultipleSubDevicesInContext);
|
||||
|
||||
StateComputeModeProperties stateComputeMode{};
|
||||
FrontEndProperties frontEndState{};
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
25
shared/source/command_stream/stream_property.h
Normal file
25
shared/source/command_stream/stream_property.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
struct StreamProperty {
|
||||
int32_t value = -1;
|
||||
bool isDirty = false;
|
||||
void set(int32_t newValue) {
|
||||
if ((value != newValue) && (newValue != -1)) {
|
||||
value = newValue;
|
||||
isDirty = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
@@ -56,4 +56,5 @@ template struct EncodeMiFlushDW<Family>;
|
||||
template struct EncodeMemoryPrefetch<Family>;
|
||||
template struct EncodeWA<Family>;
|
||||
template struct EncodeMiArbCheck<Family>;
|
||||
template struct EncodeComputeMode<Family>;
|
||||
} // namespace NEO
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/source/gen12lp/hw_cmds_base.h"
|
||||
#include "shared/source/gen12lp/reg_configs.h"
|
||||
#include "shared/source/helpers/preamble.h"
|
||||
@@ -35,11 +36,25 @@ size_t EncodeStates<Family>::getAdjustStateComputeModeSize() {
|
||||
}
|
||||
|
||||
template <>
|
||||
void EncodeComputeMode<Family>::adjustComputeMode(LinearStream &csr, uint32_t numGrfRequired, void *const stateComputeModePtr,
|
||||
bool isMultiOsContextCapable, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) {
|
||||
STATE_COMPUTE_MODE *stateComputeMode = static_cast<STATE_COMPUTE_MODE *>(stateComputeModePtr);
|
||||
void EncodeComputeMode<Family>::adjustComputeMode(LinearStream &csr, void *const stateComputeModePtr, StateComputeModeProperties &properties) {
|
||||
using STATE_COMPUTE_MODE = typename Family::STATE_COMPUTE_MODE;
|
||||
using FORCE_NON_COHERENT = typename STATE_COMPUTE_MODE::FORCE_NON_COHERENT;
|
||||
|
||||
STATE_COMPUTE_MODE stateComputeMode = (stateComputeModePtr) ? *(static_cast<STATE_COMPUTE_MODE *>(stateComputeModePtr))
|
||||
: Family::cmdInitStateComputeMode;
|
||||
auto maskBits = stateComputeMode.getMaskBits();
|
||||
|
||||
if (properties.isCoherencyRequired.isDirty) {
|
||||
FORCE_NON_COHERENT coherencyValue = !properties.isCoherencyRequired.value ? FORCE_NON_COHERENT::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT
|
||||
: FORCE_NON_COHERENT::FORCE_NON_COHERENT_FORCE_DISABLED;
|
||||
stateComputeMode.setForceNonCoherent(coherencyValue);
|
||||
maskBits |= Family::stateComputeModeForceNonCoherentMask;
|
||||
}
|
||||
|
||||
stateComputeMode.setMaskBits(maskBits);
|
||||
|
||||
auto buffer = csr.getSpace(sizeof(STATE_COMPUTE_MODE));
|
||||
*reinterpret_cast<STATE_COMPUTE_MODE *>(buffer) = *stateComputeMode;
|
||||
*reinterpret_cast<STATE_COMPUTE_MODE *>(buffer) = stateComputeMode;
|
||||
}
|
||||
|
||||
template <>
|
||||
@@ -96,4 +111,5 @@ template struct EncodeMiFlushDW<Family>;
|
||||
template struct EncodeWA<Family>;
|
||||
template struct EncodeMemoryPrefetch<Family>;
|
||||
template struct EncodeMiArbCheck<Family>;
|
||||
template struct EncodeComputeMode<Family>;
|
||||
} // namespace NEO
|
||||
|
||||
@@ -50,4 +50,5 @@ template struct EncodeMiFlushDW<Family>;
|
||||
template struct EncodeMemoryPrefetch<Family>;
|
||||
template struct EncodeWA<Family>;
|
||||
template struct EncodeMiArbCheck<Family>;
|
||||
template struct EncodeComputeMode<Family>;
|
||||
} // namespace NEO
|
||||
|
||||
@@ -50,4 +50,5 @@ template struct EncodeMiFlushDW<Family>;
|
||||
template struct EncodeMemoryPrefetch<Family>;
|
||||
template struct EncodeWA<Family>;
|
||||
template struct EncodeMiArbCheck<Family>;
|
||||
template struct EncodeComputeMode<Family>;
|
||||
} // namespace NEO
|
||||
|
||||
@@ -5,14 +5,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/source/helpers/flat_batch_buffer_helper.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/helpers/preamble_base.inl"
|
||||
|
||||
#include "opencl/source/kernel/kernel_execution_type.h"
|
||||
|
||||
#include "stream_properties.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/preemption.h"
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/unit_test/preamble/preamble_fixture.h"
|
||||
|
||||
#include "reg_configs_common.h"
|
||||
#include "stream_properties.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ if(TESTS_GEN12LP)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_encoder_tests_gen12lp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image_surface_state_tests_gen12lp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_command_encoder_gen12lp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_encode_gen12lp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_encode_math_gen12lp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_preemption_gen12lp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/unit_test_helper_gen12lp.cpp
|
||||
|
||||
43
shared/test/common/gen12lp/test_encode_gen12lp.cpp
Normal file
43
shared/test/common/gen12lp/test_encode_gen12lp.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#include "hw_cmds.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using CommandEncodeGen12LpTest = ::testing::Test;
|
||||
|
||||
GEN12LPTEST_F(CommandEncodeGen12LpTest, whenProgrammingStateComputeModeThenProperFieldsAreSet) {
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
uint8_t buffer[64]{};
|
||||
|
||||
StateComputeModeProperties properties;
|
||||
auto pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
|
||||
EncodeComputeMode<FamilyType>::adjustComputeMode(*pLinearStream, nullptr, properties);
|
||||
auto pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
|
||||
EXPECT_EQ(0u, pScm->getMaskBits());
|
||||
EXPECT_EQ(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_DISABLED, pScm->getForceNonCoherent());
|
||||
|
||||
properties.isCoherencyRequired.value = 0;
|
||||
pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
|
||||
EncodeComputeMode<FamilyType>::adjustComputeMode(*pLinearStream, nullptr, properties);
|
||||
pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
|
||||
EXPECT_EQ(0u, pScm->getMaskBits());
|
||||
EXPECT_EQ(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_DISABLED, pScm->getForceNonCoherent());
|
||||
|
||||
properties.isCoherencyRequired.isDirty = true;
|
||||
pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
|
||||
EncodeComputeMode<FamilyType>::adjustComputeMode(*pLinearStream, nullptr, properties);
|
||||
pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
|
||||
EXPECT_EQ(FamilyType::stateComputeModeForceNonCoherentMask, pScm->getMaskBits());
|
||||
EXPECT_EQ(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT, pScm->getForceNonCoherent());
|
||||
}
|
||||
@@ -6,11 +6,11 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/preemption.h"
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/unit_test/preamble/preamble_fixture.h"
|
||||
|
||||
#include "reg_configs_common.h"
|
||||
#include "stream_properties.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/source/command_stream/thread_arbitration_policy.h"
|
||||
#include "shared/source/gen8/reg_configs.h"
|
||||
#include "shared/source/helpers/preamble.h"
|
||||
@@ -12,8 +13,6 @@
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/platform_fixture.h"
|
||||
|
||||
#include "stream_properties.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
typedef PreambleFixture BdwSlm;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/preemption.h"
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/source/command_stream/thread_arbitration_policy.h"
|
||||
#include "shared/source/gen9/reg_configs.h"
|
||||
#include "shared/source/helpers/preamble.h"
|
||||
@@ -13,8 +14,6 @@
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/unit_test/preamble/preamble_fixture.h"
|
||||
|
||||
#include "stream_properties.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
typedef PreambleFixture SklSlm;
|
||||
|
||||
13
shared/test/unit_test/command_stream/CMakeLists.txt
Normal file
13
shared/test/unit_test/command_stream/CMakeLists.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# Copyright (C) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/stream_properties_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/stream_properties_tests_common.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/stream_properties_tests_common.h
|
||||
)
|
||||
add_subdirectories()
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/test/unit_test/command_stream/stream_properties_tests_common.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
std::vector<StreamProperty *> getAllStateComputeModeProperties(StateComputeModeProperties &properties) {
|
||||
std::vector<StreamProperty *> allProperties;
|
||||
allProperties.push_back(&properties.isCoherencyRequired);
|
||||
return allProperties;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/unit_test/command_stream/stream_properties_tests_common.h"
|
||||
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
TEST(StreamPropertiesTests, whenPropertyValueIsChangedThenProperStateIsSet) {
|
||||
NEO::StreamProperty streamProperty;
|
||||
|
||||
EXPECT_EQ(-1, streamProperty.value);
|
||||
EXPECT_FALSE(streamProperty.isDirty);
|
||||
|
||||
streamProperty.set(-1);
|
||||
EXPECT_EQ(-1, streamProperty.value);
|
||||
EXPECT_FALSE(streamProperty.isDirty);
|
||||
|
||||
int32_t valuesToTest[] = {0, 1};
|
||||
for (auto valueToTest : valuesToTest) {
|
||||
streamProperty.set(valueToTest);
|
||||
EXPECT_EQ(valueToTest, streamProperty.value);
|
||||
EXPECT_TRUE(streamProperty.isDirty);
|
||||
|
||||
streamProperty.isDirty = false;
|
||||
streamProperty.set(valueToTest);
|
||||
EXPECT_EQ(valueToTest, streamProperty.value);
|
||||
EXPECT_FALSE(streamProperty.isDirty);
|
||||
|
||||
streamProperty.set(-1);
|
||||
EXPECT_EQ(valueToTest, streamProperty.value);
|
||||
EXPECT_FALSE(streamProperty.isDirty);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(StreamPropertiesTests, whenSettingStateComputeModePropertiesThenCorrectValuesAreSet) {
|
||||
StreamProperties properties;
|
||||
for (auto requiresCoherency : ::testing::Bool()) {
|
||||
properties.setStateComputeModeProperties(requiresCoherency, 0u, false, false, false);
|
||||
EXPECT_EQ(requiresCoherency, properties.stateComputeMode.isCoherencyRequired.value);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(StreamPropertiesTests, givenVariousStatesOfThePropertiesWhenIsStateComputeModeDirtyIsQueriedThenCorrectValueIsReturned) {
|
||||
struct MockStateComputeModeProperties : StateComputeModeProperties {
|
||||
using StateComputeModeProperties::clearIsDirty;
|
||||
};
|
||||
MockStateComputeModeProperties properties;
|
||||
|
||||
EXPECT_FALSE(properties.isDirty());
|
||||
for (auto pProperty : getAllStateComputeModeProperties(properties)) {
|
||||
pProperty->isDirty = true;
|
||||
EXPECT_TRUE(properties.isDirty());
|
||||
pProperty->isDirty = false;
|
||||
EXPECT_FALSE(properties.isDirty());
|
||||
}
|
||||
for (auto pProperty : getAllStateComputeModeProperties(properties)) {
|
||||
pProperty->isDirty = true;
|
||||
}
|
||||
EXPECT_TRUE(properties.isDirty());
|
||||
|
||||
properties.clearIsDirty();
|
||||
for (auto pProperty : getAllStateComputeModeProperties(properties)) {
|
||||
EXPECT_FALSE(pProperty->isDirty);
|
||||
}
|
||||
EXPECT_FALSE(properties.isDirty());
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
struct StateComputeModeProperties;
|
||||
struct StreamProperty;
|
||||
|
||||
std::vector<StreamProperty *> getAllStateComputeModeProperties(StateComputeModeProperties &properties);
|
||||
|
||||
} // namespace NEO
|
||||
@@ -43,7 +43,7 @@ TEST_F(CommandEncodeStatesTest, givenCommandConatinerCreatedWithMaxNumAggregateI
|
||||
delete cmdContainer;
|
||||
}
|
||||
|
||||
HWTEST_F(CommandEncodeStatesTest, givenenDispatchInterfaceWhenDispatchKernelThenWalkerCommandProgrammed) {
|
||||
HWTEST_F(CommandEncodeStatesTest, givenDispatchInterfaceWhenDispatchKernelThenWalkerCommandProgrammed) {
|
||||
uint32_t dims[] = {2, 1, 1};
|
||||
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
|
||||
bool requiresUncachedMocs = false;
|
||||
@@ -629,13 +629,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandEncodeStatesTest, givenCleanHeapsAndSlmNotCha
|
||||
GenCmdList commands;
|
||||
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());
|
||||
|
||||
if (MemorySynchronizationCommands<FamilyType>::isPipeControlPriorToPipelineSelectWArequired(pDevice->getHardwareInfo())) {
|
||||
auto itorPC = findAll<PIPE_CONTROL *>(commands.begin(), commands.end());
|
||||
EXPECT_EQ(2u, itorPC.size());
|
||||
} else {
|
||||
auto itorPC = find<PIPE_CONTROL *>(commands.begin(), commands.end());
|
||||
ASSERT_EQ(itorPC, commands.end());
|
||||
}
|
||||
auto itorPC = find<PIPE_CONTROL *>(commands.begin(), commands.end());
|
||||
ASSERT_EQ(itorPC, commands.end());
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, CommandEncodeStatesTest, givenCleanHeapsAndSlmNotChangedAndUncachedMocsRequestedThenSBAIsProgrammedAndMocsAreSet) {
|
||||
|
||||
@@ -284,3 +284,17 @@ HWTEST_F(CommandEncodeStatesTest, givenAnUnalignedDstPtrThenCorrectAlignedPtrAnd
|
||||
EXPECT_TRUE((ptr & (NEO::EncodeSurfaceState<FamilyType>::getSurfaceBaseAddressAlignment() - 1)) == 0x0u);
|
||||
EXPECT_NE(0u, offset);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, CommandEncodeStatesTest, whenAdjustPipelineSelectIsCalledThenNothingHappens) {
|
||||
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
|
||||
auto initialUsed = cmdContainer->getCommandStream()->getUsed();
|
||||
NEO::EncodeComputeMode<FamilyType>::adjustPipelineSelect(*cmdContainer, descriptor);
|
||||
EXPECT_EQ(initialUsed, cmdContainer->getCommandStream()->getUsed());
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandEncodeStatesTest, whenAdjustStateComputeModeIsCalledThenNothingHappens, IsAtMostGen11) {
|
||||
using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT;
|
||||
auto initialUsed = cmdContainer->getCommandStream()->getUsed();
|
||||
NEO::EncodeStates<FamilyType>::adjustStateComputeMode(*cmdContainer->getCommandStream(), 0, nullptr, false, false, false, false);
|
||||
EXPECT_EQ(initialUsed, cmdContainer->getCommandStream()->getUsed());
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/preemption.h"
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/gen_common/reg_configs_common.h"
|
||||
#include "shared/source/helpers/flat_batch_buffer_helper_hw.h"
|
||||
@@ -18,7 +19,6 @@
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#include "stream_properties.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
Reference in New Issue
Block a user