forked from GPUOpen-Tools/gpu_performance_api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CounterGeneratorGLTests.cpp
126 lines (109 loc) · 4.68 KB
/
CounterGeneratorGLTests.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
//==============================================================================
// Copyright (c) 2012-2016 Advanced Micro Devices, Inc. All rights reserved.
/// \author AMD Developer Tools Team
/// \file
/// \brief Unit Tests for GL Counter Generator
//==============================================================================
#include "CounterGeneratorTests.h"
#include "GPUPerfAPITypes.h"
#include "GPAInternalCounter.h"
#include "counters/PublicCountersGLGfx6.h"
#include "counters/PublicCountersGLGfx7.h"
#include "counters/PublicCountersGLGfx8.h"
#include "counters/PublicCountersGLGfx9.h"
#ifdef AMDT_INTERNAL
#include "InternalCountersGLGfx6.h"
#include "InternalCountersGLGfx7.h"
#include "InternalCountersGLGfx8.h"
#include "InternalCountersGLGfx9.h"
#endif
static void GetExpectedCountersForGeneration(GPA_Hw_Generation gen, std::vector<const char*>& counterNames)
{
counterNames.clear();
const GPACounterDesc* pPublicCounters = nullptr;
size_t publicCounterCount = 0;
GPA_CounterGroupDesc* pHardwareGroups = nullptr;
GPA_HardwareCounterDesc** ppHardwareCounters = nullptr;
unsigned int hwGroupCount = 0;
switch (gen)
{
case GPA_HW_GENERATION_NVIDIA:
break;
case GPA_HW_GENERATION_GFX6:
pPublicCounters = GLGFX6_PUBLIC_COUNTERS;
publicCounterCount = GLGFX6_PUBLIC_COUNTER_COUNT;
#ifdef AMDT_INTERNAL
pHardwareGroups = HWGLGroupsGfx6;
hwGroupCount = HWGLGroupCountGfx6;
ppHardwareCounters = GLCounterGroupArrayGfx6;
#endif
break;
case GPA_HW_GENERATION_GFX7:
pPublicCounters = GLGFX7_PUBLIC_COUNTERS;
publicCounterCount = GLGFX7_PUBLIC_COUNTER_COUNT;
#ifdef AMDT_INTERNAL
pHardwareGroups = HWGLGroupsGfx7;
hwGroupCount = HWGLGroupCountGfx7;
ppHardwareCounters = GLCounterGroupArrayGfx7;
#endif
break;
case GPA_HW_GENERATION_GFX8:
pPublicCounters = GLGFX8_PUBLIC_COUNTERS;
publicCounterCount = GLGFX8_PUBLIC_COUNTER_COUNT;
#ifdef AMDT_INTERNAL
pHardwareGroups = HWGLGroupsGfx8;
hwGroupCount = HWGLGroupCountGfx8;
ppHardwareCounters = GLCounterGroupArrayGfx8;
#endif
break;
case GPA_HW_GENERATION_GFX9:
pPublicCounters = GLGFX9_PUBLIC_COUNTERS;
publicCounterCount = GLGFX9_PUBLIC_COUNTER_COUNT;
#ifdef AMDT_INTERNAL
pHardwareGroups = HWGLGroupsGfx9;
hwGroupCount = HWGLGroupCountGfx9;
ppHardwareCounters = GLCounterGroupArrayGfx9;
#endif
break;
}
for (size_t i = 0; i < publicCounterCount; i++)
{
counterNames.push_back(pPublicCounters[i].m_pName);
}
for (unsigned int i = 0; i < hwGroupCount; i++)
{
for (unsigned int j = 0; j < pHardwareGroups[i].m_numCounters; j++)
{
counterNames.push_back(ppHardwareCounters[i][j].m_pName);
}
}
}
// Test the OpenGL counter names on all supported hardware
TEST(CounterDLLTests, OpenGLCounterNames)
{
VerifyHardwareNotSupported(GPA_API_OPENGL, gDevIdUnknown, FALSE);
std::vector<const char*> counterNames;
GetExpectedCountersForGeneration(GPA_HW_GENERATION_GFX6, counterNames);
VerifyCounterNames(GPA_API_OPENGL, gDevIdSI, FALSE, counterNames);
GetExpectedCountersForGeneration(GPA_HW_GENERATION_GFX7, counterNames);
VerifyCounterNames(GPA_API_OPENGL, gDevIdCI, FALSE, counterNames);
GetExpectedCountersForGeneration(GPA_HW_GENERATION_GFX8, counterNames);
VerifyCounterNames(GPA_API_OPENGL, gDevIdVI, FALSE, counterNames);
GetExpectedCountersForGeneration(GPA_HW_GENERATION_GFX9, counterNames);
VerifyCounterNames(GPA_API_OPENGL, gDevIdGfx9, FALSE, counterNames);
}
// Test the OpenGL counter names on all generations
TEST(CounterDLLTests, OpenGLCounterNamesByGeneration)
{
VerifyHardwareNotSupported(GPA_API_OPENGL, GPA_HW_GENERATION_NVIDIA, FALSE);
VerifyHardwareNotSupported(GPA_API_OPENGL, GPA_HW_GENERATION_INTEL, FALSE);
std::vector<const char*> counterNames;
GetExpectedCountersForGeneration(GPA_HW_GENERATION_GFX6, counterNames);
VerifyCounterNames(GPA_API_OPENGL, GPA_HW_GENERATION_GFX6, FALSE, counterNames);
GetExpectedCountersForGeneration(GPA_HW_GENERATION_GFX7, counterNames);
VerifyCounterNames(GPA_API_OPENGL, GPA_HW_GENERATION_GFX7, FALSE, counterNames);
GetExpectedCountersForGeneration(GPA_HW_GENERATION_GFX8, counterNames);
VerifyCounterNames(GPA_API_OPENGL, GPA_HW_GENERATION_GFX8, FALSE, counterNames);
GetExpectedCountersForGeneration(GPA_HW_GENERATION_GFX9, counterNames);
VerifyCounterNames(GPA_API_OPENGL, GPA_HW_GENERATION_GFX9, FALSE, counterNames);
}