SWDEV-516303 - Remove SDMA retainer logic to select the engine.

Change-Id: I818129444131825cdb87e06cb495afa3e5cdb683


[ROCm/clr commit: 1f583a6870]
This commit is contained in:
kjayapra-amd
2025-02-07 14:51:33 -05:00
کامیت شده توسط Karthik Jayaprakash
والد a7f3ad7867
کامیت 010253430f
2فایلهای تغییر یافته به همراه2 افزوده شده و 18 حذف شده
@@ -32,8 +32,7 @@ DmaBlitManager::DmaBlitManager(VirtualGPU& gpu, Setup setup)
: HostBlitManager(gpu, setup),
MinSizeForPinnedTransfer(dev().settings().pinnedMinXferSize_),
completeOperation_(false),
context_(nullptr),
sdmaEngineRetainCount_(0) {
context_(nullptr) {
dev().getSdmaRWMasks(&sdmaEngineReadMask_, &sdmaEngineWriteMask_);
}
@@ -489,16 +488,9 @@ inline bool DmaBlitManager::rocrCopyBuffer(address dst, hsa_agent_t& dstAgent,
if ((srcAgent.handle == dev().getCpuAgent().handle) &&
(dstAgent.handle != dev().getCpuAgent().handle)) {
engine = HwQueueEngine::SdmaWrite;
// Track the HtoD copies and increment the count. The last used SDMA engine might be busy
// and using it everytime can cause contention. When the count exceeds the threshold,
// reset it so as to check the engine status and fetch the new mask.
sdmaEngineRetainCount_ = (sdmaEngineRetainCount_ > kRetainCountThreshold)
? 0 : (sdmaEngineRetainCount_ + 1);
} else if ((srcAgent.handle != dev().getCpuAgent().handle) &&
(dstAgent.handle == dev().getCpuAgent().handle)) {
engine = HwQueueEngine::SdmaRead;
// Track the DtoH copies and decrement the count.
sdmaEngineRetainCount_--;
}
if (engine == HwQueueEngine::Unknown && forceSDMA) {
@@ -510,13 +502,7 @@ inline bool DmaBlitManager::rocrCopyBuffer(address dst, hsa_agent_t& dstAgent,
hsa_signal_t active = gpu().Barriers().ActiveSignal(kInitSignalValueOne, gpu().timestamp());
if (!kUseRegularCopyApi && engine != HwQueueEngine::Unknown) {
if (sdmaEngineRetainCount_ > 0) {
// Check if there a recently used SDMA engine for the stream
copyMask = gpu().getLastUsedSdmaEngine();
ClPrint(amd::LOG_DEBUG, amd::LOG_COPY, "Last copy mask 0x%x", copyMask);
copyMask &= (engine == HwQueueEngine::SdmaRead ?
sdmaEngineReadMask_ : sdmaEngineWriteMask_);
}
copyMask = gpu().getLastUsedSdmaEngine();
if (copyMask == 0) {
// Check SDMA engine status
status = hsa_amd_memory_copy_engine_status(dstAgent, srcAgent, &freeEngineMask);
@@ -240,8 +240,6 @@ class DmaBlitManager : public device::HostBlitManager {
const size_t MinSizeForPinnedTransfer;
bool completeOperation_; //!< DMA blit manager must complete operation
amd::Context* context_; //!< A dummy context
mutable int64_t sdmaEngineRetainCount_; //!< Keeps track of memcopies to either get the last
//!< used SDMA engine or fetch the new mask
uint32_t sdmaEngineReadMask_; //!< SDMA Engine Read Mask
uint32_t sdmaEngineWriteMask_; //!< SDMA Engine Write Mask