@@ -61,8 +61,8 @@ struct ur_kernel_handle_t_ {
61
61
args_t Storage;
62
62
// / Aligned size of each parameter, including padding.
63
63
args_size_t ParamSizes;
64
- // / Byte offset into /p Storage allocation for each parameter .
65
- args_index_t Indices ;
64
+ // / Byte offset into /p Storage allocation for each argument .
65
+ args_index_t ArgPointers ;
66
66
// / Position in the Storage array where the next argument should added.
67
67
size_t InsertPos = 0 ;
68
68
// / Aligned size in bytes for each local memory parameter after padding has
@@ -87,20 +87,21 @@ struct ur_kernel_handle_t_ {
87
87
88
88
arguments () {
89
89
// Place the implicit offset index at the end of the indicies collection
90
- Indices .emplace_back (&ImplicitOffsetArgs);
90
+ ArgPointers .emplace_back (&ImplicitOffsetArgs);
91
91
}
92
92
93
93
// / Add an argument to the kernel.
94
94
// / If the argument existed before, it is replaced.
95
95
// / Otherwise, it is added.
96
96
// / Gaps are filled with empty arguments.
97
- // / Implicit offset argument is kept at the back of the indices collection.
97
+ // / Implicit offset argument is kept at the back of the ArgPointers
98
+ // / collection.
98
99
void addArg (size_t Index, size_t Size, const void *Arg,
99
100
size_t LocalSize = 0 ) {
100
101
// Expand storage to accommodate this Index if needed.
101
- if (Index + 2 > Indices .size ()) {
102
+ if (Index + 2 > ArgPointers .size ()) {
102
103
// Move implicit offset argument index with the end
103
- Indices .resize (Index + 2 , Indices .back ());
104
+ ArgPointers .resize (Index + 2 , ArgPointers .back ());
104
105
// Ensure enough space for the new argument
105
106
ParamSizes.resize (Index + 1 );
106
107
AlignedLocalMemSize.resize (Index + 1 );
@@ -111,13 +112,13 @@ struct ur_kernel_handle_t_ {
111
112
if (ParamSizes[Index] == 0 ) {
112
113
ParamSizes[Index] = Size;
113
114
std::memcpy (&Storage[InsertPos], Arg, Size);
114
- Indices [Index] = &Storage[InsertPos];
115
+ ArgPointers [Index] = &Storage[InsertPos];
115
116
AlignedLocalMemSize[Index] = LocalSize;
116
117
InsertPos += Size;
117
118
}
118
119
// Otherwise, update the existing argument.
119
120
else {
120
- std::memcpy (Indices [Index], Arg, Size);
121
+ std::memcpy (ArgPointers [Index], Arg, Size);
121
122
AlignedLocalMemSize[Index] = LocalSize;
122
123
assert (Size == ParamSizes[Index]);
123
124
}
@@ -132,7 +133,7 @@ struct ur_kernel_handle_t_ {
132
133
std::pair<size_t , size_t > calcAlignedLocalArgument (size_t Index,
133
134
size_t Size) {
134
135
// Store the unpadded size of the local argument
135
- if (Index + 2 > Indices .size ()) {
136
+ if (Index + 2 > ArgPointers .size ()) {
136
137
AlignedLocalMemSize.resize (Index + 1 );
137
138
OriginalLocalMemSize.resize (Index + 1 );
138
139
}
@@ -161,10 +162,11 @@ struct ur_kernel_handle_t_ {
161
162
return std::make_pair (AlignedLocalSize, AlignedLocalOffset);
162
163
}
163
164
164
- // Iterate over all existing local argument which follows StartIndex
165
+ // Iterate over each existing local argument which follows StartIndex
165
166
// index, update the offset and pointer into the kernel local memory.
166
167
void updateLocalArgOffset (size_t StartIndex) {
167
- const size_t NumArgs = Indices.size () - 1 ; // Accounts for implicit arg
168
+ const size_t NumArgs =
169
+ ArgPointers.size () - 1 ; // Accounts for implicit arg
168
170
for (auto SuccIndex = StartIndex; SuccIndex < NumArgs; SuccIndex++) {
169
171
const size_t OriginalLocalSize = OriginalLocalMemSize[SuccIndex];
170
172
if (OriginalLocalSize == 0 ) {
@@ -180,7 +182,7 @@ struct ur_kernel_handle_t_ {
180
182
AlignedLocalMemSize[SuccIndex] = SuccAlignedLocalSize;
181
183
182
184
// Store new offset into local data
183
- std::memcpy (Indices [SuccIndex], &SuccAlignedLocalOffset,
185
+ std::memcpy (ArgPointers [SuccIndex], &SuccAlignedLocalOffset,
184
186
sizeof (size_t ));
185
187
}
186
188
}
@@ -219,7 +221,7 @@ struct ur_kernel_handle_t_ {
219
221
std::memcpy (ImplicitOffsetArgs, ImplicitOffset, Size);
220
222
}
221
223
222
- const args_index_t &getIndices () const noexcept { return Indices ; }
224
+ const args_index_t &getArgPointers () const noexcept { return ArgPointers ; }
223
225
224
226
uint32_t getLocalSize () const {
225
227
return std::accumulate (std::begin (AlignedLocalMemSize),
@@ -276,7 +278,7 @@ struct ur_kernel_handle_t_ {
276
278
// / offset. Note this only returns the current known number of arguments,
277
279
// / not the real one required by the kernel, since this cannot be queried
278
280
// / from the HIP Driver API
279
- uint32_t getNumArgs () const noexcept { return Args.Indices .size () - 1 ; }
281
+ uint32_t getNumArgs () const noexcept { return Args.ArgPointers .size () - 1 ; }
280
282
281
283
void setKernelArg (int Index, size_t Size, const void *Arg) {
282
284
Args.addArg (Index, Size, Arg);
@@ -290,8 +292,8 @@ struct ur_kernel_handle_t_ {
290
292
return Args.setImplicitOffset (Size, ImplicitOffset);
291
293
}
292
294
293
- const arguments::args_index_t &getArgIndices () const {
294
- return Args.getIndices ();
295
+ const arguments::args_index_t &getArgPointers () const {
296
+ return Args.getArgPointers ();
295
297
}
296
298
297
299
uint32_t getLocalSize () const noexcept { return Args.getLocalSize (); }
0 commit comments