2
0

SWDEV-277559 - Remove AMDIL

The rest of AMDIL support will be removed along with orca backend.

Change-Id: I0462501e7147dc4b99870fd02034d0a4a0496e55
Este cometimento está contido em:
Jason Tang
2021-03-24 12:23:48 -04:00
cometido por Jason Tang
ascendente 9307ab43e4
cometimento 1a38be8972
12 ficheiros modificados com 116 adições e 294 eliminações
+4 -4
Ver ficheiro
@@ -66,7 +66,7 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
if (platform == amd::Elf::COMPLIB_PLATFORM) {
// BIF 3.0
uint32_t flag;
aclTargetInfo tgtInfo = aclGetTargetInfo("amdil", dev().isa().amdIlName(), NULL);
aclTargetInfo tgtInfo = aclGetTargetInfo("amdil", nullptr, NULL);
if (!elfIn()->getFlags(flag)) {
LogError("The OCL binary image loading failed: incorrect format");
return false;
@@ -241,7 +241,7 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
} else if (!elfsymbol->IsKernel) {
// Not a kernel. Add its metadata to the OCL binary in case recompilation happens
// and the new binary is needed.
if (saveAMDIL() && (elfsymbol->SymInfo[NDX_METADATA].size > 0)) {
if (false && (elfsymbol->SymInfo[NDX_METADATA].size > 0)) {
std::string fmetadata = "__OpenCL_";
fmetadata.append(it.first);
fmetadata.append("_fmetadata");
@@ -371,14 +371,14 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
bool ClBinary::storeKernel(const std::string& name, const NullKernel* nullKernel,
Kernel::InitData* initData, const std::string& metadata,
const std::string& ilSource) {
if (!saveISA() && !saveAMDIL()) {
if (!saveISA()) {
return true;
}
// should we save kernel metadata only under saveAMDIL()?
bool kernelMetaStored = false;
if (saveAMDIL() && (ilSource.size() > 0)) {
if (false && (ilSource.size() > 0)) {
// Save IL (this is the per-kernel IL)
std::string ilName = "__OpenCL_" + name + "_amdil";
if (!elfOut()->addSymbol(amd::Elf::ILTEXT, ilName.c_str(), ilSource.data(),
+27 -103
Ver ficheiro
@@ -77,11 +77,6 @@ struct CalDevice {
static constexpr CalDevice supportedCalDevices[] = {
// Prefer - NullDevice -
// GFX Version GSL Machine CAL Name CAL Target PAL double OCL200
{6, 0, 0, ED_ATI_CAL_MACHINE_TAHITI_ISA, "Tahiti", CAL_TARGET_TAHITI, false, true, false},
{6, 0, 1, ED_ATI_CAL_MACHINE_PITCAIRN_ISA, "Pitcairn", CAL_TARGET_PITCAIRN, false, true, false},
{6, 0, 1, ED_ATI_CAL_MACHINE_CAPEVERDE_ISA, "Capeverde", CAL_TARGET_CAPEVERDE, false, true, false},
{6, 0, 2, ED_ATI_CAL_MACHINE_OLAND_ISA, "Oland", CAL_TARGET_OLAND, false, true, false},
{6, 0, 2, ED_ATI_CAL_MACHINE_HAINAN_ISA, "Hainan", CAL_TARGET_HAINAN, false, true, false},
{7, 0, 0, ED_ATI_CAL_MACHINE_KALINDI_ISA, "Kalindi", CAL_TARGET_KALINDI, false, true, true },
{7, 0, 0, ED_ATI_CAL_MACHINE_SPECTRE_ISA, "Spectre", CAL_TARGET_SPECTRE, false, true, true },
{7, 0, 0, ED_ATI_CAL_MACHINE_SPOOKY_ISA, "Spooky", CAL_TARGET_SPOOKY, false, true, true },
@@ -270,45 +265,19 @@ bool NullDevice::create(const char* calName, const amd::Isa& isa, CALtarget targ
// Fill the device info structure
fillDeviceInfo(calAttr, memInfo, 4096, 1, 0);
if (NULL == compiler_) {
#if !defined(ATI_OS_LINUX)
char CompilerLibrary[220] = "";
strcat_s(CompilerLibrary, "amdocl12cl" LP64_SWITCH("", "64") ".dll");
#endif
const char* library = getenv("COMPILER_LIBRARY");
// Runtime doesn't know what local size could be on the real board
info_.maxGlobalVariableSize_ = static_cast<size_t>(512 * Mi);
if (NULL == hsaCompiler_) {
const char* library = getenv("HSA_COMPILER_LIBRARY");
aclCompilerOptions opts = {
sizeof(aclCompilerOptions_0_8),
#if defined(ATI_OS_LINUX)
library ? library : LINUX_ONLY("lib") "amdocl12cl" LP64_SWITCH(LINUX_SWITCH("32", ""), "64")
LINUX_SWITCH(".so", ".dll"),
#else
library ? library : CompilerLibrary,
#endif
NULL,
NULL,
NULL,
NULL,
NULL,
AMD_OCL_SC_LIB
};
compiler_ = aclCompilerInit(&opts, NULL);
}
if (settings().hsail_ || (settings().oclVersion_ >= OpenCL20)) {
// Runtime doesn't know what local size could be on the real board
info_.maxGlobalVariableSize_ = static_cast<size_t>(512 * Mi);
if (NULL == hsaCompiler_) {
const char* library = getenv("HSA_COMPILER_LIBRARY");
aclCompilerOptions opts = {
sizeof(aclCompilerOptions_0_8), library, NULL, NULL, NULL, NULL, NULL, AMD_OCL_SC_LIB};
// Initialize the compiler handle
acl_error error;
hsaCompiler_ = aclCompilerInit(&opts, &error);
if (error != ACL_SUCCESS) {
LogPrintfError("Error initializing the compiler for offline CAL device %s", isa.targetId());
return false;
}
sizeof(aclCompilerOptions_0_8), library, NULL, NULL, NULL, NULL, NULL, AMD_OCL_SC_LIB};
// Initialize the compiler handle
acl_error error;
hsaCompiler_ = aclCompilerInit(&opts, &error);
if (error != ACL_SUCCESS) {
LogPrintfError("Error initializing the compiler for offline CAL device %s", isa.targetId());
return false;
}
}
@@ -317,7 +286,6 @@ bool NullDevice::create(const char* calName, const amd::Isa& isa, CALtarget targ
bool NullDevice::isHsailProgram(amd::option::Options* options) {
bool isCIPlus = settings().ciPlus_;
bool isHSAILcapable = settings().hsail_;
bool isBlit = false;
bool isSPIRV = false;
bool isClang = false;
@@ -369,10 +337,10 @@ bool NullDevice::isHsailProgram(amd::option::Options* options) {
}
isInputOptions = false;
}
if (isSPIRV || (isBlit && isCIPlus && isHSAILcapable) || isClang || isOCL20) {
if (isSPIRV || (isBlit && isCIPlus) || isClang || isOCL20) {
return true;
}
if (isLegacy || !isHSAILcapable || isEDG) {
if (isLegacy || isEDG) {
return false;
}
return true;
@@ -1048,51 +1016,15 @@ bool Device::create(CALuint ordinal, CALuint numOfDevices) {
fillDeviceInfo(getAttribs(), getMemInfo(), static_cast<size_t>(getMaxTextureSize()),
engines().numComputeRings(), engines().numComputeRingsRT());
if (NULL == compiler_) {
#if !defined(ATI_OS_LINUX)
char CompilerLibrary[220] = "";
strcat_s(CompilerLibrary, "amdocl12cl" LP64_SWITCH("", "64") ".dll");
#endif
const char* library = getenv("COMPILER_LIBRARY");
if (NULL == hsaCompiler_) {
const char* library = getenv("HSA_COMPILER_LIBRARY");
aclCompilerOptions opts = {
sizeof(aclCompilerOptions_0_8),
#if defined(ATI_OS_LINUX)
library ? library : LINUX_ONLY("lib") "amdocl12cl" LP64_SWITCH(LINUX_SWITCH("32", ""), "64")
LINUX_SWITCH(".so", ".dll"),
#else
library ? library : CompilerLibrary,
#endif
NULL,
NULL,
NULL,
NULL,
NULL,
AMD_OCL_SC_LIB
};
compiler_ = aclCompilerInit(&opts, NULL);
}
if (settings().hsail_ || (settings().oclVersion_ >= OpenCL20)) {
if (NULL == hsaCompiler_) {
const char* library = getenv("HSA_COMPILER_LIBRARY");
aclCompilerOptions opts = {
sizeof(aclCompilerOptions_0_8), library, NULL, NULL, NULL, NULL, NULL, AMD_OCL_SC_LIB};
// Initialize the compiler handle
acl_error error;
hsaCompiler_ = aclCompilerInit(&opts, &error);
if (error != ACL_SUCCESS) {
LogError("Error initializing the compiler");
return false;
}
}
} else {
blitProgram_ = new BlitProgram(context_);
// Create blit programs
if (blitProgram_ == NULL || !blitProgram_->create(this)) {
delete blitProgram_;
blitProgram_ = NULL;
LogError("Couldn't create blit kernels!");
sizeof(aclCompilerOptions_0_8), library, NULL, NULL, NULL, NULL, NULL, AMD_OCL_SC_LIB};
// Initialize the compiler handle
acl_error error;
hsaCompiler_ = aclCompilerInit(&opts, &error);
if (error != ACL_SUCCESS) {
LogError("Error initializing the compiler");
return false;
}
}
@@ -1694,20 +1626,12 @@ device::Memory* Device::createMemory(amd::Memory& owner) const {
bool Device::createSampler(const amd::Sampler& owner, device::Sampler** sampler) const {
*sampler = NULL;
if (settings().hsail_ || (settings().oclVersion_ >= OpenCL20)) {
Sampler* gpuSampler = new Sampler(*this);
if ((NULL == gpuSampler) || !gpuSampler->create(owner)) {
delete gpuSampler;
return false;
}
*sampler = gpuSampler;
} else {
//! Currently allocate the base device class for AMDIL path
*sampler = new device::Sampler();
if (*sampler == nullptr) {
return false;
}
Sampler* gpuSampler = new Sampler(*this);
if ((NULL == gpuSampler) || !gpuSampler->create(owner)) {
delete gpuSampler;
return false;
}
*sampler = gpuSampler;
return true;
}
+1 -1
Ver ficheiro
@@ -644,7 +644,7 @@ bool NullKernel::create(const std::string& code, const std::string& metadata,
if ((binaryCode == NULL) && (binarySize == 0) && !code.empty()) {
acl_error err;
aclTargetInfo info = aclGetTargetInfo(nullDev().settings().use64BitPtr_ ? "amdil64" : "amdil",
nullDev().isa().amdIlName(), &err);
nullptr, &err);
if (err != ACL_SUCCESS) {
LogWarning("aclGetTargetInfo failed");
return false;
+1 -45
Ver ficheiro
@@ -44,7 +44,7 @@ namespace gpu {
const aclTargetInfo& NullProgram::info() {
acl_error err;
info_ = aclGetTargetInfo(gpuNullDevice().settings().use64BitPtr_ ? "amdil64" : "amdil",
device().isa().amdIlName(), &err);
nullptr, &err);
if (err != ACL_SUCCESS) {
LogWarning("aclGetTargetInfo failed");
}
@@ -392,28 +392,6 @@ bool NullProgram::linkImpl(amd::option::Options* options) {
buildLog_ += "Internal error: adding a kernel into OpenCL binary failed!\n";
return false;
}
} else {
// Non-kernel function, save metadata symbols for recompilation
if (clBinary()->saveAMDIL()) {
size_t metadataSize = baseFunc->metadata_.end_ - baseFunc->metadata_.begin_;
if (metadataSize <= 0) {
continue;
}
std::string metadataStr;
// Get the metadata string
metadataStr.insert(0, ilProgram_, baseFunc->metadata_.begin_, metadataSize);
std::stringstream aStream;
aStream << "__OpenCL_" << baseFunc->name_ << "_fmetadata";
std::string metaName = aStream.str();
// Save metadata symbols in .rodata
if (!clBinary()->elfOut()->addSymbol(amd::Elf::RODATA, metaName.c_str(),
metadataStr.data(), metadataStr.size())) {
buildLog_ += "Internal error: addSymbol failed!\n";
LogError("AddSymbol failed");
return false;
}
}
}
}
@@ -755,28 +733,6 @@ bool NullProgram::linkImpl(const std::vector<device::Program*>& inputPrograms,
buildLog_ += "Internal error: adding a kernel into OpenCL binary failed!\n";
return false;
}
} else {
// Non-kernel function, save metadata symbols for recompilation
if (clBinary()->saveAMDIL()) {
size_t metadataSize = baseFunc->metadata_.end_ - baseFunc->metadata_.begin_;
if (metadataSize <= 0) {
continue;
}
std::string metadataStr;
// Get the metadata string
metadataStr.insert(0, ilProgram_, baseFunc->metadata_.begin_, metadataSize);
std::stringstream aStream;
aStream << "__OpenCL_" << baseFunc->name_ << "_fmetadata";
std::string metaName = aStream.str();
// Save metadata symbols in .rodata
if (!clBinary()->elfOut()->addSymbol(amd::Elf::RODATA, metaName.c_str(),
metadataStr.data(), metadataStr.size())) {
buildLog_ += "Internal error: addSymbol failed!\n";
LogError("AddSymbol failed");
return false;
}
}
}
}
+3 -7
Ver ficheiro
@@ -470,11 +470,7 @@ bool Resource::create(MemoryType memType, CreateParams* params) {
// Check resource cache first for an appropriate resource
gslRef_ = dev().resourceCache().findCalResource(&cal_);
if (memType == Scratch) {
if ((dev().settings().hsail_) || (dev().settings().oclVersion_ >= OpenCL20)) {
desc.minAlignment = 64 * Ki;
} else {
desc.vaBase = static_cast<mcaddr>(0x100000000ULL);
}
desc.minAlignment = 64 * Ki;
} else if ((gslRef_ != NULL) && (!dev().settings().use64BitPtr_)) {
// Make sure runtime didn't pick a resource with > 4GB address
if ((cal()->dimension_ == GSL_MOA_BUFFER) &&
@@ -947,7 +943,7 @@ bool Resource::create(MemoryType memType, CreateParams* params) {
}
}
if ((dev().settings().hsail_ || (dev().settings().oclVersion_ >= OpenCL20)) && !cal()->buffer_) {
if (!cal()->buffer_) {
hwSrd_ = dev().srds().allocSrdSlot(reinterpret_cast<address*>(&hwState_));
if (0 == hwSrd_) {
return false;
@@ -1055,7 +1051,7 @@ void Resource::free() {
}
// Free SRD for images
if ((dev().settings().hsail_ || (dev().settings().oclVersion_ >= OpenCL20)) && !cal()->buffer_) {
if (!cal()->buffer_) {
dev().srds().freeSrdSlot(hwSrd_);
}
}
+2 -13
Ver ficheiro
@@ -136,9 +136,6 @@ Settings::Settings() {
numDeviceEvents_ = 1024;
numWaitEvents_ = 8;
// Disable HSAIL by default
hsail_ = false;
// Don't support platform atomics by default.
svmAtomics_ = false;
@@ -229,19 +226,11 @@ bool Settings::create(const CALdeviceattribs& calAttr, bool reportAsOCL12Device,
case CAL_TARGET_HAWAII:
ciPlus_ = true;
sdmaProfiling_ = true;
hsail_ = GPU_HSAIL_ENABLE;
threadTraceEnable_ = AMD_THREAD_TRACE_ENABLE;
// Fall through to SI ...
case CAL_TARGET_PITCAIRN:
case CAL_TARGET_CAPEVERDE:
case CAL_TARGET_OLAND:
case CAL_TARGET_HAINAN:
reportFMAF_ = false;
if (target == CAL_TARGET_HAWAII) {
reportFMAF_ = true;
}
// Fall through ...
case CAL_TARGET_TAHITI:
// Cache line size is 64 bytes
cacheLineSize_ = 64;
// L1 cache size is 16KB
@@ -282,10 +271,10 @@ bool Settings::create(const CALdeviceattribs& calAttr, bool reportAsOCL12Device,
// This needs to be cleaned once 64bit addressing is stable
if (oclVersion_ < OpenCL20) {
use64BitPtr_ = flagIsDefault(GPU_FORCE_64BIT_PTR)
? LP64_SWITCH(false, calAttr.isWorkstation || hsail_)
? LP64_SWITCH(false, true)
: GPU_FORCE_64BIT_PTR;
} else {
if (GPU_FORCE_64BIT_PTR || LP64_SWITCH(false, (hsail_ || (oclVersion_ >= OpenCL20)))) {
if (GPU_FORCE_64BIT_PTR || LP64_SWITCH(false, true)) {
use64BitPtr_ = true;
}
}
-1
Ver ficheiro
@@ -73,7 +73,6 @@ class Settings : public device::Settings {
uint linearPersistentImage_ : 1; //!< Allocates linear images in persistent
uint useSingleScratch_ : 1; //!< Allocates single scratch per device
uint sdmaProfiling_ : 1; //!< Enables SDMA profiling
uint hsail_ : 1; //!< Enables HSAIL compilation
uint svmAtomics_ : 1; //!< SVM device atomics
uint svmFineGrainSystem_ : 1; //!< SVM fine grain system support
uint useDeviceQueue_ : 1; //!< Submit to separate device queue