P4 to Git Change 1529710 by wchau@wchau_OCL_boltzmann on 2018/03/20 17:05:04
SWDEV-145760 - OCL on ROCm Support for respecting target's xnack setting (subtask of SWDEV-134107)
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palcompiler.cpp#21 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldefs.hpp#34 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#77 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprogram.cpp#58 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/roccompiler.cpp#41 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdefs.hpp#16 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#84 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprogram.cpp#80 edit
[ROCm/clr commit: 68c299486b]
This commit is contained in:
@@ -253,6 +253,11 @@ bool LightningProgram::compileImpl(const std::string& sourceCode,
|
||||
mCPU << " -mcpu=gfx" << dev().hwInfo()->gfxipVersion_;
|
||||
driverOptions.append(mCPU.str());
|
||||
|
||||
// Set xnack option if needed
|
||||
if (dev().hwInfo()->xnackEnabled_) {
|
||||
driverOptions.append(" -mxnack");
|
||||
}
|
||||
|
||||
driverOptions.append(options->llvmOptions);
|
||||
driverOptions.append(hsailOptions(options));
|
||||
|
||||
|
||||
@@ -117,58 +117,59 @@ struct AMDDeviceInfo {
|
||||
uint localMemSizePerCU_; //!< Local memory size per CU
|
||||
uint localMemBanks_; //!< Number of banks of local memory
|
||||
uint gfxipVersion_; //!< The core engine GFXIP version
|
||||
bool xnackEnabled_; //!< Enable XNACK feature
|
||||
};
|
||||
|
||||
static const AMDDeviceInfo DeviceInfo[] = {
|
||||
/* Unknown */ {"", "unknown", 4, 16, 1, 256, 64 * Ki, 32, 0},
|
||||
/* Tahiti */ {"", "tahiti", 4, 16, 1, 256, 64 * Ki, 32, 600},
|
||||
/* Pitcairn */ {"", "pitcairn", 4, 16, 1, 256, 64 * Ki, 32, 600},
|
||||
/* Capeverde */ {"", "bonaire", 4, 16, 1, 256, 64 * Ki, 32, 700},
|
||||
/* Oland */ {"", "oland", 4, 16, 1, 256, 64 * Ki, 32, 600},
|
||||
/* Hainan */ {"", "hainan", 4, 16, 1, 256, 64 * Ki, 32, 600},
|
||||
/* Unknown */ {"", "unknown", 4, 16, 1, 256, 64 * Ki, 32, 0, false},
|
||||
/* Tahiti */ {"", "tahiti", 4, 16, 1, 256, 64 * Ki, 32, 600, false},
|
||||
/* Pitcairn */ {"", "pitcairn", 4, 16, 1, 256, 64 * Ki, 32, 600, false},
|
||||
/* Capeverde */ {"", "bonaire", 4, 16, 1, 256, 64 * Ki, 32, 700, false},
|
||||
/* Oland */ {"", "oland", 4, 16, 1, 256, 64 * Ki, 32, 600, false},
|
||||
/* Hainan */ {"", "hainan", 4, 16, 1, 256, 64 * Ki, 32, 600, false},
|
||||
|
||||
/* Bonaire */ {"Bonaire", "bonaire", 4, 16, 1, 256, 64 * Ki, 32, 700},
|
||||
/* Hawaii */ {"Hawaii", "hawaii", 4, 16, 1, 256, 64 * Ki, 32, 701},
|
||||
/* Hawaii */ {"", "grenada", 4, 16, 1, 256, 64 * Ki, 32, 701},
|
||||
/* Hawaii */ {"", "maui", 4, 16, 1, 256, 64 * Ki, 32, 701},
|
||||
/* Bonaire */ {"Bonaire", "bonaire", 4, 16, 1, 256, 64 * Ki, 32, 700, false},
|
||||
/* Hawaii */ {"Hawaii", "hawaii", 4, 16, 1, 256, 64 * Ki, 32, 701, false},
|
||||
/* Hawaii */ {"", "grenada", 4, 16, 1, 256, 64 * Ki, 32, 701, false},
|
||||
/* Hawaii */ {"", "maui", 4, 16, 1, 256, 64 * Ki, 32, 701, false},
|
||||
|
||||
/* Kalindi */ {"Kalindi", "kalindi", 4, 16, 1, 256, 64 * Ki, 32, 702},
|
||||
/* Godavari */ {"Mullins", "mullins", 4, 16, 1, 256, 64 * Ki, 32, 702},
|
||||
/* Spectre */ {"Spectre", "spectre", 4, 16, 1, 256, 64 * Ki, 32, 701},
|
||||
/* Spooky */ {"Spooky", "spooky", 4, 16, 1, 256, 64 * Ki, 32, 701},
|
||||
/* Kalindi */ {"Kalindi", "kalindi", 4, 16, 1, 256, 64 * Ki, 32, 702, false},
|
||||
/* Godavari */ {"Mullins", "mullins", 4, 16, 1, 256, 64 * Ki, 32, 702, false},
|
||||
/* Spectre */ {"Spectre", "spectre", 4, 16, 1, 256, 64 * Ki, 32, 701, false},
|
||||
/* Spooky */ {"Spooky", "spooky", 4, 16, 1, 256, 64 * Ki, 32, 701, false},
|
||||
|
||||
/* Carrizo */ {"Carrizo", "carrizo", 4, 16, 1, 256, 64 * Ki, 32, 801},
|
||||
/* Bristol */ {"Bristol Ridge", "carrizo", 4, 16, 1, 256, 64 * Ki, 32, 801},
|
||||
/* Stoney */ {"Stoney", "stoney", 4, 16, 1, 256, 64 * Ki, 32, 810},
|
||||
/* Carrizo */ {"Carrizo", "carrizo", 4, 16, 1, 256, 64 * Ki, 32, 801, false},
|
||||
/* Bristol */ {"Bristol Ridge", "carrizo", 4, 16, 1, 256, 64 * Ki, 32, 801, false},
|
||||
/* Stoney */ {"Stoney", "stoney", 4, 16, 1, 256, 64 * Ki, 32, 810, false},
|
||||
|
||||
/* Iceland */ {"Iceland", "iceland", 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(802, 800)},
|
||||
/* Tonga */ {"Tonga", "tonga", 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(802, 800)},
|
||||
/* Fiji */ {"Fiji", "fiji", 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(803, 804)},
|
||||
/* Ellesmere */ {"Ellesmere", "ellesmere", 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(803, 804)},
|
||||
/* Baffin */ {"Baffin", "baffin", 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(803, 804)},
|
||||
/* Lexa */ {"gfx803", "gfx803", 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(803, 804)},
|
||||
/* Iceland */ {"Iceland", "iceland", 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(802, 800), false},
|
||||
/* Tonga */ {"Tonga", "tonga", 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(802, 800), false},
|
||||
/* Fiji */ {"Fiji", "fiji", 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(803, 804), false},
|
||||
/* Ellesmere */ {"Ellesmere", "ellesmere", 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(803, 804), false},
|
||||
/* Baffin */ {"Baffin", "baffin", 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(803, 804), false},
|
||||
/* Lexa */ {"gfx803", "gfx803", 4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(803, 804), false},
|
||||
};
|
||||
|
||||
// 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", 4, 16, 1, 256, 64 * Ki, 32, 900},
|
||||
/* Vega10 */{"gfx900", "gfx900", 4, 16, 1, 256, 64 * Ki, 32, 900, false},
|
||||
/* Vega10 XNACK */{ LIGHTNING_SWITCH("gfx900","gfx901"), LIGHTNING_SWITCH("gfx900","gfx901"),
|
||||
4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(900, 901)},
|
||||
/* Vega12 */{"gfx904", "gfx904", 4, 16, 1, 256, 64 * Ki, 32, 904},
|
||||
4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(900, 901), true},
|
||||
/* Vega12 */{"gfx904", "gfx904", 4, 16, 1, 256, 64 * Ki, 32, 904, false},
|
||||
/* Vega12 XNACK */{ LIGHTNING_SWITCH("gfx904","gfx905"), LIGHTNING_SWITCH("gfx904","gfx905"),
|
||||
4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(904, 905)},
|
||||
/* Vega20 */{"gfx906", "gfx906", 4, 16, 1, 256, 64 * Ki, 32, 906},
|
||||
4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(904, 905), true},
|
||||
/* Vega20 */{"gfx906", "gfx906", 4, 16, 1, 256, 64 * Ki, 32, 906, false},
|
||||
/* Vega20 XNACK */{ LIGHTNING_SWITCH("gfx906","gfx907"), LIGHTNING_SWITCH("gfx906","gfx907"),
|
||||
4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(906, 907)},
|
||||
/* Raven */{"gfx902", "gfx902", 4, 16, 1, 256, 64 * Ki, 32, 902},
|
||||
4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(906, 907), true},
|
||||
/* Raven */{"gfx902", "gfx902", 4, 16, 1, 256, 64 * Ki, 32, 902, false},
|
||||
/* Raven XNACK */{ LIGHTNING_SWITCH("gfx902","gfx903"), LIGHTNING_SWITCH("gfx902","gfx903"),
|
||||
4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(902, 903)},
|
||||
/* Raven2 */{"gfx902", "gfx902", 4, 16, 1, 256, 64 * Ki, 32, 902},
|
||||
4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(902, 903), true},
|
||||
/* Raven2 */{"gfx902", "gfx902", 4, 16, 1, 256, 64 * Ki, 32, 902, false},
|
||||
/* Raven2 XNACK */{ LIGHTNING_SWITCH("gfx902","gfx903"), LIGHTNING_SWITCH("gfx902","gfx903"),
|
||||
4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(902, 903)},
|
||||
/* Navi10 */{ "", "", 4, 16, 1, 256, 64 * Ki, 32, 1000},
|
||||
/* Navi10 XNACK */{ "", "", 4, 16, 1, 256, 64 * Ki, 32, 1001},
|
||||
4, 16, 1, 256, 64 * Ki, 32, LIGHTNING_SWITCH(902, 903), true},
|
||||
/* Navi10 */{ "", "", 4, 16, 1, 256, 64 * Ki, 32, 1000, false},
|
||||
/* Navi10 XNACK */{ "", "", 4, 16, 1, 256, 64 * Ki, 32, 1001, true},
|
||||
};
|
||||
|
||||
// Supported OpenCL versions
|
||||
|
||||
@@ -144,30 +144,26 @@ bool NullDevice::init() {
|
||||
}
|
||||
|
||||
Pal::AsicRevision revision = Pal::AsicRevision::Unknown;
|
||||
uint xNACKSupported = 0;
|
||||
uint xNACKSupported = pal::Gfx9PlusSubDeviceInfo[id].xnackEnabled_ ? 1 : 0;
|
||||
|
||||
switch (pal::Gfx9PlusSubDeviceInfo[id].gfxipVersion_) {
|
||||
case 901:
|
||||
xNACKSupported = 1;
|
||||
case 900:
|
||||
revision = Pal::AsicRevision::Vega10;
|
||||
break;
|
||||
case 903:
|
||||
xNACKSupported = 1;
|
||||
case 902:
|
||||
revision = Pal::AsicRevision::Raven;
|
||||
break;
|
||||
case 905:
|
||||
xNACKSupported = 1;
|
||||
case 904:
|
||||
revision = Pal::AsicRevision::Vega12;
|
||||
break;
|
||||
case 907:
|
||||
xNACKSupported = 1;
|
||||
case 906:
|
||||
revision = Pal::AsicRevision::Vega20;
|
||||
break;
|
||||
case 1001:
|
||||
xNACKSupported = 1;
|
||||
case 1000:
|
||||
revision = Pal::AsicRevision::Navi10;
|
||||
break;
|
||||
@@ -437,7 +433,11 @@ void NullDevice::fillDeviceInfo(const Pal::DeviceProperties& palProp,
|
||||
const static char* bristol = "Bristol Ridge";
|
||||
::strcpy(info_.name_, bristol);
|
||||
} else {
|
||||
::strcpy(info_.name_, hwInfo()->targetName_);
|
||||
if (IS_LIGHTNING && hwInfo()->xnackEnabled_) {
|
||||
::snprintf(info_.name_, sizeof(info_.name_) - 1, "%s-xnack", hwInfo()->targetName_);
|
||||
} else {
|
||||
::strcpy(info_.name_, hwInfo()->targetName_);
|
||||
}
|
||||
}
|
||||
::strcpy(info_.vendor_, "Advanced Micro Devices, Inc.");
|
||||
::snprintf(info_.driverVersion_, sizeof(info_.driverVersion_) - 1, AMD_BUILD_STRING " (PAL%s)",
|
||||
@@ -916,6 +916,9 @@ bool Device::create(Pal::IDevice* device) {
|
||||
// with dash as delimiter to be compatible with Windows directory name
|
||||
std::ostringstream cacheTarget;
|
||||
cacheTarget << "AMD-AMDGPU-" << gfxipMajor << "-" << gfxipMinor << "-" << gfxipStepping;
|
||||
if (isXNACKSupported) {
|
||||
cacheTarget << "-xnack";
|
||||
}
|
||||
|
||||
amd::CacheCompilation* compObj = new amd::CacheCompilation(
|
||||
cacheTarget.str(), "_pal", OCL_CODE_CACHE_ENABLE, OCL_CODE_CACHE_RESET);
|
||||
|
||||
@@ -1437,6 +1437,11 @@ bool LightningProgram::linkImpl(amd::option::Options* options) {
|
||||
mCPU << " -mcpu=gfx" << dev().hwInfo()->gfxipVersion_;
|
||||
codegenOptions.append(mCPU.str());
|
||||
|
||||
// Set xnack option if needed
|
||||
if (dev().hwInfo()->xnackEnabled_) {
|
||||
codegenOptions.append(" -mxnack");
|
||||
}
|
||||
|
||||
// Set the -O#
|
||||
std::ostringstream optLevel;
|
||||
optLevel << "-O" << options->oVariables->OptLevel;
|
||||
|
||||
@@ -219,6 +219,11 @@ bool LightningProgram::compileImpl(const std::string& sourceCode,
|
||||
driverOptions.append(" -mcpu=");
|
||||
driverOptions.append(dev().deviceInfo().machineTarget_);
|
||||
|
||||
// Set xnack option if needed
|
||||
if (dev().deviceInfo().xnackEnabled_) {
|
||||
driverOptions.append(" -mxnack");
|
||||
}
|
||||
|
||||
driverOptions.append(options->llvmOptions);
|
||||
|
||||
// Set whole program mode
|
||||
|
||||
@@ -22,6 +22,7 @@ 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
|
||||
@@ -44,25 +45,25 @@ 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},
|
||||
32, 0, 0, false},
|
||||
/* TARGET_KAVERI_SPOOKY */ {HSA_SPOOKY_ID, "", "kaveri", "Spooky", 4, 16, 1, 256, 64 * Ki, 32,
|
||||
0, 0},
|
||||
/* TARGET_TONGA */ {HSA_TONGA_ID, "", "tonga", "Tonga", 4, 16, 1, 256, 64 * Ki, 32, 0, 0},
|
||||
0, 0, false},
|
||||
/* TARGET_TONGA */ {HSA_TONGA_ID, "", "tonga", "Tonga", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, false},
|
||||
/* TARGET_CARRIZO */ {HSA_CARRIZO_ID, "", "carrizo", "Carrizo", 4, 16, 1, 256, 64 * Ki, 32, 0,
|
||||
0},
|
||||
0, true},
|
||||
/* TARGET_ICELAND */ {HSA_ICELAND_ID, "", "iceland", "Iceland", 4, 16, 1, 256, 64 * Ki, 32, 0,
|
||||
0},
|
||||
/* TARGET_FIJI */ {HSA_FIJI_ID, "", "fiji", "Fiji", 4, 16, 1, 256, 64 * Ki, 32, 0, 0},
|
||||
/* TARGET HAWAII */ {HSA_HAWAII_ID, "", "hawaii", "Hawaii", 4, 16, 1, 256, 64 * Ki, 32, 0, 0},
|
||||
0, false},
|
||||
/* TARGET_FIJI */ {HSA_FIJI_ID, "", "fiji", "Fiji", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, false},
|
||||
/* TARGET HAWAII */ {HSA_HAWAII_ID, "", "hawaii", "Hawaii", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, false},
|
||||
/* TARGET ELLESMERE */ {HSA_ELLESMERE_ID, "", "polaris10", "Ellesmere", 4, 16, 1, 256, 64 * Ki,
|
||||
32, 0, 0},
|
||||
32, 0, 0, false},
|
||||
/* TARGET BAFFIN */ {HSA_BAFFIN_ID, "", "polaris11", "Baffin", 4, 16, 1, 256, 64 * Ki, 32, 0,
|
||||
0},
|
||||
/* TARGET VEGA10 */ {HSA_VEGA10_ID, "", "gfx900", "gfx900", 4, 16, 1, 256, 64 * Ki, 32, 0, 0},
|
||||
/* TARGET VEGA10_HBCC */ {HSA_VEGA10_HBCC_ID, "", "gfx901", "gfx901", 4, 16, 1, 256, 64 * Ki, 32, 0, 0},
|
||||
/* TARGET RAVEN */ {HSA_RAVEN_ID, "", "gfx902", "gfx902", 4, 16, 1, 256, 64 * Ki, 32, 0, 0},
|
||||
/* TARGET VEGA12 */ {HSA_VEGA12_ID, "", "gfx904", "gfx904", 4, 16, 1, 256, 64 * Ki, 32, 0, 0},
|
||||
/* TARGET VEGA20 */ {HSA_VEGA20_ID, "", "gfx906", "gfx906", 4, 16, 1, 256, 64 * Ki, 32, 0, 0}};
|
||||
0, false},
|
||||
/* TARGET VEGA10 */ {HSA_VEGA10_ID, "", "gfx900", "gfx900", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, false},
|
||||
/* TARGET VEGA10_HBCC */ {HSA_VEGA10_HBCC_ID, "", "gfx901", "gfx901", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, false},
|
||||
/* TARGET RAVEN */ {HSA_RAVEN_ID, "", "gfx902", "gfx902", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, true},
|
||||
/* TARGET VEGA12 */ {HSA_VEGA12_ID, "", "gfx904", "gfx904", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, false},
|
||||
/* TARGET VEGA20 */ {HSA_VEGA20_ID, "", "gfx906", "gfx906", 4, 16, 1, 256, 64 * Ki, 32, 0, 0, false}};
|
||||
}
|
||||
|
||||
const uint kMaxAsyncQueues = 8; // set to match the number of pipes, which is 8
|
||||
|
||||
@@ -592,6 +592,9 @@ 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_) {
|
||||
cacheTarget << "-xnack";
|
||||
}
|
||||
|
||||
amd::CacheCompilation* compObj = new amd::CacheCompilation(
|
||||
cacheTarget.str(), "_rocm", OCL_CODE_CACHE_ENABLE, OCL_CODE_CACHE_RESET);
|
||||
@@ -772,6 +775,10 @@ bool Device::populateOCLDeviceConstants() {
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "gfx" << gfxipMajor << gfxipMinor << gfxipStepping;
|
||||
if (IS_LIGHTNING && deviceInfo_.xnackEnabled_) {
|
||||
oss << "-xnack";
|
||||
}
|
||||
|
||||
::strcpy(info_.name_, oss.str().c_str());
|
||||
|
||||
char device_name[64] = {0};
|
||||
|
||||
@@ -245,7 +245,7 @@ aclType Program::getNextCompilationStageFromBinary(amd::option::Options* options
|
||||
break;
|
||||
}
|
||||
sBinOptions = std::string((char*)opts, symSize);
|
||||
} else
|
||||
} else
|
||||
#endif // defined(WITH_COMPILER_LIB)
|
||||
{
|
||||
sBinOptions = sCurOptions;
|
||||
@@ -1169,6 +1169,11 @@ bool LightningProgram::linkImpl(amd::option::Options* options) {
|
||||
codegenOptions.append(" -mcpu=");
|
||||
codegenOptions.append(dev().deviceInfo().machineTarget_);
|
||||
|
||||
// Set xnack option if needed
|
||||
if (dev().deviceInfo().xnackEnabled_) {
|
||||
codegenOptions.append(" -mxnack");
|
||||
}
|
||||
|
||||
// Set the -O#
|
||||
std::ostringstream optLevel;
|
||||
optLevel << "-O" << options->oVariables->OptLevel;
|
||||
|
||||
Fai riferimento in un nuovo problema
Block a user