From 1fa47a7398292acc8e01d38bd9de8e6cbf3df76e Mon Sep 17 00:00:00 2001 From: foreman Date: Tue, 5 Feb 2019 14:44:09 -0500 Subject: [PATCH] P4 to Git Change 1740048 by wchau@wchau_OCL_Linux on 2019/02/05 14:10:40 SWDEV-134107 - Add support for respecting target's xnack setting - Enable the XNACK feature for all the APU system and remove the xnackEnabled_ field in AMDDeviceInfo struct Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#332 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdefs.hpp#23 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#116 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#98 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocsettings.cpp#41 edit --- rocclr/runtime/device/device.hpp | 3 +- rocclr/runtime/device/rocm/rocdefs.hpp | 35 +++++++++++----------- rocclr/runtime/device/rocm/rocdevice.cpp | 4 +-- rocclr/runtime/device/rocm/rocprogram.cpp | 4 +-- rocclr/runtime/device/rocm/rocsettings.cpp | 6 ++-- 5 files changed, 25 insertions(+), 27 deletions(-) diff --git a/rocclr/runtime/device/device.hpp b/rocclr/runtime/device/device.hpp index 3dce4ced80..e455832513 100644 --- a/rocclr/runtime/device/device.hpp +++ b/rocclr/runtime/device/device.hpp @@ -527,7 +527,8 @@ class Settings : public amd::HeapObject { uint enableWgpMode_ : 1; //!< Enable WGP mode for this device uint enableWave32Mode_ : 1; //!< Enable Wave32 mode for this device uint lcWavefrontSize64_ : 1; //!< Enable Wave64 mode for this device - uint reserved_ : 15; + uint enableXNACK_ : 1; //!< Enable XNACK feature + uint reserved_ : 14; }; uint value_; }; diff --git a/rocclr/runtime/device/rocm/rocdefs.hpp b/rocclr/runtime/device/rocm/rocdefs.hpp index 9c692a8d1b..1917f02289 100644 --- a/rocclr/runtime/device/rocm/rocdefs.hpp +++ b/rocclr/runtime/device/rocm/rocdefs.hpp @@ -26,7 +26,6 @@ struct AMDDeviceInfo { uint localMemBanks_; //!< Number of banks of local memory uint gfxipVersion_; //!< The core engine GFXIP version uint pciDeviceId_; //!< PCIe device id - bool xnackEnabled_; //!< Enable XNACK feature }; // The device ID must match with the device's index into DeviceInfo @@ -52,28 +51,28 @@ const HsaDeviceId HSA_INVALID_DEVICE_ID = -1; static const AMDDeviceInfo DeviceInfo[] = { // targetName machineTarget /* TARGET_KAVERI_SPECTRE */ {HSA_SPECTRE_ID, "", "kaveri", "", "Spectre", 4, 16, 1, 256, 64 * Ki, - 32, 0, 0, false}, + 32, 0, 0}, /* TARGET_KAVERI_SPOOKY */ {HSA_SPOOKY_ID, "", "kaveri", "", "Spooky", 4, 16, 1, 256, 64 * Ki, 32, - 0, 0, false}, - /* TARGET_TONGA */ {HSA_TONGA_ID, "", "tonga", "gfx802", "Tonga", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, false}, + 0, 0}, + /* TARGET_TONGA */ {HSA_TONGA_ID, "", "tonga", "gfx802", "Tonga", 4, 16, 1, 256, 64 * Ki, 32, 0, 0}, /* TARGET_CARRIZO */ {HSA_CARRIZO_ID, "", "carrizo", "gfx801", "Carrizo", 4, 16, 1, 256, 64 * Ki, 32, 0, - 0, true}, + 0}, /* TARGET_ICELAND */ {HSA_ICELAND_ID, "", "iceland", "gfx802", "Iceland", 4, 16, 1, 256, 64 * Ki, 32, 0, - 0, false}, - /* TARGET_FIJI */ {HSA_FIJI_ID, "", "fiji", "gfx803", "Fiji", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, false}, - /* TARGET HAWAII */ {HSA_HAWAII_ID, "", "hawaii", "gfx701", "Hawaii", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, false}, + 0}, + /* TARGET_FIJI */ {HSA_FIJI_ID, "", "fiji", "gfx803", "Fiji", 4, 16, 1, 256, 64 * Ki, 32, 0, 0}, + /* TARGET HAWAII */ {HSA_HAWAII_ID, "", "hawaii", "gfx701", "Hawaii", 4, 16, 1, 256, 64 * Ki, 32, 0, 0}, /* TARGET ELLESMERE */ {HSA_ELLESMERE_ID, "", "polaris10", "gfx803", "Ellesmere", 4, 16, 1, 256, 64 * Ki, - 32, 0, 0, false}, + 32, 0, 0}, /* TARGET BAFFIN */ {HSA_BAFFIN_ID, "", "polaris11", "gfx803", "Baffin", 4, 16, 1, 256, 64 * Ki, 32, 0, - 0, false}, - /* TARGET VEGA10 */ {HSA_VEGA10_ID, "", "gfx900", "gfx900", "gfx900", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, false}, - /* TARGET VEGA10_HBCC */ {HSA_VEGA10_HBCC_ID, "", "gfx901", "gfx901", "gfx901", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, false}, - /* TARGET RAVEN */ {HSA_RAVEN_ID, "", "gfx902", "gfx902", "gfx902", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, true}, - /* TARGET VEGA12 */ {HSA_VEGA12_ID, "", "gfx904", "gfx904", "gfx904", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, false}, - /* TARGET VEGA20 */ {HSA_VEGA20_ID, "", "gfx906", "gfx906", "gfx906", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, false}, - /* TARGET ARIEL */ {HSA_ARIEL_ID, "", "gfx1000", "gfx1000", "gfx1000", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, false}, - /* TARGET NAVI10 */ {HSA_NAVI10_ID, "", "gfx1010", "gfx1010", "gfx1010", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, false}, - /* TARGET MI100 */ {HSA_MI100_ID, "", "gfx908", "gfx908", "gfx908", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, false}}; + 0}, + /* TARGET VEGA10 */ {HSA_VEGA10_ID, "", "gfx900", "gfx900", "gfx900", 4, 16, 1, 256, 64 * Ki, 32, 0, 0}, + /* TARGET VEGA10_HBCC */ {HSA_VEGA10_HBCC_ID, "", "gfx901", "gfx901", "gfx901", 4, 16, 1, 256, 64 * Ki, 32, 0, 0}, + /* TARGET RAVEN */ {HSA_RAVEN_ID, "", "gfx902", "gfx902", "gfx902", 4, 16, 1, 256, 64 * Ki, 32, 0, 0}, + /* TARGET VEGA12 */ {HSA_VEGA12_ID, "", "gfx904", "gfx904", "gfx904", 4, 16, 1, 256, 64 * Ki, 32, 0, 0}, + /* TARGET VEGA20 */ {HSA_VEGA20_ID, "", "gfx906", "gfx906", "gfx906", 4, 16, 1, 256, 64 * Ki, 32, 0, 0}, + /* TARGET ARIEL */ {HSA_ARIEL_ID, "", "gfx1000", "gfx1000", "gfx1000", 4, 16, 1, 256, 64 * Ki, 32, 0, 0}, + /* TARGET NAVI10 */ {HSA_NAVI10_ID, "", "gfx1010", "gfx1010", "gfx1010", 4, 16, 1, 256, 64 * Ki, 32, 0, 0}, + /* TARGET MI100 */ {HSA_MI100_ID, "", "gfx908", "gfx908", "gfx908", 4, 16, 1, 256, 64 * Ki, 32, 0, 0}}; } const uint kMaxAsyncQueues = 8; // set to match the number of pipes, which is 8 diff --git a/rocclr/runtime/device/rocm/rocdevice.cpp b/rocclr/runtime/device/rocm/rocdevice.cpp index 422451206d..fbc3a1fdc7 100644 --- a/rocclr/runtime/device/rocm/rocdevice.cpp +++ b/rocclr/runtime/device/rocm/rocdevice.cpp @@ -658,7 +658,7 @@ bool Device::create() { // with dash as delimiter to be compatible with Windows directory name std::ostringstream cacheTarget; cacheTarget << "AMD-AMDGPU-" << gfxipMajor << "-" << gfxipMinor << "-" << gfxipStepping; - if (deviceInfo_.xnackEnabled_) { + if (settings().enableXNACK_) { cacheTarget << "-xnack"; } @@ -852,7 +852,7 @@ bool Device::populateOCLDeviceConstants() { std::ostringstream oss; oss << "gfx" << gfxipMajor << gfxipMinor << gfxipStepping; - if (settings().useLightning_ && deviceInfo_.xnackEnabled_) { + if (settings().useLightning_ && hsa_settings->enableXNACK_) { oss << "-xnack"; } diff --git a/rocclr/runtime/device/rocm/rocprogram.cpp b/rocclr/runtime/device/rocm/rocprogram.cpp index dc66554736..1d373434f4 100644 --- a/rocclr/runtime/device/rocm/rocprogram.cpp +++ b/rocclr/runtime/device/rocm/rocprogram.cpp @@ -112,7 +112,7 @@ bool Program::initClBinary(char* binaryIn, size_t size) { } HSAILProgram::HSAILProgram(roc::NullDevice& device) : roc::Program(device) { - xnackEnabled_ = dev().deviceInfo().xnackEnabled_; + xnackEnabled_ = dev().settings().enableXNACK_; machineTarget_ = dev().deviceInfo().complibTarget_; } @@ -318,7 +318,7 @@ bool HSAILProgram::setKernels(amd::option::Options* options, void* binary, size_ LightningProgram::LightningProgram(roc::NullDevice& device) : roc::Program(device) { isLC_ = true; - xnackEnabled_ = dev().deviceInfo().xnackEnabled_; + xnackEnabled_ = dev().settings().enableXNACK_; machineTarget_ = dev().deviceInfo().machineTargetLC_; } diff --git a/rocclr/runtime/device/rocm/rocsettings.cpp b/rocclr/runtime/device/rocm/rocsettings.cpp index de35ae8cce..90752a164a 100644 --- a/rocclr/runtime/device/rocm/rocsettings.cpp +++ b/rocclr/runtime/device/rocm/rocsettings.cpp @@ -77,10 +77,12 @@ bool Settings::create(bool fullProfile, int gfxipVersion) { pinnedXferSize_ = 0; stagedXferSize_ = 0; xferBufSize_ = 0; + apuSystem_ = true; } else { pinnedXferSize_ = std::max(pinnedXferSize_, pinnedMinXferSize_); stagedXferSize_ = std::max(stagedXferSize_, pinnedMinXferSize_ + 4 * Ki); } + enableXNACK_ = apuSystem_ ? 1 : 0 ; // enable xnack for APU system // Enable extensions enableExtension(ClKhrByteAddressableStore); @@ -118,10 +120,6 @@ bool Settings::create(bool fullProfile, int gfxipVersion) { enableExtension(ClAmdFp64); } - if (gfxipVersion == 902) { - apuSystem_ = true; - } - // Override current device settings override();