|
| 1 | +/* |
| 2 | + * Copyright (C) 2021 Intel Corporation |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: MIT |
| 5 | + * |
| 6 | + */ |
| 7 | + |
| 8 | +#include "shared/source/helpers/hw_helper.h" |
| 9 | +#include "shared/test/common/fixtures/device_fixture.h" |
| 10 | + |
| 11 | +#include "test.h" |
| 12 | + |
| 13 | +using namespace NEO; |
| 14 | + |
| 15 | +using HwHelperDg2AndLaterTest = Test<DeviceFixture>; |
| 16 | + |
| 17 | +HWTEST2_F(HwHelperDg2AndLaterTest, GivenUseL1CacheAsTrueWhenCallSetL1CachePolicyThenL1CachePolicyL1CacheControlIsSetProperly, IsAtLeastXeHpgCore) { |
| 18 | + using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; |
| 19 | + using SURFACE_TYPE = typename RENDER_SURFACE_STATE::SURFACE_TYPE; |
| 20 | + |
| 21 | + auto &helper = reinterpret_cast<HwHelperHw<FamilyType> &>(HwHelperHw<FamilyType>::get()); |
| 22 | + |
| 23 | + RENDER_SURFACE_STATE surfaceState = FamilyType::cmdInitRenderSurfaceState; |
| 24 | + bool useL1Cache = true; |
| 25 | + helper.setL1CachePolicy(useL1Cache, &surfaceState, defaultHwInfo.get()); |
| 26 | + EXPECT_EQ(RENDER_SURFACE_STATE::L1_CACHE_POLICY_WB, surfaceState.getL1CachePolicyL1CacheControl()); |
| 27 | +} |
| 28 | +HWTEST2_F(HwHelperDg2AndLaterTest, GivenUseL1CacheAsFalseWhenCallSetL1CachePolicyThenL1CachePolicyL1CacheControlIsNotSet, IsAtLeastXeHpgCore) { |
| 29 | + using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; |
| 30 | + using SURFACE_TYPE = typename RENDER_SURFACE_STATE::SURFACE_TYPE; |
| 31 | + |
| 32 | + auto &helper = reinterpret_cast<HwHelperHw<FamilyType> &>(HwHelperHw<FamilyType>::get()); |
| 33 | + RENDER_SURFACE_STATE surfaceState = FamilyType::cmdInitRenderSurfaceState; |
| 34 | + bool useL1Cache = false; |
| 35 | + helper.setL1CachePolicy(useL1Cache, &surfaceState, defaultHwInfo.get()); |
| 36 | + EXPECT_NE(RENDER_SURFACE_STATE::L1_CACHE_POLICY_WB, surfaceState.getL1CachePolicyL1CacheControl()); |
| 37 | +} |
0 commit comments