P4 to Git Change 1062136 by jatang@jatang-opencl-hsa-stg2 on 2014/08/01 14:19:58

EPR #402950 - Properly align the scratch buffer to 64K.

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#452 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.cpp#189 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/include/cal/calcl.h#29 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp#95 edit


[ROCm/clr commit: 268ff9830e]
This commit is contained in:
foreman
2014-08-01 14:32:36 -04:00
förälder 3b35326a74
incheckning 4ea764d485
4 ändrade filer med 11 tillägg och 4 borttagningar
@@ -2289,9 +2289,8 @@ Device::allocScratch(uint regNum, const VirtualGPU* vgpu)
ScopedLockVgpus lock(*this);
std::vector<Memory*>& mems = scratch_[s]->memObjs_;
// Calculate the size of the new buffer +
// (64 Ki) for alignment with generic address space
size_t size = calcScratchBufferSize(regNum) + 64 * Ki;
// Calculate the size of the new buffer
size_t size = calcScratchBufferSize(regNum);
scratch_[s]->destroyMemory();
@@ -346,6 +346,7 @@ Resource::create(MemoryType memType, CreateParams* params, bool heap)
bool useRowPitch = false;
desc.vaBase = 0;
desc.minAlignment = 0;
desc.section = GSL_SECTION_REGULAR;
if (NULL != params && NULL != params->owner_) { //make sure params not NULL
mcaddr svmPtr = reinterpret_cast<mcaddr>(params->owner_->getSvmPtr());
@@ -453,7 +454,12 @@ Resource::create(MemoryType memType, CreateParams* params, bool heap)
// Check resource cache first for an appropriate resource
gslRef_ = dev().resourceCache().findCalResource(&cal_);
if (memType == Scratch) {
desc.vaBase = static_cast<mcaddr>(0x100000000ULL);
if ((dev().settings().hsail_) || (dev().settings().oclVersion_ >= OpenCL20)) {
desc.minAlignment = 64 * Ki;
}
else {
desc.vaBase = static_cast<mcaddr>(0x100000000ULL);
}
}
else if ((gslRef_ != NULL) && (!dev().settings().use64BitPtr_)) {
// Make sure runtime didn't pick a resource with > 4GB address
@@ -145,6 +145,7 @@ typedef struct CALresourceDescRec {
CALuint64 busAddress[2];
mcaddr vaBase;
gslMemObjectAttribSection section;
CALuint minAlignment;
} CALresourceDesc;
typedef enum CALresallocsliceviewflagsRec {
@@ -741,6 +741,7 @@ CALGSLDevice::resAlloc(const CALresourceDesc* desc) const
attribs.location = desc->type;
attribs.vaBase = desc->vaBase;
attribs.section = desc->section;
attribs.minAlignment = desc->minAlignment;
//!@note GSL asserts with tiled 1D images of any type.
if ((desc->dimension == GSL_MOA_BUFFER) ||