From 32c073c558e9e30d05619904cf429345e5d645fd Mon Sep 17 00:00:00 2001
From: foreman
Date: Tue, 7 Apr 2015 17:27:46 -0400
Subject: [PATCH] P4 to Git Change 1138096 by
skudchad@skudchad_test_win_opencl2 on 2015/04/07 13:46:20
EPR #403782 - IOMMU2/SVM
- Handle case of only one DMA engine available, for example with SVM.
ReviewBoardURL = http://ocltc.amd.com/reviews/r/7284/diff/
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#506 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#142 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#357 edit
---
rocclr/runtime/device/gpu/gpudevice.cpp | 6 ++++++
rocclr/runtime/device/gpu/gpudevice.hpp | 4 ++++
rocclr/runtime/device/gpu/gpuvirtual.cpp | 6 +++++-
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/rocclr/runtime/device/gpu/gpudevice.cpp b/rocclr/runtime/device/gpu/gpudevice.cpp
index 385ebdc229..d23a175cf1 100644
--- a/rocclr/runtime/device/gpu/gpudevice.cpp
+++ b/rocclr/runtime/device/gpu/gpudevice.cpp
@@ -245,6 +245,7 @@ void
Device::Engines::create(uint num, gslEngineDescriptor* desc, uint maxNumComputeRings)
{
numComputeRings_ = 0;
+ numDmaEngines_ = 0;
for (uint i = 0; i < num; ++i) {
desc_[desc[i].id] = desc[i];
@@ -254,6 +255,11 @@ Device::Engines::create(uint num, gslEngineDescriptor* desc, uint maxNumComputeR
desc[i].id <= GSL_ENGINEID_COMPUTE7) {
numComputeRings_++;
}
+
+ if (desc[i].id >= GSL_ENGINEID_DRMDMA0 &&
+ desc[i].id <= GSL_ENGINEID_DRMDMA1) {
+ numDmaEngines_++;
+ }
}
numComputeRings_ = std::min(numComputeRings_, maxNumComputeRings);
diff --git a/rocclr/runtime/device/gpu/gpudevice.hpp b/rocclr/runtime/device/gpu/gpudevice.hpp
index f8d6ebacf8..b95bc3ad76 100644
--- a/rocclr/runtime/device/gpu/gpudevice.hpp
+++ b/rocclr/runtime/device/gpu/gpudevice.hpp
@@ -218,8 +218,12 @@ public:
//! Returns the number of available compute rings
uint numComputeRings() const { return numComputeRings_; }
+ //! Returns the number of available DMA engines
+ uint numDMAEngines() const { return numDmaEngines_; }
+
private:
uint numComputeRings_;
+ uint numDmaEngines_;
gslEngineDescriptor desc_[GSL_ENGINEID_MAX]; //!< Engine descriptor
};
diff --git a/rocclr/runtime/device/gpu/gpuvirtual.cpp b/rocclr/runtime/device/gpu/gpuvirtual.cpp
index 611c7b3b66..e706a42c62 100644
--- a/rocclr/runtime/device/gpu/gpuvirtual.cpp
+++ b/rocclr/runtime/device/gpu/gpuvirtual.cpp
@@ -498,7 +498,11 @@ VirtualGPU::create(
engineMask = dev().engines().getMask((gslEngineID)(dev().isComputeRingIDForced() ?
dev().getforcedComputeEngineID() : (GSL_ENGINEID_COMPUTE0 + idx)));
if (dev().canDMA()) {
- if (index() & 0x1) {
+ // If only 1 DMA engine is available then use that one
+ if (dev().engines().numDMAEngines() < 2) {
+ engineMask |= dev().engines().getMask(GSL_ENGINEID_DRMDMA0);
+ }
+ else if (index() & 0x1) {
engineMask |= dev().engines().getMask(GSL_ENGINEID_DRMDMA0);
}
else {