Skip to content

Commit dd70c33

Browse files
[NFC][L0] Prefer C++ "using" over C-style typedef (#7039)
1 parent 10d9784 commit dd70c33

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ _pi_queue::resetCommandList(pi_command_list_ptr_t CommandList,
10431043
}
10441044

10451045
// Configuration of the command-list batching.
1046-
typedef struct CommandListBatchConfig {
1046+
struct zeCommandListBatchConfig {
10471047
// Default value of 0. This specifies to use dynamic batch size adjustment.
10481048
// Other values will try to collect specified amount of commands.
10491049
pi_uint32 Size{0};
@@ -1066,7 +1066,7 @@ typedef struct CommandListBatchConfig {
10661066
pi_uint32 startSize() const { return Size > 0 ? Size : DynamicSizeStart; }
10671067
// Tells is we are doing dynamic batch size adjustment.
10681068
bool dynamic() const { return Size == 0; }
1069-
} zeCommandListBatchConfig;
1069+
};
10701070

10711071
// Helper function to initialize static variables that holds batch config info
10721072
// for compute and copy command batching.

sycl/plugins/level_zero/pi_level_zero.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ template <class T> struct ZeCache : private T {
254254
// it is going to initialize, since it is private here in
255255
// order to disallow access other than through "->".
256256
//
257-
typedef std::function<void(T &)> InitFunctionType;
257+
using InitFunctionType = std::function<void(T &)>;
258258
InitFunctionType Compute{nullptr};
259259
bool Computed{false};
260260
pi_mutex ZeCacheMutex;
@@ -492,12 +492,12 @@ struct _pi_device : _pi_object {
492492
// The helper structure that keeps info about a command queue groups of the
493493
// device. It is not changed after it is initialized.
494494
struct queue_group_info_t {
495-
typedef enum {
495+
enum type {
496496
MainCopy,
497497
LinkCopy,
498498
Compute,
499499
Size // must be last
500-
} type;
500+
};
501501

502502
// Keep the ordinal of the commands group as returned by
503503
// zeDeviceGetCommandQueueGroupProperties. A value of "-1" means that
@@ -614,10 +614,10 @@ struct pi_command_list_info_t {
614614
};
615615

616616
// The map type that would track all command-lists in a queue.
617-
typedef std::unordered_map<ze_command_list_handle_t, pi_command_list_info_t>
618-
pi_command_list_map_t;
617+
using pi_command_list_map_t =
618+
std::unordered_map<ze_command_list_handle_t, pi_command_list_info_t>;
619619
// The iterator pointing to a specific command-list in use.
620-
typedef pi_command_list_map_t::iterator pi_command_list_ptr_t;
620+
using pi_command_list_ptr_t = pi_command_list_map_t::iterator;
621621

622622
struct _pi_context : _pi_object {
623623
_pi_context(ze_context_handle_t ZeContext, pi_uint32 NumDevices,
@@ -936,7 +936,7 @@ struct _pi_queue : _pi_object {
936936
pi_command_list_map_t CommandListMap;
937937

938938
// Helper data structure to hold all variables related to batching
939-
typedef struct CommandBatch {
939+
struct command_batch {
940940
// These two members are used to keep track of how often the
941941
// batching closes and executes a command list before reaching the
942942
// QueueComputeBatchSize limit, versus how often we reach the limit.
@@ -954,7 +954,7 @@ struct _pi_queue : _pi_object {
954954
// a queue specific basis. And by putting it in the queue itself, this
955955
// is thread safe because of the locking of the queue that occurs.
956956
pi_uint32 QueueBatchSize = {0};
957-
} command_batch;
957+
};
958958

959959
// ComputeCommandBatch holds data related to batching of non-copy commands.
960960
// CopyCommandBatch holds data related to batching of copy commands.

0 commit comments

Comments
 (0)