SWDEV-280473 - Support HSAIL shared library build

This change makes HSAIL usage similar to that of Comgr. By default, the
runtime will statically link against it, however if HSAIL_DYN_DLL is
defined, then the runtime will try to dynamically load HSAIL.

Currently stick to statically linking to HSAIL. In a feature patch the
dynamic loading behaviour will be enabled.

Change-Id: I6a78a4375975cf847f236b200404c8cf941d012b


[ROCm/clr commit: c7b50bb890]
Tento commit je obsažen v:
Vladislav Sytchenko
2021-04-13 11:36:32 -04:00
rodič ba2d6da261
revize c585ae92a7
19 změnil soubory, kde provedl 662 přidání a 214 odebrání
+15 -5
Zobrazit soubor
@@ -35,7 +35,7 @@
#include "device/gpu/gpublit.hpp"
#include "cz_id.h"
#include "acl.h"
#include "hsailctx.hpp"
#include "vdi_common.hpp"
#include "CL/cl_gl.h"
@@ -256,6 +256,11 @@ bool NullDevice::create(const char* calName, const amd::Isa& isa, CALtarget targ
return false;
}
if (!ValidateHsail()) {
LogPrintfError("HSAIL initialization failed for offline CAL device %s", isa.targetId());
return false;
}
gslMemInfo memInfo = {0};
// Report 512MB for all offline devices
memInfo.cardMemAvailableBytes = 512 * Mi;
@@ -274,7 +279,7 @@ bool NullDevice::create(const char* calName, const amd::Isa& isa, CALtarget targ
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);
hsaCompiler_ = amd::Hsail::CompilerInit(&opts, &error);
if (error != ACL_SUCCESS) {
LogPrintfError("Error initializing the compiler for offline CAL device %s", isa.targetId());
return false;
@@ -945,6 +950,11 @@ bool Device::create(CALuint ordinal, CALuint numOfDevices) {
return false;
}
if (!ValidateHsail()) {
LogError("Hsail initialization failed!");
return false;
}
engines_.create(m_nEngines, m_engines, settings().numComputeRings_);
amd::Context::Info info = {0};
@@ -1022,7 +1032,7 @@ bool Device::create(CALuint ordinal, CALuint numOfDevices) {
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);
hsaCompiler_ = amd::Hsail::CompilerInit(&opts, &error);
if (error != ACL_SUCCESS) {
LogError("Error initializing the compiler");
return false;
@@ -1271,9 +1281,9 @@ bool Device::init() {
void Device::tearDown() {
osExit();
gslExit();
aclCompilerFini(compiler_);
amd::Hsail::CompilerFini(compiler_);
if (hsaCompiler_ != NULL) {
aclCompilerFini(hsaCompiler_);
amd::Hsail::CompilerFini(hsaCompiler_);
}
}