From ed9c54e4930acb2a20d6a2eae902b3678a8181ee Mon Sep 17 00:00:00 2001 From: foreman Date: Wed, 2 Mar 2016 12:18:01 -0500 Subject: [PATCH] P4 to Git Change 1242741 by jatang@jatang-opencl-hsa-stg1 on 2016/03/02 12:04:38 SWDEV-86378 - Workaround sDMA L2T page fault issue. sDMA L2T has a bug that could have the engine access one page ahead of the starting address of the L2T linear address. Workaround it by using kernel bliting instead for conditions that could run into the bug. Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp#161 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDevice.h#59 edit [ROCm/clr commit: b646548235a4ad136318633aa8696683cee75444] --- .../device/gpu/gslbe/src/rt/GSLDevice.cpp | 36 +++++++++++-------- .../device/gpu/gslbe/src/rt/GSLDevice.h | 1 + 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp b/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp index f574d9fe26..8d24f5124a 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp +++ b/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp @@ -357,6 +357,19 @@ CALGSLDevice::SetupAdapter(int32 &asic_id) } #endif + //The sDMA L2T reading invalid address bug is fixed starting from Vega10, + //and page-fault is not enabled for pre-VI, so we need to workaround + //the bug for ASICs in between. + if (asic_id < GSL_ATIASIC_ID_GREENLAND && + asic_id >= GSL_ATIASIC_ID_ICELAND_M) + { + m_isSDMAL2TConstrained = true; + } + else + { + m_isSDMAL2TConstrained = false; + } + if (asic_id < GSL_ATIASIC_ID_TAHITI_P || asic_id == GSL_ATIASIC_ID_DEVASTATOR || asic_id == GSL_ATIASIC_ID_SCRAPPER) @@ -1209,32 +1222,27 @@ CALGSLDevice::GetCopyType( { type = USE_DRMDMA_T2L; } - else - { - type = USE_NONE; - } } else if ((srcTiling == GSL_MOA_TILING_LINEAR) && (dstTiling != GSL_MOA_TILING_LINEAR)) { intp bppDst = destMem->getBitsPerElement(); - uint64 linearBytePitch = size * (bppDst / 8); + uint64 BytesPerPixel = bppDst / 8; + uint64 linearBytePitch = size * BytesPerPixel; // Make sure linear pitch in bytes is 4 bytes aligned if (((linearBytePitch % 4) == 0) && // another DRM restriciton... SI has 4 pixels (srcOffset[0] % 4 == 0)) { - type = USE_DRMDMA_L2T; + // The sDMA L2T cases we need to avoid are when the tiled_x + // is not a multiple of BytesPerPixel. + if (!m_isSDMAL2TConstrained || + (destOffset[0] % BytesPerPixel == 0)) + { + type = USE_DRMDMA_L2T; + } } - else - { - type = USE_NONE; - } - } - else - { - type = USE_NONE; } } else if (dstType == srcType) diff --git a/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.h b/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.h index bdcebf87bd..64649c4e3c 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.h +++ b/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDevice.h @@ -206,6 +206,7 @@ private: uint m_usePerVPUAdapterModel : 1; uint m_PerformLazyDeviceInit : 1; uint m_isComputeRingIDForced : 1; + uint m_isSDMAL2TConstrained : 1; }; };