Skip to content

Commit bd4f75d

Browse files
author
Petr Vesely
committed
[UR] fix warnings in collector
1 parent 494233b commit bd4f75d

File tree

3 files changed

+30
-28
lines changed

3 files changed

+30
-28
lines changed

examples/collector/collector.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ static std::unordered_map<
8282
* On begin, it prints the function declaration with the call arguments specified,
8383
* and on end it prints the function name with the result of the call.
8484
*/
85-
XPTI_CALLBACK_API void trace_cb(uint16_t trace_type,
86-
xpti::trace_event_data_t *parent,
87-
xpti::trace_event_data_t *event,
88-
uint64_t instance, const void *user_data) {
85+
XPTI_CALLBACK_API void
86+
trace_cb(uint16_t trace_type, [[maybe_unused]] xpti::trace_event_data_t *parent,
87+
[[maybe_unused]] xpti::trace_event_data_t *event, uint64_t instance,
88+
const void *user_data) {
8989
auto *args = static_cast<const xpti::function_with_args_t *>(user_data);
9090
std::ostringstream out;
9191
if (trace_type == TRACE_FN_BEGIN) {
@@ -120,7 +120,7 @@ XPTI_CALLBACK_API void trace_cb(uint16_t trace_type,
120120
*/
121121
XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version,
122122
unsigned int minor_version,
123-
const char *version_str,
123+
[[maybe_unused]] const char *version_str,
124124
const char *stream_name) {
125125
if (stream_name == nullptr) {
126126
std::cout << "Stream name not provided. Aborting." << std::endl;
@@ -158,5 +158,6 @@ XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version,
158158
*
159159
* Can be used to cleanup state or resources.
160160
*/
161-
XPTI_CALLBACK_API void xptiTraceFinish(const char *stream_name) { /* noop */
161+
XPTI_CALLBACK_API void
162+
xptiTraceFinish([[maybe_unused]] const char *stream_name) { /* noop */
162163
}

source/common/ur_params.hpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -454,18 +454,17 @@ inline std::ostream &operator<<(std::ostream &os,
454454
enum ur_exp_image_copy_flag_t value);
455455
inline std::ostream &
456456
operator<<(std::ostream &os,
457-
const struct ur_exp_sampler_mip_properties_t params);
458-
inline std::ostream &
459-
operator<<(std::ostream &os, const struct ur_exp_sampler_addr_modes_t params);
460-
inline std::ostream &operator<<(std::ostream &os,
461-
const struct ur_exp_interop_mem_desc_t params);
457+
[[maybe_unused]] const struct ur_exp_file_descriptor_t params);
462458
inline std::ostream &
463459
operator<<(std::ostream &os,
464460
[[maybe_unused]] const struct ur_exp_win32_handle_t params);
465461
inline std::ostream &operator<<(
466462
std::ostream &os,
467463
[[maybe_unused]] const struct ur_exp_sampler_mip_properties_t params);
468464
inline std::ostream &
465+
operator<<(std::ostream &os,
466+
[[maybe_unused]] const struct ur_exp_sampler_addr_modes_t params);
467+
inline std::ostream &
469468
operator<<(std::ostream &os,
470469
[[maybe_unused]] const struct ur_exp_interop_mem_desc_t params);
471470
inline std::ostream &operator<<(
@@ -13048,9 +13047,9 @@ inline std::ostream &operator<<(
1304813047
return os;
1304913048
}
1305013049

13051-
inline std::ostream &operator<<(
13052-
std::ostream &os,
13053-
const struct ur_enqueue_cooperative_kernel_launch_exp_params_t *params) {
13050+
inline std::ostream &
13051+
operator<<(std::ostream &os, [[maybe_unused]] const struct
13052+
ur_enqueue_cooperative_kernel_launch_exp_params_t *params) {
1305413053

1305513054
os << ".hQueue = ";
1305613055

@@ -13667,10 +13666,9 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct
1366713666
return os;
1366813667
}
1366913668

13670-
inline std::ostream &operator<<(
13671-
std::ostream &os,
13672-
const struct ur_kernel_suggest_max_cooperative_group_count_exp_params_t
13673-
*params) {
13669+
inline std::ostream &
13670+
operator<<(std::ostream &os, [[maybe_unused]] const struct
13671+
ur_kernel_suggest_max_cooperative_group_count_exp_params_t *params) {
1367413672

1367513673
os << ".hKernel = ";
1367613674

@@ -13684,8 +13682,9 @@ inline std::ostream &operator<<(
1368413682
return os;
1368513683
}
1368613684

13687-
inline std::ostream &operator<<(std::ostream &os,
13688-
const struct ur_loader_init_params_t *params) {
13685+
inline std::ostream &
13686+
operator<<(std::ostream &os,
13687+
[[maybe_unused]] const struct ur_loader_init_params_t *params) {
1368913688

1369013689
os << ".device_flags = ";
1369113690

tools/urtrace/collector.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,12 @@ class JsonWriter : public TraceWriter {
245245
"\"tid\": \"\", \"ts\": \"\"}}");
246246
out.info("]\n}}");
247247
}
248-
void begin(uint64_t id, const char *fname, std::string args) override {}
248+
void begin([[maybe_unused]] uint64_t id, [[maybe_unused]] const char *fname,
249+
[[maybe_unused]] std::string args) override {}
249250

250-
void end(uint64_t id, const char *fname, std::string args, Timepoint tp,
251-
Timepoint start_tp, const ur_result_t *resultp) override {
251+
void end([[maybe_unused]] uint64_t id, const char *fname, std::string args,
252+
Timepoint tp, Timepoint start_tp,
253+
[[maybe_unused]] const ur_result_t *resultp) override {
252254
auto dur = tp - start_tp;
253255
auto ts_us = std::chrono::duration_cast<std::chrono::microseconds>(
254256
tp.time_since_epoch())
@@ -314,10 +316,10 @@ std::optional<fn_context> pop_instance_data(uint64_t instance) {
314316
return data;
315317
}
316318

317-
XPTI_CALLBACK_API void trace_cb(uint16_t trace_type,
318-
xpti::trace_event_data_t *parent,
319-
xpti::trace_event_data_t *event,
320-
uint64_t instance, const void *user_data) {
319+
XPTI_CALLBACK_API void
320+
trace_cb(uint16_t trace_type, [[maybe_unused]] xpti::trace_event_data_t *parent,
321+
[[maybe_unused]] xpti::trace_event_data_t *event, uint64_t instance,
322+
const void *user_data) {
321323
// stop the the clock as the very first thing, only used for TRACE_FN_END
322324
auto time_for_end = Clock::now();
323325
auto *args = static_cast<const xpti::function_with_args_t *>(user_data);
@@ -367,7 +369,7 @@ XPTI_CALLBACK_API void trace_cb(uint16_t trace_type,
367369
*/
368370
XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version,
369371
unsigned int minor_version,
370-
const char *version_str,
372+
[[maybe_unused]] const char *version_str,
371373
const char *stream_name) {
372374
if (stream_name == nullptr) {
373375
out.debug("Found stream with null name. Skipping...");

0 commit comments

Comments
 (0)