Skip to content

Commit 2eb60e2

Browse files
jdoerfertjhuber6
andauthored
[Offload][NFCI] Initialize the KernelArgsTy to default values (#95117)
Co-authored-by: Joseph Huber <[email protected]>
1 parent 37e9bf9 commit 2eb60e2

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

offload/include/Shared/APITypes.h

+17-13
Original file line numberDiff line numberDiff line change
@@ -89,22 +89,26 @@ struct __tgt_async_info {
8989

9090
/// This struct contains all of the arguments to a target kernel region launch.
9191
struct KernelArgsTy {
92-
uint32_t Version; // Version of this struct for ABI compatibility.
93-
uint32_t NumArgs; // Number of arguments in each input pointer.
94-
void **ArgBasePtrs; // Base pointer of each argument (e.g. a struct).
95-
void **ArgPtrs; // Pointer to the argument data.
96-
int64_t *ArgSizes; // Size of the argument data in bytes.
97-
int64_t *ArgTypes; // Type of the data (e.g. to / from).
98-
void **ArgNames; // Name of the data for debugging, possibly null.
99-
void **ArgMappers; // User-defined mappers, possibly null.
100-
uint64_t Tripcount; // Tripcount for the teams / distribute loop, 0 otherwise.
92+
uint32_t Version = 0; // Version of this struct for ABI compatibility.
93+
uint32_t NumArgs = 0; // Number of arguments in each input pointer.
94+
void **ArgBasePtrs =
95+
nullptr; // Base pointer of each argument (e.g. a struct).
96+
void **ArgPtrs = nullptr; // Pointer to the argument data.
97+
int64_t *ArgSizes = nullptr; // Size of the argument data in bytes.
98+
int64_t *ArgTypes = nullptr; // Type of the data (e.g. to / from).
99+
void **ArgNames = nullptr; // Name of the data for debugging, possibly null.
100+
void **ArgMappers = nullptr; // User-defined mappers, possibly null.
101+
uint64_t Tripcount =
102+
0; // Tripcount for the teams / distribute loop, 0 otherwise.
101103
struct {
102104
uint64_t NoWait : 1; // Was this kernel spawned with a `nowait` clause.
103105
uint64_t Unused : 63;
104-
} Flags;
105-
uint32_t NumTeams[3]; // The number of teams (for x,y,z dimension).
106-
uint32_t ThreadLimit[3]; // The number of threads (for x,y,z dimension).
107-
uint32_t DynCGroupMem; // Amount of dynamic cgroup memory requested.
106+
} Flags = {0, 0};
107+
// The number of teams (for x,y,z dimension).
108+
uint32_t NumTeams[3] = {0, 0, 0};
109+
// The number of threads (for x,y,z dimension).
110+
uint32_t ThreadLimit[3] = {0, 0, 0};
111+
uint32_t DynCGroupMem = 0; // Amount of dynamic cgroup memory requested.
108112
};
109113
static_assert(sizeof(KernelArgsTy().Flags) == sizeof(uint64_t),
110114
"Invalid struct size");

0 commit comments

Comments
 (0)