SWDEV-311585 - workaround dynamic loading functional issue in Blender

Change-Id: I815724c0bdcb712e40ec1ed11b9632fab7243f69


[ROCm/clr commit: d1a491b30b]
Bu işleme şunda yer alıyor:
haoyuan2
2021-12-10 11:48:00 -08:00
ebeveyn 9735c1b617
işleme 86520ebd83
3 değiştirilmiş dosya ile 52 ekleme ve 42 silme
+42 -36
Dosyayı Görüntüle
@@ -37,17 +37,19 @@ amd::HostQueue* Device::NullStream(bool skip_alloc) {
}
hipError_t hipDeviceGet(hipDevice_t *device, int deviceId) {
HIP_INIT_API(hipDeviceGet, device, deviceId);
if (deviceId < 0 ||
static_cast<size_t>(deviceId) >= g_devices.size() ||
device == nullptr) {
HIP_RETURN(hipErrorInvalidDevice);
hipError_t ihipDeviceGet(hipDevice_t* device, int deviceId) {
if (deviceId < 0 || static_cast<size_t>(deviceId) >= g_devices.size() || device == nullptr) {
return hipErrorInvalidDevice;
}
*device = deviceId;
HIP_RETURN(hipSuccess);
};
return hipSuccess;
}
hipError_t hipDeviceGet(hipDevice_t* device, int deviceId) {
HIP_INIT_API(hipDeviceGet, device, deviceId);
HIP_RETURN(ihipDeviceGet(device, deviceId));
}
hipError_t hipDeviceTotalMem (size_t *bytes, hipDevice_t device) {
@@ -137,15 +139,13 @@ hipError_t hipDeviceGetName(char *name, int len, hipDevice_t device) {
HIP_RETURN(hipSuccess);
}
hipError_t hipGetDeviceProperties ( hipDeviceProp_t* props, hipDevice_t device ) {
HIP_INIT_API(hipGetDeviceProperties, props, device);
hipError_t ihipGetDeviceProperties(hipDeviceProp_t* props, hipDevice_t device) {
if (props == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
return hipErrorInvalidValue;
}
if (unsigned(device) >= g_devices.size()) {
HIP_RETURN(hipErrorInvalidDevice);
return hipErrorInvalidDevice;
}
auto* deviceHandle = g_devices[device]->devices()[0];
@@ -176,30 +176,30 @@ hipError_t hipGetDeviceProperties ( hipDeviceProp_t* props, hipDevice_t device )
deviceProps.maxThreadsPerMultiProcessor = info.maxThreadsPerCU_;
deviceProps.computeMode = 0;
deviceProps.clockInstructionRate = info.timeStampFrequency_;
deviceProps.arch.hasGlobalInt32Atomics = 1;
deviceProps.arch.hasGlobalFloatAtomicExch = 1;
deviceProps.arch.hasSharedInt32Atomics = 1;
deviceProps.arch.hasSharedFloatAtomicExch = 1;
deviceProps.arch.hasFloatAtomicAdd = 1;
deviceProps.arch.hasGlobalInt64Atomics = 1;
deviceProps.arch.hasSharedInt64Atomics = 1;
deviceProps.arch.hasDoubles = 1;
deviceProps.arch.hasWarpVote = 1;
deviceProps.arch.hasWarpBallot = 1;
deviceProps.arch.hasWarpShuffle = 1;
deviceProps.arch.hasFunnelShift = 0;
deviceProps.arch.hasThreadFenceSystem = 1;
deviceProps.arch.hasSyncThreadsExt = 0;
deviceProps.arch.hasSurfaceFuncs = 0;
deviceProps.arch.has3dGrid = 1;
deviceProps.arch.hasDynamicParallelism = 0;
deviceProps.arch.hasGlobalInt32Atomics = 1;
deviceProps.arch.hasGlobalFloatAtomicExch = 1;
deviceProps.arch.hasSharedInt32Atomics = 1;
deviceProps.arch.hasSharedFloatAtomicExch = 1;
deviceProps.arch.hasFloatAtomicAdd = 1;
deviceProps.arch.hasGlobalInt64Atomics = 1;
deviceProps.arch.hasSharedInt64Atomics = 1;
deviceProps.arch.hasDoubles = 1;
deviceProps.arch.hasWarpVote = 1;
deviceProps.arch.hasWarpBallot = 1;
deviceProps.arch.hasWarpShuffle = 1;
deviceProps.arch.hasFunnelShift = 0;
deviceProps.arch.hasThreadFenceSystem = 1;
deviceProps.arch.hasSyncThreadsExt = 0;
deviceProps.arch.hasSurfaceFuncs = 0;
deviceProps.arch.has3dGrid = 1;
deviceProps.arch.hasDynamicParallelism = 0;
deviceProps.concurrentKernels = 1;
deviceProps.pciDomainID = info.pciDomainID;
deviceProps.pciBusID = info.deviceTopology_.pcie.bus;
deviceProps.pciDeviceID = info.deviceTopology_.pcie.device;
deviceProps.maxSharedMemoryPerMultiProcessor = info.localMemSizePerCU_;
deviceProps.canMapHostMemory = 1;
//FIXME: This should be removed, targets can have character names as well.
// FIXME: This should be removed, targets can have character names as well.
deviceProps.gcnArch = isa.versionMajor() * 100 + isa.versionMinor() * 10 + isa.versionStepping();
sprintf(deviceProps.gcnArchName, "%s", isa.targetId());
deviceProps.cooperativeLaunch = info.cooperativeGroups_;
@@ -210,7 +210,7 @@ hipError_t hipGetDeviceProperties ( hipDeviceProp_t* props, hipDevice_t device )
deviceProps.cooperativeMultiDeviceUnmatchedBlockDim = info.cooperativeMultiDeviceGroups_;
deviceProps.cooperativeMultiDeviceUnmatchedSharedMem = info.cooperativeMultiDeviceGroups_;
deviceProps.maxTexture1DLinear = 16 * info.imageMaxBufferSize_; // Max pixel size is 16 bytes
deviceProps.maxTexture1DLinear = 16 * info.imageMaxBufferSize_; // Max pixel size is 16 bytes
deviceProps.maxTexture1D = info.image1DMaxWidth_;
deviceProps.maxTexture2D[0] = info.image2DMaxWidth_;
deviceProps.maxTexture2D[1] = info.image2DMaxHeight_;
@@ -224,17 +224,23 @@ hipError_t hipGetDeviceProperties ( hipDeviceProp_t* props, hipDevice_t device )
deviceProps.textureAlignment = info.imageBaseAddressAlignment_;
deviceProps.texturePitchAlignment = info.imagePitchAlignment_;
deviceProps.kernelExecTimeoutEnabled = 0;
deviceProps.ECCEnabled = info.errorCorrectionSupport_? 1:0;
deviceProps.ECCEnabled = info.errorCorrectionSupport_ ? 1 : 0;
deviceProps.isLargeBar = info.largeBar_ ? 1 : 0;
deviceProps.asicRevision = info.asicRevision_;
// HMM capabilities
deviceProps.managedMemory = info.hmmSupported_;
deviceProps.concurrentManagedAccess = info.hmmSupported_;
deviceProps.concurrentManagedAccess = info.hmmSupported_;
deviceProps.directManagedMemAccessFromHost = info.hmmDirectHostAccess_;
deviceProps.pageableMemoryAccess = info.hmmCpuMemoryAccessible_;
deviceProps.pageableMemoryAccessUsesHostPageTables = info.hostUnifiedMemory_;
*props = deviceProps;
HIP_RETURN(hipSuccess);
return hipSuccess;
}
hipError_t hipGetDeviceProperties(hipDeviceProp_t* props, hipDevice_t device) {
HIP_INIT_API(hipGetDeviceProperties, props, device);
HIP_RETURN(ihipGetDeviceProperties(props, device));
}
+6 -6
Dosyayı Görüntüle
@@ -39,7 +39,7 @@ hipError_t hipChooseDevice(int* device, const hipDeviceProp_t* properties) {
hipDeviceProp_t currentProp = {0};
cl_uint validPropCount = 0;
cl_uint matchedCount = 0;
hipError_t err = hipGetDeviceProperties(&currentProp, i);
hipError_t err = ihipGetDeviceProperties(&currentProp, i);
if (properties->major != 0) {
validPropCount++;
if(currentProp.major >= properties->major) {
@@ -152,7 +152,7 @@ hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int device)
//FIXME: should we cache the props, or just select from deviceHandle->info_?
hipDeviceProp_t prop = {0};
hipError_t err = hipGetDeviceProperties(&prop, device);
hipError_t err = ihipGetDeviceProperties(&prop, device);
if (err != hipSuccess) {
HIP_RETURN(err);
}
@@ -345,9 +345,9 @@ hipError_t hipDeviceGetByPCIBusId(int* device, const char*pciBusIdstr) {
ihipDeviceGetCount(&count);
for (cl_int i = 0; i < count; i++) {
hipDevice_t dev;
hipDeviceGet(&dev, i);
ihipDeviceGet(&dev, i);
hipDeviceProp_t prop;
hipGetDeviceProperties(&prop, dev);
ihipGetDeviceProperties(&prop, dev);
if ((pciBusID == prop.pciBusID) && (pciDomainID == prop.pciDomainID)
&& (pciDeviceID == prop.pciDeviceID)) {
@@ -385,7 +385,7 @@ hipError_t hipDeviceGetLimit ( size_t* pValue, hipLimit_t limit ) {
}
if(limit == hipLimitMallocHeapSize) {
hipDeviceProp_t prop;
hipGetDeviceProperties(&prop, ihipGetDevice());
ihipGetDeviceProperties(&prop, ihipGetDevice());
*pValue = prop.totalGlobalMem;
HIP_RETURN(hipSuccess);
@@ -409,7 +409,7 @@ hipError_t hipDeviceGetPCIBusId ( char* pciBusId, int len, int device ) {
}
hipDeviceProp_t prop;
hipGetDeviceProperties(&prop, device);
ihipGetDeviceProperties(&prop, device);
snprintf (pciBusId, len, "%04x:%02x:%02x.0",
prop.pciDomainID,
+4
Dosyayı Görüntüle
@@ -434,6 +434,10 @@ extern amd::Memory* getMemoryObjectWithOffset(const void* ptr, const size_t size
extern void getStreamPerThread(hipStream_t& stream);
extern hipError_t ihipUnbindTexture(textureReference* texRef);
extern hipError_t ihipGetDeviceProperties(hipDeviceProp_t* props, hipDevice_t device);
extern hipError_t ihipDeviceGet(hipDevice_t* device, int deviceId);
constexpr bool kOptionChangeable = true;
constexpr bool kNewDevProg = false;