@@ -61,8 +61,8 @@ struct ur_kernel_handle_t_ {
6161 args_t Storage;
6262 // / Aligned size of each parameter, including padding.
6363 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 ;
6666 // / Position in the Storage array where the next argument should added.
6767 size_t InsertPos = 0 ;
6868 // / Aligned size in bytes for each local memory parameter after padding has
@@ -87,20 +87,21 @@ struct ur_kernel_handle_t_ {
8787
8888 arguments () {
8989 // Place the implicit offset index at the end of the indicies collection
90- Indices .emplace_back (&ImplicitOffsetArgs);
90+ ArgPointers .emplace_back (&ImplicitOffsetArgs);
9191 }
9292
9393 // / Add an argument to the kernel.
9494 // / If the argument existed before, it is replaced.
9595 // / Otherwise, it is added.
9696 // / 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.
9899 void addArg (size_t Index, size_t Size, const void *Arg,
99100 size_t LocalSize = 0 ) {
100101 // Expand storage to accommodate this Index if needed.
101- if (Index + 2 > Indices .size ()) {
102+ if (Index + 2 > ArgPointers .size ()) {
102103 // Move implicit offset argument index with the end
103- Indices .resize (Index + 2 , Indices .back ());
104+ ArgPointers .resize (Index + 2 , ArgPointers .back ());
104105 // Ensure enough space for the new argument
105106 ParamSizes.resize (Index + 1 );
106107 AlignedLocalMemSize.resize (Index + 1 );
@@ -111,13 +112,13 @@ struct ur_kernel_handle_t_ {
111112 if (ParamSizes[Index] == 0 ) {
112113 ParamSizes[Index] = Size;
113114 std::memcpy (&Storage[InsertPos], Arg, Size);
114- Indices [Index] = &Storage[InsertPos];
115+ ArgPointers [Index] = &Storage[InsertPos];
115116 AlignedLocalMemSize[Index] = LocalSize;
116117 InsertPos += Size;
117118 }
118119 // Otherwise, update the existing argument.
119120 else {
120- std::memcpy (Indices [Index], Arg, Size);
121+ std::memcpy (ArgPointers [Index], Arg, Size);
121122 AlignedLocalMemSize[Index] = LocalSize;
122123 assert (Size == ParamSizes[Index]);
123124 }
@@ -132,7 +133,7 @@ struct ur_kernel_handle_t_ {
132133 std::pair<size_t , size_t > calcAlignedLocalArgument (size_t Index,
133134 size_t Size) {
134135 // Store the unpadded size of the local argument
135- if (Index + 2 > Indices .size ()) {
136+ if (Index + 2 > ArgPointers .size ()) {
136137 AlignedLocalMemSize.resize (Index + 1 );
137138 OriginalLocalMemSize.resize (Index + 1 );
138139 }
@@ -161,10 +162,11 @@ struct ur_kernel_handle_t_ {
161162 return std::make_pair (AlignedLocalSize, AlignedLocalOffset);
162163 }
163164
164- // Iterate over all existing local argument which follows StartIndex
165+ // Iterate over each existing local argument which follows StartIndex
165166 // index, update the offset and pointer into the kernel local memory.
166167 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
168170 for (auto SuccIndex = StartIndex; SuccIndex < NumArgs; SuccIndex++) {
169171 const size_t OriginalLocalSize = OriginalLocalMemSize[SuccIndex];
170172 if (OriginalLocalSize == 0 ) {
@@ -180,7 +182,7 @@ struct ur_kernel_handle_t_ {
180182 AlignedLocalMemSize[SuccIndex] = SuccAlignedLocalSize;
181183
182184 // Store new offset into local data
183- std::memcpy (Indices [SuccIndex], &SuccAlignedLocalOffset,
185+ std::memcpy (ArgPointers [SuccIndex], &SuccAlignedLocalOffset,
184186 sizeof (size_t ));
185187 }
186188 }
@@ -219,7 +221,7 @@ struct ur_kernel_handle_t_ {
219221 std::memcpy (ImplicitOffsetArgs, ImplicitOffset, Size);
220222 }
221223
222- const args_index_t &getIndices () const noexcept { return Indices ; }
224+ const args_index_t &getArgPointers () const noexcept { return ArgPointers ; }
223225
224226 uint32_t getLocalSize () const {
225227 return std::accumulate (std::begin (AlignedLocalMemSize),
@@ -276,7 +278,7 @@ struct ur_kernel_handle_t_ {
276278 // / offset. Note this only returns the current known number of arguments,
277279 // / not the real one required by the kernel, since this cannot be queried
278280 // / 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 ; }
280282
281283 void setKernelArg (int Index, size_t Size, const void *Arg) {
282284 Args.addArg (Index, Size, Arg);
@@ -290,8 +292,8 @@ struct ur_kernel_handle_t_ {
290292 return Args.setImplicitOffset (Size, ImplicitOffset);
291293 }
292294
293- const arguments::args_index_t &getArgIndices () const {
294- return Args.getIndices ();
295+ const arguments::args_index_t &getArgPointers () const {
296+ return Args.getArgPointers ();
295297 }
296298
297299 uint32_t getLocalSize () const noexcept { return Args.getLocalSize (); }
0 commit comments