From dc82afd21c68341a8a782a3a7fbae79e3c2d0e02 Mon Sep 17 00:00:00 2001
From: foreman
Date: Fri, 13 Nov 2015 19:47:56 -0500
Subject: [PATCH] P4 to Git Change 1211287 by xcui@merged_opencl_jxcwin on
2015/11/13 19:19:52
SWDEV-77172 - temporary disable the FGS optimization for a failure on stg.
code review:
http://ocltc.amd.com/reviews/r/8992/
precheckin:
http://ocltc.amd.com:8111/viewModification.html?modId=62238&personal=true&buildTypeId=&tab=vcsModificationBuilds&show_all_builds=true
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#263 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#537 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#156 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#310 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#391 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/context.cpp#37 edit
[ROCm/clr commit: 768a8e7e78db54bad1732fa93217c9654fd94789]
---
projects/clr/rocclr/runtime/device/device.hpp | 4 ++--
projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp | 4 +---
projects/clr/rocclr/runtime/device/gpu/gpudevice.hpp | 1 -
projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp | 2 +-
projects/clr/rocclr/runtime/device/gpu/gpuvirtual.cpp | 2 +-
projects/clr/rocclr/runtime/platform/context.cpp | 4 ++--
6 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/projects/clr/rocclr/runtime/device/device.hpp b/projects/clr/rocclr/runtime/device/device.hpp
index db4fdd2229..8eb1469a3b 100644
--- a/projects/clr/rocclr/runtime/device/device.hpp
+++ b/projects/clr/rocclr/runtime/device/device.hpp
@@ -1572,8 +1572,8 @@ public:
}
//! check svm FGS support capability.
- inline bool isFineGrainedSystem() const {
- return (info().svmCapabilities_ & CL_DEVICE_SVM_FINE_GRAIN_SYSTEM) != 0 ? true : false;
+ inline bool isFineGrainedSystem(bool FGSOPT = false) const {
+ return FGSOPT && (info().svmCapabilities_ & CL_DEVICE_SVM_FINE_GRAIN_SYSTEM) != 0 ? true : false;
}
//! Return this device's type.
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
index 0e76778d7b..1caa33381c 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpudevice.cpp
@@ -2254,10 +2254,8 @@ Device::svmAlloc(amd::Context& context, size_t size, size_t alignment, cl_svm_me
size = amd::alignUp(size, alignment);
amd::Memory* mem = NULL;
- freeCPUMem_ = false;
if (NULL == svmPtr) {
if (isFineGrainedSystem()) {
- freeCPUMem_ = true;
return amd::Os::alignedMalloc(size, alignment);
}
@@ -2301,7 +2299,7 @@ Device::svmAlloc(amd::Context& context, size_t size, size_t alignment, cl_svm_me
void
Device::svmFree(void *ptr) const
{
- if (freeCPUMem_) {
+ if (isFineGrainedSystem()) {
amd::Os::alignedFree(ptr);
}
else {
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpudevice.hpp b/projects/clr/rocclr/runtime/device/gpu/gpudevice.hpp
index 5653973eb4..987b9f0279 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpudevice.hpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpudevice.hpp
@@ -630,7 +630,6 @@ private:
SrdManager* srdManager_; //!< SRD manager object
static AppProfile appProfile_; //!< application profile
- mutable bool freeCPUMem_; //!< flag to mark GPU free SVM CPU mem
};
/*@}*/} // namespace gpu
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp b/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp
index 20d4a66ab4..c0e2f9fc2e 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp
@@ -3803,7 +3803,7 @@ HSAILKernel::loadArguments(
}
// If finegrainsystem is present then the pointer can be malloced by the app and
// passed to kernel directly. If so copy the pointer location to aqlArgBuf
- else if (dev().isFineGrainedSystem()) {
+ else if (dev().isFineGrainedSystem(true)) {
return NULL;
}
break;
diff --git a/projects/clr/rocclr/runtime/device/gpu/gpuvirtual.cpp b/projects/clr/rocclr/runtime/device/gpu/gpuvirtual.cpp
index 680eee3404..cbae8f0814 100644
--- a/projects/clr/rocclr/runtime/device/gpu/gpuvirtual.cpp
+++ b/projects/clr/rocclr/runtime/device/gpu/gpuvirtual.cpp
@@ -3195,7 +3195,7 @@ VirtualGPU::processMemObjectsHSA(
// so we can avoid checks of the aliased objects
memoryDependency().newKernel();
- bool deviceSupportFGS = 0 != dev().isFineGrainedSystem();
+ bool deviceSupportFGS = 0 != dev().isFineGrainedSystem(true);
bool supportFineGrainedSystem = deviceSupportFGS;
FGSStatus status = kernelParams.getSvmSystemPointersSupport();
switch (status) {
diff --git a/projects/clr/rocclr/runtime/platform/context.cpp b/projects/clr/rocclr/runtime/platform/context.cpp
index b097ee7c1b..d015c29b93 100644
--- a/projects/clr/rocclr/runtime/platform/context.cpp
+++ b/projects/clr/rocclr/runtime/platform/context.cpp
@@ -46,11 +46,11 @@ Context::Context(
std::swap(svmAllocDevice_.front(), svmAllocDevice_.back());
}
- uint isFirstDeviceFGSEnabled = svmAllocDevice_.front()->isFineGrainedSystem();
+ uint isFirstDeviceFGSEnabled = svmAllocDevice_.front()->isFineGrainedSystem(true);
for (auto& dev : svmAllocDevice_) {
//allocation on fine - grained system incapable device first
if (isFirstDeviceFGSEnabled && (dev->type() == CL_DEVICE_TYPE_GPU)
- && (!(dev->isFineGrainedSystem()))) {
+ && (!(dev->isFineGrainedSystem(true)))) {
std::swap(svmAllocDevice_.front(), dev);
break;
}