Skip to content

Commit 130a7ac

Browse files
Delete TypeSelector helper
Change-Id: Iff5fe62d31fa7b07658cfcf81ebd2c12d47e2b3b Signed-off-by: Maciej Dziuban <[email protected]>
1 parent 2f7158e commit 130a7ac

15 files changed

+48
-114
lines changed

runtime/aub_mem_dump/aub_mem_dump.h

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,6 @@ inline void setAddress(CmdServicesMemTraceMemoryCompare &cmd, uint64_t address)
3535
cmd.addressHigh = static_cast<uint32_t>(address >> 32);
3636
}
3737

38-
template <typename TypeTrue, typename TypeFalse, bool is32Bits>
39-
struct TypeSelector {
40-
typedef TypeTrue type;
41-
};
42-
43-
template <typename TypeTrue, typename TypeFalse>
44-
struct TypeSelector<TypeTrue, TypeFalse, false> {
45-
typedef TypeFalse type;
46-
};
47-
4838
union IAPageTableEntry {
4939
struct
5040
{
@@ -264,11 +254,11 @@ struct AubPageTableHelper64 : public AubPageTableHelper<Traits>, PageTableTraits
264254
};
265255

266256
template <typename TraitsIn>
267-
struct AubDump : public TypeSelector<AubPageTableHelper32<TraitsIn>, AubPageTableHelper64<TraitsIn>, TraitsIn::addressingBits == 32>::type {
268-
typedef TraitsIn Traits;
269-
typedef typename TypeSelector<uint32_t, uint64_t, Traits::addressingBits == 32>::type AddressType;
270-
typedef typename TypeSelector<AubPageTableHelper32<Traits>, AubPageTableHelper64<Traits>, Traits::addressingBits == 32>::type BaseHelper;
271-
typedef typename Traits::Stream Stream;
257+
struct AubDump : public std::conditional<TraitsIn::addressingBits == 32, AubPageTableHelper32<TraitsIn>, AubPageTableHelper64<TraitsIn>>::type {
258+
using Traits = TraitsIn;
259+
using AddressType = typename std::conditional<Traits::addressingBits == 32, uint32_t, uint64_t>::type;
260+
using BaseHelper = typename std::conditional<Traits::addressingBits == 32, AubPageTableHelper32<Traits>, AubPageTableHelper64<Traits>>::type;
261+
using Stream = typename Traits::Stream;
272262

273263
typedef union _MiContextDescriptorReg_ {
274264
struct {

runtime/command_stream/aub_command_stream_receiver_hw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
9292
uint32_t aubDeviceId;
9393
bool standalone;
9494

95-
std::unique_ptr<TypeSelector<PML4, PDPE, sizeof(void *) == 8>::type> ppgtt;
95+
std::unique_ptr<std::conditional<is64bit, PML4, PDPE>::type> ppgtt;
9696
std::unique_ptr<PDPE> ggtt;
9797
// remap CPU VA -> GGTT VA
9898
AddressMapper *gttRemap;

runtime/command_stream/aub_command_stream_receiver_hw.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ AUBCommandStreamReceiverHw<GfxFamily>::AUBCommandStreamReceiverHw(const Hardware
4242
auto physicalAddressAllocator = aubCenter->getPhysicalAddressAllocator();
4343
UNRECOVERABLE_IF(nullptr == physicalAddressAllocator);
4444

45-
ppgtt = std::make_unique<TypeSelector<PML4, PDPE, sizeof(void *) == 8>::type>(physicalAddressAllocator);
45+
ppgtt = std::make_unique<std::conditional<is64bit, PML4, PDPE>::type>(physicalAddressAllocator);
4646
ggtt = std::make_unique<PDPE>(physicalAddressAllocator);
4747

4848
gttRemap = aubCenter->getAddressMapper();

runtime/command_stream/tbx_command_stream_receiver_hw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class TbxCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
8080
bool streamInitialized = false;
8181

8282
std::unique_ptr<PhysicalAddressAllocator> physicalAddressAllocator;
83-
std::unique_ptr<TypeSelector<PML4, PDPE, sizeof(void *) == 8>::type> ppgtt;
83+
std::unique_ptr<std::conditional<is64bit, PML4, PDPE>::type> ppgtt;
8484
std::unique_ptr<PDPE> ggtt;
8585
// remap CPU VA -> GGTT VA
8686
AddressMapper gttRemap;

runtime/command_stream/tbx_command_stream_receiver_hw.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ TbxCommandStreamReceiverHw<GfxFamily>::TbxCommandStreamReceiverHw(const Hardware
2828

2929
physicalAddressAllocator.reset(this->createPhysicalAddressAllocator());
3030

31-
ppgtt = std::make_unique<TypeSelector<PML4, PDPE, sizeof(void *) == 8>::type>(physicalAddressAllocator.get());
31+
ppgtt = std::make_unique<std::conditional<is64bit, PML4, PDPE>::type>(physicalAddressAllocator.get());
3232
ggtt = std::make_unique<PDPE>(physicalAddressAllocator.get());
3333

3434
for (auto &engineInfo : engineInfoTable) {

runtime/gen10/aub_mapper.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#pragma once
99
#include "runtime/gen_common/aub_mapper_base.h"
10+
#include "runtime/memory_manager/memory_constants.h"
1011

1112
namespace OCLRT {
1213
struct CNLFamily;
@@ -15,7 +16,7 @@ template <>
1516
struct AUBFamilyMapper<CNLFamily> {
1617
enum { device = AubMemDump::DeviceValues::Cnl };
1718

18-
typedef AubMemDump::Traits<device, GfxAddressBits::value> AubTraits;
19+
using AubTraits = AubMemDump::Traits<device, MemoryConstants::GfxAddressBits>;
1920

2021
static const AubMemDump::LrcaHelper *csTraits[EngineType::NUM_ENGINES];
2122

runtime/gen8/aub_mapper.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#pragma once
99
#include "runtime/gen_common/aub_mapper_base.h"
10+
#include "runtime/memory_manager/memory_constants.h"
1011

1112
namespace OCLRT {
1213
struct BDWFamily;
@@ -15,7 +16,7 @@ template <>
1516
struct AUBFamilyMapper<BDWFamily> {
1617
enum { device = AubMemDump::DeviceValues::Bdw };
1718

18-
typedef AubMemDump::Traits<device, GfxAddressBits::value> AubTraits;
19+
using AubTraits = AubMemDump::Traits<device, MemoryConstants::GfxAddressBits>;
1920

2021
static const AubMemDump::LrcaHelper *csTraits[EngineType::NUM_ENGINES];
2122

runtime/gen9/aub_mapper.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#pragma once
99
#include "runtime/gen_common/aub_mapper_base.h"
10+
#include "runtime/memory_manager/memory_constants.h"
1011

1112
namespace OCLRT {
1213
struct SKLFamily;
@@ -15,7 +16,7 @@ template <>
1516
struct AUBFamilyMapper<SKLFamily> {
1617
enum { device = AubMemDump::DeviceValues::Skl };
1718

18-
typedef AubMemDump::Traits<device, GfxAddressBits::value> AubTraits;
19+
using AubTraits = AubMemDump::Traits<device, MemoryConstants::GfxAddressBits>;
1920

2021
static const AubMemDump::LrcaHelper *csTraits[EngineType::NUM_ENGINES];
2122

runtime/gen_common/aub_mapper_base.h

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,13 @@
11
/*
2-
* Copyright (c) 2017, Intel Corporation
2+
* Copyright (C) 2017-2018 Intel Corporation
33
*
4-
* Permission is hereby granted, free of charge, to any person obtaining a
5-
* copy of this software and associated documentation files (the "Software"),
6-
* to deal in the Software without restriction, including without limitation
7-
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8-
* and/or sell copies of the Software, and to permit persons to whom the
9-
* Software is furnished to do so, subject to the following conditions:
4+
* SPDX-License-Identifier: MIT
105
*
11-
* The above copyright notice and this permission notice shall be included
12-
* in all copies or substantial portions of the Software.
13-
*
14-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15-
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18-
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19-
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20-
* OTHER DEALINGS IN THE SOFTWARE.
216
*/
227

238
#pragma once
249
#include "runtime/aub_mem_dump/aub_mem_dump.h"
2510
#include "runtime/helpers/completion_stamp.h"
26-
#include "runtime/helpers/selectors.h"
2711
#include <vector>
2812

2913
namespace OCLRT {
@@ -34,4 +18,5 @@ struct AUBFamilyMapper {
3418

3519
using MMIOPair = std::pair<uint32_t, uint32_t>;
3620
using MMIOList = std::vector<MMIOPair>;
21+
3722
} // namespace OCLRT

runtime/helpers/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ set(RUNTIME_SRCS_HELPERS_BASE
6565
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/queue_helpers.cpp
6666
${CMAKE_CURRENT_SOURCE_DIR}/queue_helpers.h
6767
${CMAKE_CURRENT_SOURCE_DIR}/sampler_helpers.h
68-
${CMAKE_CURRENT_SOURCE_DIR}/selectors.h
6968
${CMAKE_CURRENT_SOURCE_DIR}/state_base_address.h
7069
${CMAKE_CURRENT_SOURCE_DIR}/state_base_address.inl
7170
${CMAKE_CURRENT_SOURCE_DIR}/stdio.h

0 commit comments

Comments
 (0)