Skip to content

Commit d8c1c5b

Browse files
dayatsin-amdsaleelkvamovsik
authored
SWDEV-549717 - CP ROCm-7.0 (#366)
rocr: Increse SDMA queue size to 8MB - When SDMA queue gets full when copying 2GB or more it blocks async copy api - Improve/format logging Co-authored-by: Saleel Kudchadker <Saleel.Kudchadker@amd.com> Co-authored-by: Movsik, Valentin <Valentin.Movsik@amd.com>
1 parent 09f3a2a commit d8c1c5b

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

runtime/hsa-runtime/core/runtime/amd_blit_sdma.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ inline uint32_t ptrhigh32(const void* p) {
7171
#endif
7272
}
7373

74-
const size_t BlitSdmaBase::kQueueSize = 1024 * 1024;
74+
const size_t BlitSdmaBase::kQueueSize = 1024 * 1024 * 8;
7575
const size_t BlitSdmaBase::kCopyPacketSize = sizeof(SDMA_PKT_COPY_LINEAR);
7676
const size_t BlitSdmaBase::kMaxSingleCopySize = SDMA_PKT_COPY_LINEAR::kMaxSize_;
7777
const size_t BlitSdmaBase::kMaxSingleFillSize = SDMA_PKT_CONSTANT_FILL::kMaxSize_;
@@ -198,6 +198,8 @@ hsa_status_t BlitSdma<RingIndexTy, HwIndexMonotonic, SizeToCountOffset, useGCR>:
198198
if (agent_->driver().CreateQueue(agent_->node_id(), kQueueType_, 100, HSA_QUEUE_PRIORITY_MAXIMUM,
199199
rec_eng, queue_start_addr_, kQueueSize, nullptr,
200200
queue_resource_) != HSA_STATUS_SUCCESS) {
201+
LogPrint(HSA_AMD_LOG_FLAG_INFO, "Failed to create queue, size=%d, type=%d,"
202+
" priority=%d, engine_id=%d", kQueueSize, kQueueType_, HSA_QUEUE_PRIORITY_MAXIMUM, rec_eng);
201203
return HSA_STATUS_ERROR_OUT_OF_RESOURCES;
202204
}
203205

@@ -568,7 +570,6 @@ hsa_status_t BlitSdma<RingIndexTy, HwIndexMonotonic, SizeToCountOffset,
568570
const size_t max_copy_size = max_single_linear_copy_size_ ? max_single_linear_copy_size_ :
569571
kMaxSingleCopySize;
570572
const uint32_t num_copy_command = (size + max_copy_size - 1) / max_copy_size;
571-
572573
// Assemble copy packets.
573574
std::vector<SDMA_PKT_COPY_LINEAR> buff(num_copy_command);
574575
BuildCopyCommand(reinterpret_cast<char*>(&buff[0]), num_copy_command, dst, src, size);

runtime/hsa-runtime/core/util/flag.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,24 @@
4949
#include <string>
5050
#include <algorithm>
5151
#include <locale>
52+
#include <iomanip>
5253

5354
namespace rocr {
5455
FILE* log_file = stderr;
5556
uint8_t log_flags[8];
5657

5758
void log_printf(const char* file, int line, const char* format, ...) {
5859
va_list ap;
59-
std::stringstream str_thrd_id;
60-
str_thrd_id << std::hex << std::this_thread::get_id();
60+
std::stringstream pidtid;
61+
pidtid << "[pid:" << os::GetProcessId() << " tid: 0x" ;
62+
pidtid << std::hex << std::setw(5) << std::this_thread::get_id() << "]";
6163
va_start(ap, format);
6264
char message[4096];
6365
vsnprintf(message, sizeof(message), format, ap);
6466
va_end(ap);
65-
fprintf(log_file, ":%-25s:%-4d: %010lld us: [pid:%-5d tid:0x%s] [***rocr***] %s\n",
66-
file, line, os::ReadAccurateClock()/1000ULL, os::GetProcessId(),
67-
str_thrd_id.str().c_str(), message);
67+
fprintf(log_file, ":7:%-25s:%-4d: %010lld us: %s [***rocr***] %s\n",
68+
file, line, os::ReadAccurateClock()/1000ULL,
69+
pidtid.str().c_str(), message);
6870
fflush(log_file);
6971
}
7072

runtime/hsa-runtime/inc/hsa_ext_amd.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3646,8 +3646,12 @@ hsa_status_t hsa_amd_queue_get_info(hsa_queue_t* queue, hsa_queue_info_attribute
36463646
* @brief logging types
36473647
*/
36483648
typedef enum hsa_amd_log_flag_s {
3649-
/* Log AQL packets internally enqueued by HSA for Blit Kernels */
3649+
/* Log AQL packets internally enqueued by HSA for Blit Kernels */
36503650
HSA_AMD_LOG_FLAG_BLIT_KERNEL_PKTS = 0,
3651+
/* Log SDMA packets */
3652+
HSA_AMD_LOG_FLAG_BLIT_SDMA_PKTS = 1,
3653+
/* Log INFO */
3654+
HSA_AMD_LOG_FLAG_INFO = 2,
36513655
} hsa_amd_log_flag_t;
36523656

36533657
/**

0 commit comments

Comments
 (0)