P4 to Git Change 1079952 by yaxunl@yaxunl_stg_win50 on 2014/09/23 12:31:16

ECR #377625 - Workaround for Blender performance issue. Lower available VGPRs to improve waves per CU.

	Added BuildOptsAppend to OCL app profile.
	Read BuildOptsAppend and append to build options.
	Added specific wave optimization option for Blender.

Affected files ...

... //depot/stg/opencl/drivers/opencl/appprofiles/oclappprofile.xml#7 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/scwrapper/SI/scCompileSI.cpp#45 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/OPTIONS.def#116 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/appprofile.cpp#10 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/appprofile.hpp#8 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.cpp#170 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#230 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuappprofile.cpp#10 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuappprofile.hpp#6 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/program.cpp#63 edit
This commit is contained in:
foreman
2014-09-23 12:44:50 -04:00
parent 5ef908c5e7
commit 16f8ca9aae
8 changed files with 119 additions and 76 deletions
+70
View File
@@ -6,6 +6,7 @@
#include "os/os.hpp"
#include "utils/flags.hpp"
#include "appprofile.hpp"
#include <cstdlib>
static void* __stdcall adlMallocCallback(int n)
{
@@ -91,6 +92,8 @@ AppProfile::AppProfile(): hsaDeviceHint_(0),
profileOverridesAllSettings_(false)
{
appFileName_ = amd::Os::getAppFileName();
propertyDataMap_.insert(DataMap::value_type("BuildOptsAppend",
PropertyData(DataType_String, &buildOptsAppend_)));
}
AppProfile::~AppProfile()
@@ -146,4 +149,71 @@ cl_device_type AppProfile::ApplyHsaDeviceHintFlag(const cl_device_type& type)
return type;
}
bool AppProfile::ParseApplicationProfile()
{
amd::ADL* adl = new amd::ADL;
if ((adl == NULL) || !adl->init()) {
delete adl;
return false;
}
ADLApplicationProfile* pProfile = NULL;
// Apply blb configurations
int result = adl->adl2ApplicationProfilesProfileOfApplicationx2Search(
adl->adlContext(), wsAppFileName_.c_str(), NULL, NULL,
L"OCL", &pProfile);
delete adl;
if (pProfile == NULL) {
return false;
}
PropertyRecord* firstProperty = pProfile->record;
uint32_t valueOffset = 0;
const int BUFSIZE = 1024;
wchar_t wbuffer[BUFSIZE];
char buffer[2 * BUFSIZE];
for (int index = 0; index < pProfile->iCount; index++) {
PropertyRecord* profileProperty = reinterpret_cast<PropertyRecord*>
((reinterpret_cast<char*>(firstProperty)) + valueOffset);
// Get property name
char* propertyName = profileProperty->strName;
auto entry = propertyDataMap_.find(std::string(propertyName));
if (entry == propertyDataMap_.end()) {
// unexpected name
valueOffset += (sizeof(PropertyRecord) + profileProperty->iDataSize - 4);
continue;
}
// Get the property value
switch (entry->second.type_) {
case DataType_Boolean:
*(reinterpret_cast<bool*>(entry->second.data_)) =
profileProperty->uData[0] ? true : false;
break;
case DataType_String: {
assert((size_t)(profileProperty->iDataSize) < sizeof(wbuffer) - 2 &&
"app profile string too long");
memcpy(wbuffer, profileProperty->uData, profileProperty->iDataSize);
wbuffer[profileProperty->iDataSize / 2] = L'\0';
size_t len = wcstombs(buffer, wbuffer, sizeof(buffer));
assert(len < sizeof(buffer) - 1 && "app profile string too long");
*(reinterpret_cast<std::string*>(entry->second.data_)) = buffer;
break;
}
default:
break;
}
valueOffset += (sizeof(PropertyRecord) + profileProperty->iDataSize - 4);
}
free(pProfile);
return true;
}
}