From 2bc88360128219d1536894f41c8a8a06c97c1560 Mon Sep 17 00:00:00 2001 From: foreman Date: Fri, 28 Jun 2019 10:14:56 -0400 Subject: [PATCH] P4 to Git Change 1917655 by vsytchen@vsytchen-remote-ocl-win10 on 2019/06/28 10:05:26 SWDEV-193973 - [OpenCL][NV21] Add support for Navi21 1. Recognize gfx10.3 in OpenCL. 2. Don't report nv12/nv12_lite/nv21 for mainline OpenCL. 3. Disable nv10_lite/nv21_lite for OpenCL (gfx1000/1020 are not supported by LC). ReviewBoardURL = http://ocltc.amd.com/reviews/r/17603/diff/ Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palbedefs#42 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palcounters.cpp#23 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldefs.hpp#56 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#147 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palsettings.cpp#87 edit ... //depot/stg/opencl/drivers/opencl/runtime/utils/macros.hpp#13 edit --- rocclr/runtime/device/pal/palcounters.cpp | 3 +- rocclr/runtime/device/pal/paldefs.hpp | 60 ++++++++++++----------- rocclr/runtime/device/pal/paldevice.cpp | 11 +++-- rocclr/runtime/device/pal/palsettings.cpp | 10 +--- rocclr/runtime/utils/macros.hpp | 4 +- 5 files changed, 42 insertions(+), 46 deletions(-) diff --git a/rocclr/runtime/device/pal/palcounters.cpp b/rocclr/runtime/device/pal/palcounters.cpp index 3d323c3dd2..c4c1d3c9bd 100644 --- a/rocclr/runtime/device/pal/palcounters.cpp +++ b/rocclr/runtime/device/pal/palcounters.cpp @@ -670,8 +670,7 @@ void PerfCounter::convertInfo() { info_.counterIndex_ = std::get<1>(p); } break; - case Pal::GfxIpLevel::GfxIp10: - case Pal::GfxIpLevel::GfxIp10_1: + case Pal::GfxIpLevel::GfxIp10_1:: if (info_.blockIndex_ < gfx10BlockIdPal.size()) { auto p = gfx10BlockIdPal[info_.blockIndex_]; info_.blockIndex_ = std::get<0>(p); diff --git a/rocclr/runtime/device/pal/paldefs.hpp b/rocclr/runtime/device/pal/paldefs.hpp index f25fa6fc3f..56c8d305f9 100644 --- a/rocclr/runtime/device/pal/paldefs.hpp +++ b/rocclr/runtime/device/pal/paldefs.hpp @@ -126,8 +126,10 @@ struct AMDDeviceInfo { bool xnackEnabled_; //!< Enable XNACK feature }; -static const AMDDeviceInfo DeviceInfo[] = { - /* Unknown */ {"", "", 16, 256, 32, 0, 0, false}, +static constexpr AMDDeviceInfo UnknownDevice = {"", "", 16, 256, 32, 0, 0, false}; + +static constexpr AMDDeviceInfo DeviceInfo[] = { + /* Unknown */ UnknownDevice, /* Tahiti */ {"", "", 16, 256, 32, 600, 600, false}, /* Pitcairn */ {"", "", 16, 256, 32, 600, 600, false}, /* Capeverde */ {"", "", 16, 256, 32, 700, 700, false}, @@ -158,35 +160,35 @@ static const AMDDeviceInfo DeviceInfo[] = { // Ordering as per AsicRevision# in //depot/stg/pal/inc/core/palDevice.h and // http://confluence.amd.com/pages/viewpage.action?spaceKey=ASLC&title=AMDGPU+Target+Names -static const AMDDeviceInfo Gfx9PlusSubDeviceInfo[] = { - /* Vega10 */ {"gfx900", "gfx900", 16, 256, 32, 900, 900, false}, - /* Vega10 XNACK */ {"gfx901", "gfx900", 16, 256, 32, 900, 901, true}, - /* Vega12 */ {"gfx904", "gfx904", 16, 256, 32, 904, 904, false}, - /* Vega12 XNACK */ {"gfx905", "gfx904", 16, 256, 32, 904, 905, true}, - /* Vega20 */ {"gfx906", "gfx906", 16, 256, 32, 906, 906, false}, - /* Vega20 XNACK */ {"gfx907", "gfx906", 16, 256, 32, 906, 907, true}, - /* Raven */ {"gfx902", "gfx902", 16, 256, 32, 902, 902, false}, - /* Raven XNACK */ {"gfx903", "gfx902", 16, 256, 32, 902, 903, true}, - /* Raven2 */ {"gfx902", "gfx902", 16, 256, 32, 902, 902, false}, - /* Raven2 XNACK */ {"gfx903", "gfx902", 16, 256, 32, 902, 903, true}, - /* Renoir */ {"gfx902", "gfx902", 16, 256, 32, 902, 902, false}, - /* Renoir XNACK */ {"gfx903", "gfx902", 16, 256, 32, 902, 903, true}, +static constexpr AMDDeviceInfo Gfx9PlusSubDeviceInfo[] = { + /* Vega10 */ {"gfx900", "gfx900", 16, 256, 32, 900, 900, false}, + /* Vega10 XNACK */ {"gfx901", "gfx900", 16, 256, 32, 900, 901, true}, + /* Vega12 */ {"gfx904", "gfx904", 16, 256, 32, 904, 904, false}, + /* Vega12 XNACK */ {"gfx905", "gfx904", 16, 256, 32, 904, 905, true}, + /* Vega20 */ {"gfx906", "gfx906", 16, 256, 32, 906, 906, false}, + /* Vega20 XNACK */ {"gfx907", "gfx906", 16, 256, 32, 906, 907, true}, + /* Raven */ {"gfx902", "gfx902", 16, 256, 32, 902, 902, false}, + /* Raven XNACK */ {"gfx903", "gfx902", 16, 256, 32, 902, 903, true}, + /* Raven2 */ {"gfx902", "gfx902", 16, 256, 32, 902, 902, false}, + /* Raven2 XNACK */ {"gfx903", "gfx902", 16, 256, 32, 902, 903, true}, + /* Renoir */ {"gfx902", "gfx902", 16, 256, 32, 902, 902, false}, + /* Renoir XNACK */ {"gfx903", "gfx902", 16, 256, 32, 902, 903, true}, /* Navi10_A0 */ {"gfx1010", "gfx1010", 32, 256, 32, 1010, 1010, false}, /* Navi10_A0 XNACK */ {"gfx1010", "gfx1010", 32, 256, 32, 1010, 1010, true}, - /* Navi10 */ {"gfx1010", "gfx1010", 32, 256, 32, 1010, 1010, false}, - /* Navi10 XNACK */ {"gfx1010", "gfx1010", 32, 256, 32, 1010, 1010, true}, - /* Navi10Lite */ {"gfx1000", "gfx1000", 32, 256, 32, 1000, 1000, false}, - /* Navi10LiteXNACK */ {"gfx1000", "gfx1000", 32, 256, 32, 1000, 1000, true}, - /* Navi12 */ {"gfx1011", "gfx1011", 32, 256, 32, 1011, 1011, false}, - /* Navi12 XNACK */ {"gfx1011", "gfx1011", 32, 256, 32, 1011, 1011, true}, - /* Navi12Lite */ {"gfx1011", "gfx1011", 32, 256, 32, 1011, 1011, false}, - /* Navi12LiteXNACK */ {"gfx1011", "gfx1011", 32, 256, 32, 1011, 1011, true}, - /* Navi14 */ {"gfx1012", "gfx1012", 32, 256, 32, 1012, 1012, false}, - /* Navi14 XNACK */ {"gfx1012", "gfx1012", 32, 256, 32, 1012, 1012, true}, - /* UnknownDevice3 */ UnknownDevice, - /* UnknownDevice3 XNACK */ {"gfx1030", "gfx1030", 32, 256, 32, 1030, 1030, true}, - /* UnknownDevice2 */ UnknownDevice, - /* UnknownDevice2XNACK */ {"gfx1030", "gfx1030", 32, 256, 32, 1030, 1030, true}, + /* Navi10 */ {"gfx1010", "gfx1010", 32, 256, 32, 1010, 1010, false}, + /* Navi10 XNACK */ {"gfx1010", "gfx1010", 32, 256, 32, 1010, 1010, true}, + /* Navi10Lite */ UnknownDevice, + /* Navi10LiteXNACK */ UnknownDevice, + /* Navi12 */ UnknownDevice, + /* Navi12 XNACK */ UnknownDevice, + /* Navi12Lite */ UnknownDevice, + /* Navi12LiteXNACK */ UnknownDevice, + /* Navi14 */ {"gfx1012", "gfx1012", 32, 256, 32, 1012, 1012, false}, + /* Navi14 XNACK */ {"gfx1012", "gfx1012", 32, 256, 32, 1012, 1012, true}, + /* UnknownDevice3 */ UnknownDevice, + /* UnknownDevice3 XNACK */ UnknownDevice, + /* UnknownDevice2 */ UnknownDevice, + /* UnknownDevice2XNACK */ UnknownDevice, }; // Supported OpenCL versions diff --git a/rocclr/runtime/device/pal/paldevice.cpp b/rocclr/runtime/device/pal/paldevice.cpp index c8b8417db2..8b0d17e1aa 100644 --- a/rocclr/runtime/device/pal/paldevice.cpp +++ b/rocclr/runtime/device/pal/paldevice.cpp @@ -172,13 +172,13 @@ bool NullDevice::init() { case 10: switch (ipLevelMinor) { case 0: - ipLevel = Pal::GfxIpLevel::GfxIp10; + ShouldNotReachHere(); break; case 1: ipLevel = Pal::GfxIpLevel::GfxIp10_1; break; case 2: - ipLevel = Pal::GfxIpLevel::GfxIp10_2; + ShouldNotReachHere(); break; case 3: ipLevel = Pal::GfxIpLevel::GfxIp10_3; @@ -207,17 +207,20 @@ bool NullDevice::init() { revision = Pal::AsicRevision::Vega20; break; case 1000: - revision = Pal::AsicRevision::Navi10Lite; + ShouldNotReachHere(); break; case 1010: revision = Pal::AsicRevision::Navi10; break; case 1011: - revision = Pal::AsicRevision::Navi12; + ShouldNotReachHere(); break; case 1012: revision = Pal::AsicRevision::Navi14; break; + case 1020: + ShouldNotReachHere(); + break; case 1030: ShouldNotReachHere(); break; diff --git a/rocclr/runtime/device/pal/palsettings.cpp b/rocclr/runtime/device/pal/palsettings.cpp index a976199d09..803371dcd0 100644 --- a/rocclr/runtime/device/pal/palsettings.cpp +++ b/rocclr/runtime/device/pal/palsettings.cpp @@ -180,7 +180,6 @@ bool Settings::create(const Pal::DeviceProperties& palProp, case Pal::AsicRevision::Unknown: switch (palProp.gfxLevel) { case Pal::GfxIpLevel::GfxIp10_1: - case Pal::GfxIpLevel::GfxIp10: gfx10Plus_ = true; case Pal::GfxIpLevel::GfxIp9: aiPlus_ = true; @@ -189,12 +188,9 @@ bool Settings::create(const Pal::DeviceProperties& palProp, assert(0 && "Unknown GfxIP type!"); return false; } - case Pal::AsicRevision::Navi12Lite: - case Pal::AsicRevision::Navi12: case Pal::AsicRevision::Navi14: case Pal::AsicRevision::Navi10: case Pal::AsicRevision::Navi10_A0: - case Pal::AsicRevision::Navi10Lite: gfx10Plus_ = true; useLightning_ = GPU_ENABLE_LC; hsailExplicitXnack_ = @@ -204,9 +200,6 @@ bool Settings::create(const Pal::DeviceProperties& palProp, if (useLightning_) { enableWave32Mode_ = true; } - if (palProp.revision == Pal::AsicRevision::Navi10Lite && useLightning_) { - enableWave32Mode_ = false; - } if (!flagIsDefault(GPU_ENABLE_WAVE32_MODE)) { enableWave32Mode_ = GPU_ENABLE_WAVE32_MODE; } @@ -478,9 +471,8 @@ bool Settings::create(const Pal::DeviceProperties& palProp, } if (useLightning_) { - switch (palProp.gfxLevel) { + switch (palProp.gfxLevel) {: case Pal::GfxIpLevel::GfxIp10_1: - case Pal::GfxIpLevel::GfxIp10: case Pal::GfxIpLevel::GfxIp9: singleFpDenorm_ = true; break; diff --git a/rocclr/runtime/utils/macros.hpp b/rocclr/runtime/utils/macros.hpp index 67aa6b9665..3293dc2bb3 100644 --- a/rocclr/runtime/utils/macros.hpp +++ b/rocclr/runtime/utils/macros.hpp @@ -98,6 +98,8 @@ #define NOT_WIN64(x) x #endif /*!_WIN64*/ +#define IS_MAINLINE true + #ifndef IS_LINUX #define IS_LINUX false #endif @@ -121,8 +123,6 @@ #define MACOS_SWITCH(x, other) MACOS_ONLY(x) NOT_MACOS(other) #define WINDOWS_SWITCH(x, other) WINDOWS_ONLY(x) NOT_WINDOWS(other) -#define IS_MAINLINE true - #ifdef OPTIMIZED #define OPTIMIZED_ONLY(x) x #define NOT_OPTIMIZED(x)