@@ -304,6 +304,21 @@ uint16_t create_header() {
304
304
return header;
305
305
}
306
306
307
+ std::pair<hsa_status_t , bool >
308
+ isValidMemoryPool (hsa_amd_memory_pool_t MemoryPool) {
309
+ bool AllocAllowed = false ;
310
+ hsa_status_t Err = hsa_amd_memory_pool_get_info (
311
+ MemoryPool, HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_ALLOWED,
312
+ &AllocAllowed);
313
+ if (Err != HSA_STATUS_SUCCESS) {
314
+ DP (" Alloc allowed in memory pool check failed: %s\n " ,
315
+ get_error_string (Err));
316
+ return {Err, false };
317
+ }
318
+
319
+ return {HSA_STATUS_SUCCESS, AllocAllowed};
320
+ }
321
+
307
322
hsa_status_t addKernArgPool (hsa_amd_memory_pool_t MemoryPool, void *Data) {
308
323
std::vector<hsa_amd_memory_pool_t > *Result =
309
324
static_cast <std::vector<hsa_amd_memory_pool_t > *>(Data);
@@ -347,21 +362,6 @@ hsa_status_t addKernArgPool(hsa_amd_memory_pool_t MemoryPool, void *Data) {
347
362
return HSA_STATUS_SUCCESS;
348
363
}
349
364
350
- std::pair<hsa_status_t , bool >
351
- isValidMemoryPool (hsa_amd_memory_pool_t MemoryPool) {
352
- bool AllocAllowed = false ;
353
- hsa_status_t Err = hsa_amd_memory_pool_get_info (
354
- MemoryPool, HSA_AMD_MEMORY_POOL_INFO_RUNTIME_ALLOC_ALLOWED,
355
- &AllocAllowed);
356
- if (Err != HSA_STATUS_SUCCESS) {
357
- DP (" Alloc allowed in memory pool check failed: %s\n " ,
358
- get_error_string (Err));
359
- return {Err, false };
360
- }
361
-
362
- return {HSA_STATUS_SUCCESS, AllocAllowed};
363
- }
364
-
365
365
template <typename AccumulatorFunc>
366
366
hsa_status_t collectMemoryPools (const std::vector<hsa_agent_t > &Agents,
367
367
AccumulatorFunc Func) {
0 commit comments