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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
|
/*-------------------------------------------------------------------------
* Vulkan Conformance Tests
* ------------------------
*
* Copyright (c) 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*//*!
* \file
* \brief Build and Device Tests
*//*--------------------------------------------------------------------*/
#include "vktInfoTests.hpp"
#include "vktTestCaseUtil.hpp"
#include "vkPlatform.hpp"
#include "vkApiVersion.hpp"
#include "tcuTestLog.hpp"
#include "tcuFormatUtil.hpp"
#include "tcuCommandLine.hpp"
#include "tcuPlatform.hpp"
#include "deStringUtil.hpp"
#include "vktApiFeatureInfo.hpp"
#include <iomanip>
namespace vkt
{
namespace
{
using tcu::TestLog;
using std::string;
std::string getOsName (int os)
{
switch (os)
{
case DE_OS_VANILLA: return "DE_OS_VANILLA";
case DE_OS_WIN32: return "DE_OS_WIN32";
case DE_OS_UNIX: return "DE_OS_UNIX";
case DE_OS_WINCE: return "DE_OS_WINCE";
case DE_OS_OSX: return "DE_OS_OSX";
case DE_OS_ANDROID: return "DE_OS_ANDROID";
case DE_OS_SYMBIAN: return "DE_OS_SYMBIAN";
case DE_OS_IOS: return "DE_OS_IOS";
default:
return de::toString(os);
}
}
std::string getCompilerName (int compiler)
{
switch (compiler)
{
case DE_COMPILER_VANILLA: return "DE_COMPILER_VANILLA";
case DE_COMPILER_MSC: return "DE_COMPILER_MSC";
case DE_COMPILER_GCC: return "DE_COMPILER_GCC";
case DE_COMPILER_CLANG: return "DE_COMPILER_CLANG";
default:
return de::toString(compiler);
}
}
std::string getCpuName (int cpu)
{
switch (cpu)
{
case DE_CPU_VANILLA: return "DE_CPU_VANILLA";
case DE_CPU_ARM: return "DE_CPU_ARM";
case DE_CPU_X86: return "DE_CPU_X86";
case DE_CPU_X86_64: return "DE_CPU_X86_64";
case DE_CPU_ARM_64: return "DE_CPU_ARM_64";
case DE_CPU_MIPS: return "DE_CPU_MIPS";
case DE_CPU_MIPS_64: return "DE_CPU_MIPS_64";
case DE_CPU_RISCV_32: return "DE_CPU_RISCV_32";
case DE_CPU_RISCV_64: return "DE_CPU_RISCV_64";
default:
return de::toString(cpu);
}
}
std::string getEndiannessName (int endianness)
{
switch (endianness)
{
case DE_BIG_ENDIAN: return "DE_BIG_ENDIAN";
case DE_LITTLE_ENDIAN: return "DE_LITTLE_ENDIAN";
default:
return de::toString(endianness);
}
}
tcu::TestStatus logBuildInfo (Context& context)
{
#if defined(DE_DEBUG)
const bool isDebug = true;
#else
const bool isDebug = false;
#endif
context.getTestContext().getLog()
<< TestLog::Message
<< "DE_OS: " << getOsName(DE_OS) << "\n"
<< "DE_CPU: " << getCpuName(DE_CPU) << "\n"
<< "DE_PTR_SIZE: " << DE_PTR_SIZE << "\n"
<< "DE_ENDIANNESS: " << getEndiannessName(DE_ENDIANNESS) << "\n"
<< "DE_COMPILER: " << getCompilerName(DE_COMPILER) << "\n"
<< "DE_DEBUG: " << (isDebug ? "true" : "false") << "\n"
<< TestLog::EndMessage;
return tcu::TestStatus::pass("Not validated");
}
tcu::TestStatus logDeviceInfo (Context& context)
{
TestLog& log = context.getTestContext().getLog();
const vk::VkPhysicalDeviceProperties& properties = context.getDeviceProperties();
log << TestLog::Message
<< "Using --deqp-vk-device-id="
<< context.getTestContext().getCommandLine().getVKDeviceId()
<< TestLog::EndMessage;
log << TestLog::Message
<< "apiVersion: " << vk::unpackVersion(properties.apiVersion) << "\n"
<< "driverVersion: " << tcu::toHex(properties.driverVersion) << "\n"
<< "deviceName: " << (const char*)properties.deviceName << "\n"
<< "vendorID: " << tcu::toHex(properties.vendorID) << "\n"
<< "deviceID: " << tcu::toHex(properties.deviceID) << "\n"
<< TestLog::EndMessage;
return tcu::TestStatus::pass("Not validated");
}
tcu::TestStatus logPlatformInfo (Context& context)
{
std::ostringstream details;
context.getTestContext().getPlatform().getVulkanPlatform().describePlatform(details);
context.getTestContext().getLog()
<< TestLog::Message
<< details.str()
<< TestLog::EndMessage;
return tcu::TestStatus::pass("Not validated");
}
template<typename SizeType>
struct PrettySize
{
SizeType value;
int precision;
PrettySize (SizeType value_, int precision_)
: value (value_)
, precision (precision_)
{}
};
struct SizeUnit
{
const char* name;
deUint64 value;
};
const SizeUnit* getBestSizeUnit (deUint64 value)
{
static const SizeUnit s_units[] =
{
// \note Must be ordered from largest to smallest
{ "TiB", 1ull<<40ull },
{ "MiB", 1ull<<20ull },
{ "GiB", 1ull<<30ull },
{ "KiB", 1ull<<10ull },
};
static const SizeUnit s_defaultUnit = { "B", 1u };
for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(s_units); ++ndx)
{
if (value >= s_units[ndx].value)
return &s_units[ndx];
}
return &s_defaultUnit;
}
template<typename SizeType>
std::ostream& operator<< (std::ostream& str, const PrettySize<SizeType>& size)
{
const SizeUnit* unit = getBestSizeUnit(deUint64(size.value));
std::ostringstream tmp;
tmp << std::fixed << std::setprecision(size.precision)
<< (double(size.value) / double(unit->value))
<< " " << unit->name;
return str << tmp.str();
}
template<typename SizeType>
PrettySize<SizeType> prettySize (SizeType value, int precision = 2)
{
return PrettySize<SizeType>(value, precision);
}
tcu::TestStatus logPlatformMemoryLimits (Context& context)
{
TestLog& log = context.getTestContext().getLog();
tcu::PlatformMemoryLimits limits;
context.getTestContext().getPlatform().getMemoryLimits(limits);
log << TestLog::Message << "totalSystemMemory = " << prettySize(limits.totalSystemMemory) << " (" << limits.totalSystemMemory << ")\n"
<< "totalDeviceLocalMemory = " << prettySize(limits.totalDeviceLocalMemory) << " (" << limits.totalDeviceLocalMemory << ")\n"
<< "deviceMemoryAllocationGranularity = " << limits.deviceMemoryAllocationGranularity << "\n"
<< "devicePageSize = " << limits.devicePageSize << "\n"
<< "devicePageTableEntrySize = " << limits.devicePageTableEntrySize << "\n"
<< "devicePageTableHierarchyLevels = " << limits.devicePageTableHierarchyLevels << "\n"
<< TestLog::EndMessage;
TCU_CHECK(limits.totalSystemMemory > 0);
TCU_CHECK(limits.deviceMemoryAllocationGranularity > 0);
TCU_CHECK(deIsPowerOfTwo64(limits.devicePageSize));
return tcu::TestStatus::pass("Pass");
}
} // anonymous
void createInfoTests (tcu::TestCaseGroup* testGroup)
{
addFunctionCase(testGroup, "build", "Build Info", logBuildInfo);
addFunctionCase(testGroup, "device", "Device Info", logDeviceInfo);
addFunctionCase(testGroup, "platform", "Platform Info", logPlatformInfo);
addFunctionCase(testGroup, "memory_limits", "Platform Memory Limits", logPlatformMemoryLimits);
api::createFeatureInfoInstanceTests (testGroup);
api::createFeatureInfoDeviceTests (testGroup);
api::createFeatureInfoDeviceGroupTests (testGroup);
}
} // vkt
|