@@ -99,7 +99,7 @@ namespace hsa_utils {
99
99
// / Iterate elements using an HSA iterate function. Do not use this function
100
100
// / directly but the specialized ones below instead.
101
101
template <typename ElemTy, typename IterFuncTy, typename CallbackTy>
102
- hsa_status_t iterate(IterFuncTy Func, CallbackTy Cb) {
102
+ static hsa_status_t iterate(IterFuncTy Func, CallbackTy Cb) {
103
103
auto L = [](ElemTy Elem, void *Data) -> hsa_status_t {
104
104
CallbackTy *Unwrapped = static_cast <CallbackTy *>(Data);
105
105
return (*Unwrapped)(Elem);
@@ -111,7 +111,8 @@ hsa_status_t iterate(IterFuncTy Func, CallbackTy Cb) {
111
111
// / use this function directly but the specialized ones below instead.
112
112
template <typename ElemTy, typename IterFuncTy, typename IterFuncArgTy,
113
113
typename CallbackTy>
114
- hsa_status_t iterate(IterFuncTy Func, IterFuncArgTy FuncArg, CallbackTy Cb) {
114
+ static hsa_status_t iterate(IterFuncTy Func, IterFuncArgTy FuncArg,
115
+ CallbackTy Cb) {
115
116
auto L = [](ElemTy Elem, void *Data) -> hsa_status_t {
116
117
CallbackTy *Unwrapped = static_cast <CallbackTy *>(Data);
117
118
return (*Unwrapped)(Elem);
@@ -123,7 +124,8 @@ hsa_status_t iterate(IterFuncTy Func, IterFuncArgTy FuncArg, CallbackTy Cb) {
123
124
// / use this function directly but the specialized ones below instead.
124
125
template <typename Elem1Ty, typename Elem2Ty, typename IterFuncTy,
125
126
typename IterFuncArgTy, typename CallbackTy>
126
- hsa_status_t iterate(IterFuncTy Func, IterFuncArgTy FuncArg, CallbackTy Cb) {
127
+ static hsa_status_t iterate(IterFuncTy Func, IterFuncArgTy FuncArg,
128
+ CallbackTy Cb) {
127
129
auto L = [](Elem1Ty Elem1, Elem2Ty Elem2, void *Data) -> hsa_status_t {
128
130
CallbackTy *Unwrapped = static_cast <CallbackTy *>(Data);
129
131
return (*Unwrapped)(Elem1, Elem2);
@@ -132,21 +134,21 @@ hsa_status_t iterate(IterFuncTy Func, IterFuncArgTy FuncArg, CallbackTy Cb) {
132
134
}
133
135
134
136
// / Iterate agents.
135
- template <typename CallbackTy> Error iterateAgents (CallbackTy Callback) {
137
+ template <typename CallbackTy> static Error iterateAgents (CallbackTy Callback) {
136
138
hsa_status_t Status = iterate<hsa_agent_t >(hsa_iterate_agents, Callback);
137
139
return Plugin::check (Status, " error in hsa_iterate_agents: %s" );
138
140
}
139
141
140
142
// / Iterate ISAs of an agent.
141
143
template <typename CallbackTy>
142
- Error iterateAgentISAs (hsa_agent_t Agent, CallbackTy Cb) {
144
+ static Error iterateAgentISAs (hsa_agent_t Agent, CallbackTy Cb) {
143
145
hsa_status_t Status = iterate<hsa_isa_t >(hsa_agent_iterate_isas, Agent, Cb);
144
146
return Plugin::check (Status, " error in hsa_agent_iterate_isas: %s" );
145
147
}
146
148
147
149
// / Iterate memory pools of an agent.
148
150
template <typename CallbackTy>
149
- Error iterateAgentMemoryPools (hsa_agent_t Agent, CallbackTy Cb) {
151
+ static Error iterateAgentMemoryPools (hsa_agent_t Agent, CallbackTy Cb) {
150
152
hsa_status_t Status = iterate<hsa_amd_memory_pool_t >(
151
153
hsa_amd_agent_iterate_memory_pools, Agent, Cb);
152
154
return Plugin::check (Status,
@@ -155,10 +157,12 @@ Error iterateAgentMemoryPools(hsa_agent_t Agent, CallbackTy Cb) {
155
157
156
158
// / Dispatches an asynchronous memory copy.
157
159
// / Enables different SDMA engines for the dispatch in a round-robin fashion.
158
- Error asyncMemCopy (bool UseMultipleSdmaEngines, void *Dst, hsa_agent_t DstAgent,
159
- const void *Src, hsa_agent_t SrcAgent, size_t Size,
160
- uint32_t NumDepSignals, const hsa_signal_t *DepSignals,
161
- hsa_signal_t CompletionSignal) {
160
+ static Error asyncMemCopy (bool UseMultipleSdmaEngines, void *Dst,
161
+ hsa_agent_t DstAgent, const void *Src,
162
+ hsa_agent_t SrcAgent, size_t Size,
163
+ uint32_t NumDepSignals,
164
+ const hsa_signal_t *DepSignals,
165
+ hsa_signal_t CompletionSignal) {
162
166
if (!UseMultipleSdmaEngines) {
163
167
hsa_status_t S =
164
168
hsa_amd_memory_async_copy (Dst, DstAgent, Src, SrcAgent, Size,
@@ -193,8 +197,8 @@ Error asyncMemCopy(bool UseMultipleSdmaEngines, void *Dst, hsa_agent_t DstAgent,
193
197
#endif
194
198
}
195
199
196
- Error getTargetTripleAndFeatures (hsa_agent_t Agent,
197
- SmallVector<SmallString<32 >> &Targets) {
200
+ static Error getTargetTripleAndFeatures (hsa_agent_t Agent,
201
+ SmallVector<SmallString<32 >> &Targets) {
198
202
auto Err = hsa_utils::iterateAgentISAs (Agent, [&](hsa_isa_t ISA) {
199
203
uint32_t Length;
200
204
hsa_status_t Status;
@@ -1222,7 +1226,7 @@ struct AMDGPUStreamTy {
1222
1226
assert (Args->Dst && " Invalid destination buffer" );
1223
1227
assert (Args->Src && " Invalid source buffer" );
1224
1228
1225
- auto BasePtr = Args->Dst ;
1229
+ auto * BasePtr = Args->Dst ;
1226
1230
for (size_t I = 0 ; I < Args->NumTimes ; I++) {
1227
1231
std::memcpy (BasePtr, Args->Src , Args->Size );
1228
1232
BasePtr = reinterpret_cast <uint8_t *>(BasePtr) + Args->Size ;
@@ -2673,11 +2677,10 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
2673
2677
// hsa_amd_memory_fill doesn't signal completion using a signal, so use
2674
2678
// the existing host callback logic to handle that instead
2675
2679
return Stream->pushHostCallback (Fill, Args);
2676
- } else {
2677
- // If there is no pending work, do the fill synchronously
2678
- auto Status = hsa_amd_memory_fill (TgtPtr, Pattern, Size / 4 );
2679
- return Plugin::check (Status, " error in hsa_amd_memory_fill: %s\n " );
2680
2680
}
2681
+ // If there is no pending work, do the fill synchronously
2682
+ auto Status = hsa_amd_memory_fill (TgtPtr, Pattern, Size / 4 );
2683
+ return Plugin::check (Status, " error in hsa_amd_memory_fill: %s\n " );
2681
2684
}
2682
2685
2683
2686
// Slow case; allocate an appropriate memory size and enqueue copies
@@ -2759,7 +2762,7 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
2759
2762
}
2760
2763
2761
2764
Expected<bool > hasPendingWorkImpl (AsyncInfoWrapperTy &AsyncInfo) override {
2762
- auto Stream = AsyncInfo.getQueueAs <AMDGPUStreamTy *>();
2765
+ auto * Stream = AsyncInfo.getQueueAs <AMDGPUStreamTy *>();
2763
2766
if (!Stream)
2764
2767
return false ;
2765
2768
@@ -2772,7 +2775,7 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
2772
2775
Expected<bool > isEventCompleteImpl (void *EventPtr,
2773
2776
AsyncInfoWrapperTy &AsyncInfo) override {
2774
2777
AMDGPUEventTy *Event = reinterpret_cast <AMDGPUEventTy *>(EventPtr);
2775
- auto Stream = AsyncInfo.getQueueAs <AMDGPUStreamTy *>();
2778
+ auto * Stream = AsyncInfo.getQueueAs <AMDGPUStreamTy *>();
2776
2779
return Stream && Stream->isEventComplete (*Event);
2777
2780
}
2778
2781
@@ -2829,7 +2832,7 @@ struct AMDGPUDeviceTy : public GenericDeviceTy, AMDGenericDeviceTy {
2829
2832
hsa_device_type_t DevType;
2830
2833
Status = getDeviceAttrRaw (HSA_AGENT_INFO_DEVICE, DevType);
2831
2834
if (Status == HSA_STATUS_SUCCESS) {
2832
- switch (DevType) {
2835
+ switch (static_cast < int >( DevType) ) {
2833
2836
case HSA_DEVICE_TYPE_CPU:
2834
2837
TmpCharPtr = " CPU" ;
2835
2838
break ;
@@ -3746,8 +3749,8 @@ Error AMDGPUKernelTy::printLaunchInfoDetails(GenericDeviceTy &GenericDevice,
3746
3749
return Plugin::success ();
3747
3750
3748
3751
// General Info
3749
- auto NumGroups = NumBlocks;
3750
- auto ThreadsPerGroup = NumThreads;
3752
+ auto * NumGroups = NumBlocks;
3753
+ auto * ThreadsPerGroup = NumThreads;
3751
3754
3752
3755
// Kernel Arguments Info
3753
3756
auto ArgNum = KernelArgs.NumArgs ;
0 commit comments