Skip to content

Commit 0116b70

Browse files
IP support update for 2.2.0 release
This update contains: - Warp width detection for G78AE. - Execution engine count detection for Midgard GPUs. - Workaround for kernel interface vs. version mismatch on some devices with Mali-G715 GPUs. - Improved counter naming and counter definitions for many recent CSF GPUs.
1 parent 9af40d2 commit 0116b70

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2709
-895
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
cmake_minimum_required(VERSION 3.13.5)
88

9-
project(hwcpipe VERSION 2.1)
9+
project(hwcpipe VERSION 2.2)
1010

1111
set(CMAKE_CXX_STANDARD 14)
1212
set(CMAKE_CXX_STANDARD_REQUIRED ON)

backend/device/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2021-2022 ARM Limited.
2+
# Copyright (c) 2021-2023 ARM Limited.
33
#
44
# SPDX-License-Identifier: MIT
55
#
@@ -29,6 +29,8 @@ add_library(
2929
src/device/hwcnt/reader.cpp
3030
src/device/hwcnt/sampler/detail/backend.cpp
3131
src/device/hwcnt/sampler/kinstr_prfcnt/block_index_remap.cpp
32+
src/device/hwcnt/sampler/kinstr_prfcnt/enum_info_parser.cpp
33+
src/device/hwcnt/sampler/kinstr_prfcnt/metadata_parser.cpp
3234
src/device/instance.cpp
3335
src/device/num_exec_engines.cpp
3436
)

backend/device/include/device/hwcnt/block_extents.hpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@ class block_extents {
6060

6161
/** Number of block types. */
6262
static const constexpr num_block_types_type num_block_types =
63-
static_cast<num_block_types_type>(block_type::num_block_types);
63+
static_cast<num_block_types_type>(block_type::last) + 1;
6464

65-
using num_blocks_of_type_type = std::array<uint16_t, num_block_types>;
65+
using num_blocks_of_type_type = std::array<uint8_t, num_block_types>;
6666

6767
/**
6868
* Construct block extents.
6969
*
70-
* @param num_blocks_of_type_v[in] Array of number of blocks on per type basis.
71-
* @param counters_per_block[in] Number of counters per block.
72-
* @param values_type[in] Hardware counters values type.
70+
* @param[in] num_blocks_of_type_v Array of number of blocks on per type basis.
71+
* @param[in] counters_per_block Number of counters per block.
72+
* @param[in] values_type Hardware counters values type.
7373
*/
7474
block_extents(num_blocks_of_type_type num_blocks_of_type_v, uint16_t counters_per_block,
7575
sample_values_type values_type)
@@ -86,16 +86,18 @@ class block_extents {
8686

8787
/** @return Number of hardware counters blocks. */
8888
uint8_t num_blocks() const {
89-
return num_blocks_of_type(block_type::fe) //
90-
+ num_blocks_of_type(block_type::tiler) //
91-
+ num_blocks_of_type(block_type::memory) //
92-
+ num_blocks_of_type(block_type::core);
89+
uint8_t result{};
90+
91+
for (const auto num_blocks : num_blocks_of_type_)
92+
result = static_cast<uint8_t>(result + num_blocks);
93+
94+
return result;
9395
}
9496

9597
/**
9698
* Number of blocks of a given type.
9799
*
98-
* @param type[in] Block type.
100+
* @param[in] type Block type.
99101
* @return Number of blocks of type @p type.
100102
*/
101103
uint8_t num_blocks_of_type(block_type type) const { return num_blocks_of_type_[static_cast<size_t>(type)]; }

backend/device/include/device/hwcnt/block_metadata.hpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,18 @@ class reader;
4343

4444
/** Hardware counters block type. */
4545
enum class block_type : uint8_t {
46-
fe, /**< Front End. */
47-
tiler, /**< Tiler. */
48-
memory, /**< Memory System. */
49-
core, /**< Shader Core. */
50-
num_block_types, /**< Sentinel. */
46+
/** Front End. */
47+
fe,
48+
/** Tiler. */
49+
tiler,
50+
/** Memory System. */
51+
memory,
52+
/** Shader Core. */
53+
core,
54+
/** First block type. */
55+
first = fe,
56+
/** Last block type. */
57+
last = core,
5158
};
5259

5360
/**

backend/device/include/device/hwcnt/reader.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,9 @@ class HWCPIPE_DEVICE_API reader {
264264
/**
265265
* Constructor.
266266
*
267-
* @param fd[in] Counters file descriptor.
268-
* @param features_v[in] Reader features.
269-
* @param extents[in] Hardware counters block extents.
267+
* @param[in] fd Counters file descriptor.
268+
* @param[in] features_v Reader features.
269+
* @param[in] extents Hardware counters block extents.
270270
*/
271271
reader(int fd, features features_v, block_extents extents)
272272
: fd_(fd)

backend/device/include/device/hwcnt/sampler/detail/backend.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class reader;
5555
* - @ref configuration to configure which counters to sample for a given
5656
* block type.
5757
*
58-
* Also contains the low level @ref detail::backend interface,
58+
* Also contains the low level @c detail::backend interface,
5959
* which is used for samplers implementation. The interface is implemented
6060
* for each hardware counters ioctl API version.
6161
*/

backend/device/include/device/hwcnt/sampler/manual.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ namespace sampler {
4545
/** Manual hardware counters sampler. */
4646
class manual {
4747
public:
48+
using backend_type = detail::backend;
49+
50+
explicit manual(std::unique_ptr<backend_type> backend = nullptr)
51+
: backend_(std::move(backend)) {}
52+
4853
/**
4954
* Constructor.
5055
*
@@ -66,6 +71,12 @@ class manual {
6671
manual(const instance &inst, std::initializer_list<configuration> lst)
6772
: manual(inst, lst.begin(), lst.size()) {}
6873

74+
/** Default move construct. */
75+
manual(manual &&) = default;
76+
77+
/** Default move assign. */
78+
manual &operator=(manual &&) = default;
79+
6980
/**
7081
* Check if the sampler's back-end was initialized successfully.
7182
*
@@ -159,7 +170,6 @@ class manual {
159170
}
160171

161172
private:
162-
using backend_type = detail::backend;
163173
std::unique_ptr<backend_type> backend_;
164174
};
165175

backend/device/include/device/hwcnt/sampler/periodic.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ namespace sampler {
4545
/** Periodic hardware counters sampler. */
4646
class periodic {
4747
public:
48+
using backend_type = detail::backend;
49+
50+
explicit periodic(std::unique_ptr<backend_type> backend = nullptr)
51+
: backend_(std::move(backend)) {}
52+
4853
/**
4954
* Constructor.
5055
*
@@ -74,6 +79,12 @@ class periodic {
7479
periodic(const instance &inst, uint64_t period_ns, std::initializer_list<const configuration> lst)
7580
: periodic(inst, period_ns, lst.begin(), lst.size()) {}
7681

82+
/** Default move construct. */
83+
periodic(periodic &&) = default;
84+
85+
/** Default move assign. */
86+
periodic &operator=(periodic &&) = default;
87+
7788
/**
7889
* Check if the sampler's back-end was initialized successfully.
7990
*
@@ -146,7 +157,6 @@ class periodic {
146157
}
147158

148159
private:
149-
using backend_type = detail::backend;
150160
std::unique_ptr<backend_type> backend_;
151161
};
152162

backend/device/include/device/product_id.hpp

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,33 @@ class product_id {
8181
/**
8282
* Construct product id from a GPU id.
8383
*
84-
* @param gpu_id[in] GPU id to parse.
84+
* @param[in] raw_product_id Raw unmasked product id.
8585
*/
86-
explicit constexpr product_id(uint64_t gpu_id)
87-
: product_id_(from_gpu_id(gpu_id)) {}
86+
explicit constexpr product_id(uint32_t raw_product_id)
87+
: product_id_(from_raw_product_id(raw_product_id)) {}
8888

8989
/**
9090
* Construct product id using product/arch major versions pair.
9191
*
92-
* @param arch_major[in] Arch major version.
93-
* @param product_major[in] Product major version.
92+
* @param[in] arch_major Arch major version.
93+
* @param[in] product_major Product major version.
9494
*/
9595
explicit constexpr product_id(uint32_t arch_major, uint32_t product_major)
9696
: product_id_(from_versions(arch_major, product_major)) {}
9797

98+
/**
99+
* Construct product id from the raw GPU id value.
100+
*
101+
* @param gpu_id Raw gpu id.
102+
* @return Product id.
103+
*/
104+
static constexpr product_id from_raw_gpu_id(uint64_t gpu_id) {
105+
constexpr uint64_t product_id_shift{16};
106+
constexpr uint64_t product_id_mask{0xFFFF};
107+
108+
return product_id{static_cast<uint32_t>((gpu_id >> product_id_shift) & product_id_mask)};
109+
}
110+
98111
/** @return Version style of the product ID. */
99112
constexpr version_style get_version_style() const { return get_version_style(product_id_); }
100113

@@ -156,40 +169,40 @@ class product_id {
156169
/**
157170
* Get version style of a gpu_id or product_id value.
158171
*
159-
* @param value[in] Value to get the style from.
172+
* @param[in] value Value to get the style from.
160173
* @return Version style of @p value.
161174
*/
162175
constexpr static version_style get_version_style(uint32_t value) {
163176
if (value == product_id_t60x)
164177
return version_style::legacy_t60x;
165-
else if (value < 0x1000)
178+
else if (value < 0x1000U)
166179
return version_style::legacy_txxx;
167180
else
168181
return version_style::arch_product_major;
169182
}
170183

171184
/**
172-
* Get product id from a GPU id.
185+
* Get product id from a raw unmasked value.
173186
*
174-
* @param gpu_id[in] GPU id to parse.
187+
* @param[in] raw_product_id Raw unmasked product id.
175188
* @return Product id value.
176189
*/
177-
static constexpr uint32_t from_gpu_id(uint64_t gpu_id) {
178-
switch (get_version_style(gpu_id)) {
190+
static constexpr uint32_t from_raw_product_id(uint32_t raw_product_id) {
191+
switch (get_version_style(raw_product_id)) {
179192
case version_style::legacy_t60x:
180193
case version_style::legacy_txxx:
181-
return gpu_id & product_id_mask_legacy;
194+
return raw_product_id & product_id_mask_legacy;
182195
case version_style::arch_product_major:
183196
default:
184-
return gpu_id & product_id_mask_modern;
197+
return raw_product_id & product_id_mask_modern;
185198
}
186199
}
187200

188201
/**
189202
* Get product id using product/arch major versions pair.
190203
*
191-
* @param arch_major[in] Arch major version.
192-
* @param product_major[in] Product major version.
204+
* @param[in] arch_major Arch major version.
205+
* @param[in] product_major Product major version.
193206
* @return Product id value.
194207
*/
195208
static constexpr uint32_t from_versions(uint32_t arch_major, uint32_t product_major) {

backend/device/src/device/detail/enum_operators.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* SOFTWARE.
2323
*/
2424

25-
/** @file define_enum_operators.hpp */
25+
/** @file enum_operators.hpp */
2626

2727
#pragma once
2828

0 commit comments

Comments
 (0)