diff --git a/rocclr/runtime/device/gpu/gpublit.cpp b/rocclr/runtime/device/gpu/gpublit.cpp index 9dd416e822..ce3e86a96a 100644 --- a/rocclr/runtime/device/gpu/gpublit.cpp +++ b/rocclr/runtime/device/gpu/gpublit.cpp @@ -261,7 +261,6 @@ bool DmaBlitManager::writeMemoryStaged(const void* srcHost, Memory& dstMemory, M size_t origin, size_t& offset, size_t& totalSize, size_t xferSize) const { amd::Coord3D src(0, 0, 0); - size_t tmpSize; size_t chunkSize; static const bool CopyRect = false; // Flush DMA for ASYNC copy @@ -278,7 +277,7 @@ bool DmaBlitManager::writeMemoryStaged(const void* srcHost, Memory& dstMemory, M while (xferSize != 0) { // Find the partial transfer size - tmpSize = std::min(chunkSize, xferSize); + size_t tmpSize = std::min(chunkSize, xferSize); amd::Coord3D dst(origin + offset, 0, 0); amd::Coord3D copySize(tmpSize, 0, 0); @@ -1717,11 +1716,10 @@ bool KernelBlitManager::copyBufferRect(device::Memory& srcMemory, device::Memory const static uint CopyRectAlignment[3] = {16, 4, 1}; - bool aligned; uint i; for (i = 0; i < sizeof(CopyRectAlignment) / sizeof(uint); i++) { // Check source alignments - aligned = ((srcRectIn.rowPitch_ % CopyRectAlignment[i]) == 0); + bool aligned = ((srcRectIn.rowPitch_ % CopyRectAlignment[i]) == 0); aligned &= ((srcRectIn.slicePitch_ % CopyRectAlignment[i]) == 0); aligned &= ((srcRectIn.start_ % CopyRectAlignment[i]) == 0); @@ -2310,9 +2308,7 @@ bool KernelBlitManager::fillImage(device::Memory& memory, const void* pattern, bool KernelBlitManager::runScheduler(device::Memory& vqueue, device::Memory& params, uint paramIdx, uint threads) const { amd::ScopedLock k(lockXferOps_); - bool result = false; - size_t dim = 1; size_t globalWorkOffset[1] = {0}; size_t globalWorkSize[1] = {threads}; size_t localWorkSize[1] = {1}; @@ -2329,7 +2325,7 @@ bool KernelBlitManager::runScheduler(device::Memory& vqueue, device::Memory& par // Execute the blit address parameters = kernels_[Scheduler]->parameters().values(); - result = gpu().submitKernelInternal(ndrange, *kernels_[Scheduler], parameters); + bool result = gpu().submitKernelInternal(ndrange, *kernels_[Scheduler], parameters); synchronize(); @@ -2385,15 +2381,13 @@ amd::Memory* DmaBlitManager::pinHostMemory(const void* hostMem, size_t pinSize, Memory* KernelBlitManager::createView(const Memory& parent, const CalFormat& format) const { assert(!parent.cal()->buffer_ && "View supports images only"); - gpu::Memory* gpuImage = NULL; - - gpuImage = new gpu::Image(dev(), parent.size(), parent.cal()->width_, parent.cal()->height_, - parent.cal()->depth_, format.type_, format.channelOrder_, - parent.cal()->imageType_, 1); + gpu::Memory* gpuImage = new gpu::Image( + dev(), parent.size(), parent.cal()->width_, parent.cal()->height_, + parent.cal()->depth_, format.type_, format.channelOrder_, + parent.cal()->imageType_, 1); // Create resource if (NULL != gpuImage) { - bool result = false; Resource::ImageViewParams params; const Memory& gpuMem = static_cast(parent); @@ -2405,7 +2399,7 @@ Memory* KernelBlitManager::createView(const Memory& parent, const CalFormat& for params.gpu_ = &gpu(); // Create memory object - result = gpuImage->create(Resource::ImageView, ¶ms); + bool result = gpuImage->create(Resource::ImageView, ¶ms); if (!result) { delete gpuImage; return NULL; diff --git a/rocclr/runtime/device/gpu/gpudevice.hpp b/rocclr/runtime/device/gpu/gpudevice.hpp index 6001440a81..72885988af 100644 --- a/rocclr/runtime/device/gpu/gpudevice.hpp +++ b/rocclr/runtime/device/gpu/gpudevice.hpp @@ -300,7 +300,7 @@ class Device : public NullDevice, public CALGSLDevice { size_t bufSize_; //!< Staged buffer size std::list freeBuffers_; //!< The list of free buffers amd::Atomic acquiredCnt_; //!< The total number of acquired buffers - amd::Monitor lock_; //!< Stgaed buffer acquire/release lock + amd::Monitor lock_; //!< Staged buffer acquire/release lock const Device& gpuDevice_; //!< GPU device object }; @@ -311,7 +311,7 @@ class Device : public NullDevice, public CALGSLDevice { uint64_t size_; //!< Scratch buffer size on this queue //! Default constructor - ScratchBuffer() : regNum_(0), memObj_(NULL), offset_(0) {} + ScratchBuffer() : regNum_(0), memObj_(NULL), offset_(0), size_(0) {} //! Default constructor ~ScratchBuffer(); diff --git a/rocclr/runtime/device/gpu/gpukernel.cpp b/rocclr/runtime/device/gpu/gpukernel.cpp index 15368f6f98..f04e6c3a67 100644 --- a/rocclr/runtime/device/gpu/gpukernel.cpp +++ b/rocclr/runtime/device/gpu/gpukernel.cpp @@ -1031,7 +1031,6 @@ void Kernel::findLocalWorkSize(size_t workDim, const amd::NDRange& gblWorkSize, if (workGroupInfo()->compileSize_[0] == 0) { // Find the default local workgroup size, if it wasn't specified if (lclWorkSize[0] == 0) { - size_t thrPerGrp; bool b1DOverrideSet = !flagIsDefault(GPU_MAX_WORKGROUP_SIZE); bool b2DOverrideSet = !flagIsDefault(GPU_MAX_WORKGROUP_SIZE_2D_X) || !flagIsDefault(GPU_MAX_WORKGROUP_SIZE_2D_Y); @@ -1043,7 +1042,7 @@ void Kernel::findLocalWorkSize(size_t workDim, const amd::NDRange& gblWorkSize, ((workDim == 3) && b3DOverrideSet); if (!overrideSet) { // Find threads per group - thrPerGrp = workGroupInfo()->size_; + size_t thrPerGrp = workGroupInfo()->size_; // Check if kernel uses images if ((flags() & ImageEnable) && @@ -1376,8 +1375,6 @@ bool Kernel::bindConstantBuffers(VirtualGPU& gpu) const { void Kernel::processMemObjects(VirtualGPU& gpu, const amd::Kernel& kernel, const_address params, bool nativeMem) const { - VirtualGPU::MemoryDependency& dependecy = gpu.memoryDependency(); - // Mark the tracker with a new kernel, // so we can avoid checks of the aliased objects gpu.memoryDependency().newKernel(); @@ -3323,7 +3320,6 @@ void HSAILKernel::findLocalWorkSize(size_t workDim, const amd::NDRange& gblWorkS if (workGroupInfo()->compileSize_[0] == 0) { // Find the default local workgroup size, if it wasn't specified if (lclWorkSize[0] == 0) { - size_t thrPerGrp; bool b1DOverrideSet = !flagIsDefault(GPU_MAX_WORKGROUP_SIZE); bool b2DOverrideSet = !flagIsDefault(GPU_MAX_WORKGROUP_SIZE_2D_X) || !flagIsDefault(GPU_MAX_WORKGROUP_SIZE_2D_Y); @@ -3335,7 +3331,7 @@ void HSAILKernel::findLocalWorkSize(size_t workDim, const amd::NDRange& gblWorkS ((workDim == 3) && b3DOverrideSet); if (!overrideSet) { // Find threads per group - thrPerGrp = workGroupInfo()->size_; + size_t thrPerGrp = workGroupInfo()->size_; // Check if kernel uses images if (flags_.imageEna_ && diff --git a/rocclr/runtime/device/gpu/gpuprogram.cpp b/rocclr/runtime/device/gpu/gpuprogram.cpp index 354cd1d9af..87d2fdae3b 100644 --- a/rocclr/runtime/device/gpu/gpuprogram.cpp +++ b/rocclr/runtime/device/gpu/gpuprogram.cpp @@ -2032,11 +2032,11 @@ bool HSAILProgram::linkImpl(amd::option::Options* options) { &kernelNamesSize); if (errorCode != ACL_SUCCESS) { buildLog_ += "Error: Querying of kernel names from the binary failed.\n"; - delete kernelNames; + delete [] kernelNames; return false; } std::vector vKernels = splitSpaceSeparatedString(kernelNames); - delete kernelNames; + delete [] kernelNames; std::vector::iterator it = vKernels.begin(); bool dynamicParallelism = false; aclMetadata md; diff --git a/rocclr/runtime/device/gpu/gpuvirtual.cpp b/rocclr/runtime/device/gpu/gpuvirtual.cpp index 1efbb37e5b..262c9e6bc3 100644 --- a/rocclr/runtime/device/gpu/gpuvirtual.cpp +++ b/rocclr/runtime/device/gpu/gpuvirtual.cpp @@ -1366,7 +1366,7 @@ void VirtualGPU::submitMigrateMemObjects(amd::MigrateMemObjectsCommand& vcmd) { profilingBegin(vcmd, true); std::vector::const_iterator itr; - for (itr = vcmd.memObjects().begin(); itr != vcmd.memObjects().end(); itr++) { + for (itr = vcmd.memObjects().begin(); itr != vcmd.memObjects().end(); ++itr) { // Find device memory gpu::Memory* memory = dev().getGpuMemory(*itr); @@ -1395,7 +1395,7 @@ void VirtualGPU::submitSvmFreeMemory(amd::SvmFreeMemoryCommand& vcmd) { std::vector& svmPointers = vcmd.svmPointers(); if (vcmd.pfnFreeFunc() == NULL) { // pointers allocated using clSVMAlloc - for (cl_uint i = 0; i < svmPointers.size(); i++) { + for (cl_uint i = 0; i < svmPointers.size(); ++i) { dev().svmFree(svmPointers[i]); } } else { @@ -2298,7 +2298,7 @@ void VirtualGPU::submitAcquireExtObjects(amd::AcquireExtObjectsCommand& vcmd) { profilingBegin(vcmd); for (std::vector::const_iterator it = vcmd.getMemList().begin(); - it != vcmd.getMemList().end(); it++) { + it != vcmd.getMemList().end(); ++it) { // amd::Memory object should never be NULL assert(*it && "Memory object for interop is NULL"); gpu::Memory* memory = dev().getGpuMemory(*it); @@ -2337,7 +2337,7 @@ void VirtualGPU::submitReleaseExtObjects(amd::ReleaseExtObjectsCommand& vcmd) { profilingBegin(vcmd); for (std::vector::const_iterator it = vcmd.getMemList().begin(); - it != vcmd.getMemList().end(); it++) { + it != vcmd.getMemList().end(); ++it) { // amd::Memory object should never be NULL assert(*it && "Memory object for interop is NULL"); gpu::Memory* memory = dev().getGpuMemory(*it); diff --git a/rocclr/runtime/device/gpu/gpuvirtual.hpp b/rocclr/runtime/device/gpu/gpuvirtual.hpp index b461491add..cbf78a1020 100644 --- a/rocclr/runtime/device/gpu/gpuvirtual.hpp +++ b/rocclr/runtime/device/gpu/gpuvirtual.hpp @@ -120,7 +120,7 @@ class VirtualGPU : public device::VirtualDevice, public CALGSLContext { public: //! Default constructor MemoryDependency() - : memObjectsInQueue_(NULL), numMemObjectsInQueue_(0), maxMemObjectsInQueue_(0) {} + : memObjectsInQueue_(NULL), endMemObjectsInQueue_(0), numMemObjectsInQueue_(0), maxMemObjectsInQueue_(0) {} ~MemoryDependency() { delete[] memObjectsInQueue_; } @@ -183,7 +183,7 @@ class VirtualGPU : public device::VirtualDevice, public CALGSLContext { typedef std::vector ResourceSlots; public: - VirtualGPU(Device& device); + explicit VirtualGPU(Device& device); bool create(bool profiling, uint rtCUs = amd::CommandQueue::RealTimeDisabled, uint deviceQueueSize = 0, amd::CommandQueue::Priority priority = amd::CommandQueue::Priority::Normal); diff --git a/rocclr/runtime/device/pal/palblit.cpp b/rocclr/runtime/device/pal/palblit.cpp index 4415ac0f0d..a0c74ac73a 100644 --- a/rocclr/runtime/device/pal/palblit.cpp +++ b/rocclr/runtime/device/pal/palblit.cpp @@ -197,7 +197,6 @@ bool DmaBlitManager::readBufferRect(device::Memory& srcMemory, void* dstHost, Memory& xferBuf = dev().xferRead().acquire(); amd::Coord3D dst(0, 0, 0); - size_t tmpSize = 0; size_t bufOffset; size_t hostOffset; size_t srcSize; @@ -210,7 +209,7 @@ bool DmaBlitManager::readBufferRect(device::Memory& srcMemory, void* dstHost, while (srcSize != 0) { // Find the partial transfer size - tmpSize = std::min(dev().xferRead().bufSize(), srcSize); + size_t tmpSize = std::min(dev().xferRead().bufSize(), srcSize); amd::Coord3D src(bufOffset, 0, 0); amd::Coord3D copySize(tmpSize, 0, 0); @@ -258,7 +257,6 @@ bool DmaBlitManager::writeMemoryStaged(const void* srcHost, Memory& dstMemory, M size_t origin, size_t& offset, size_t& totalSize, size_t xferSize) const { amd::Coord3D src(0, 0, 0); - size_t tmpSize; size_t chunkSize; static const bool CopyRect = false; // Flush DMA for ASYNC copy @@ -275,7 +273,7 @@ bool DmaBlitManager::writeMemoryStaged(const void* srcHost, Memory& dstMemory, M while (xferSize != 0) { // Find the partial transfer size - tmpSize = std::min(chunkSize, xferSize); + size_t tmpSize = std::min(chunkSize, xferSize); amd::Coord3D dst(origin + offset, 0, 0); amd::Coord3D copySize(tmpSize, 0, 0); @@ -1711,11 +1709,10 @@ bool KernelBlitManager::copyBufferRect(device::Memory& srcMemory, device::Memory const static uint CopyRectAlignment[3] = {16, 4, 1}; - bool aligned; uint i; for (i = 0; i < sizeof(CopyRectAlignment) / sizeof(uint); i++) { // Check source alignments - aligned = ((srcRectIn.rowPitch_ % CopyRectAlignment[i]) == 0); + bool aligned = ((srcRectIn.rowPitch_ % CopyRectAlignment[i]) == 0); aligned &= ((srcRectIn.slicePitch_ % CopyRectAlignment[i]) == 0); aligned &= ((srcRectIn.start_ % CopyRectAlignment[i]) == 0); @@ -2064,11 +2061,10 @@ bool KernelBlitManager::copyBuffer(device::Memory& srcMemory, device::Memory& ds const static uint CopyBuffAlignment[3] = {16, 4, 1}; amd::Coord3D size(sizeIn[0], sizeIn[1], sizeIn[2]); - bool aligned; uint i; for (i = 0; i < sizeof(CopyBuffAlignment) / sizeof(uint); i++) { // Check source alignments - aligned = ((srcOrigin[0] % CopyBuffAlignment[i]) == 0); + bool aligned = ((srcOrigin[0] % CopyBuffAlignment[i]) == 0); // Check destination alignments aligned &= ((dstOrigin[0] % CopyBuffAlignment[i]) == 0); // Check copy size alignment in the first dimension @@ -2283,9 +2279,7 @@ bool KernelBlitManager::fillImage(device::Memory& memory, const void* pattern, bool KernelBlitManager::runScheduler(device::Memory& vqueue, device::Memory& params, uint paramIdx, uint threads) const { amd::ScopedLock k(lockXferOps_); - bool result = false; - size_t dim = 1; size_t globalWorkOffset[1] = {0}; size_t globalWorkSize[1] = {threads}; size_t localWorkSize[1] = {1}; @@ -2302,7 +2296,7 @@ bool KernelBlitManager::runScheduler(device::Memory& vqueue, device::Memory& par // Execute the blit address parameters = kernels_[Scheduler]->parameters().values(); - result = gpu().submitKernelInternal(ndrange, *kernels_[Scheduler], parameters); + bool result = gpu().submitKernelInternal(ndrange, *kernels_[Scheduler], parameters); synchronize(); @@ -2366,14 +2360,11 @@ amd::Memory* DmaBlitManager::pinHostMemory(const void* hostMem, size_t pinSize, Memory* KernelBlitManager::createView(const Memory& parent, const cl_image_format format) const { assert(!parent.desc().buffer_ && "View supports images only"); - Memory* gpuImage = NULL; - - gpuImage = new Image(dev(), parent.size(), parent.desc().width_, parent.desc().height_, - parent.desc().depth_, format, parent.desc().topology_, 1); + Memory* gpuImage = new Image(dev(), parent.size(), parent.desc().width_, parent.desc().height_, + parent.desc().depth_, format, parent.desc().topology_, 1); // Create resource if (NULL != gpuImage) { - bool result = false; Resource::ImageViewParams params; const Memory& gpuMem = static_cast(parent); @@ -2385,7 +2376,7 @@ Memory* KernelBlitManager::createView(const Memory& parent, const cl_image_forma params.gpu_ = &gpu(); // Create memory object - result = gpuImage->create(Resource::ImageView, ¶ms); + bool result = gpuImage->create(Resource::ImageView, ¶ms); if (!result) { delete gpuImage; return NULL; diff --git a/rocclr/runtime/device/pal/palcompiler.cpp b/rocclr/runtime/device/pal/palcompiler.cpp index 778338d0da..be9348ad70 100644 --- a/rocclr/runtime/device/pal/palcompiler.cpp +++ b/rocclr/runtime/device/pal/palcompiler.cpp @@ -56,11 +56,9 @@ bool HSAILProgram::compileImpl(const std::string& sourceCode, // Find the temp folder for the OS std::string tempFolder = amd::Os::getTempPath(); - std::string tempFileName = amd::Os::getTempFileName(); // Iterate through each source code and dump it into tmp std::fstream f; - std::vector headerFileNames(headers.size()); std::vector newDirs; for (size_t i = 0; i < headers.size(); ++i) { std::string headerPath = tempFolder; @@ -84,7 +82,6 @@ bool HSAILProgram::compileImpl(const std::string& sourceCode, newDirs.push_back(headerPath); } std::string headerFullName = headerPath + amd::Os::fileSeparator() + headerIncludeName; - headerFileNames[i] = headerFullName; f.open(headerFullName.c_str(), std::fstream::out); // Should we allow asserts assert(!f.fail() && "failed creating header file!"); diff --git a/rocclr/runtime/device/pal/paldevice.cpp b/rocclr/runtime/device/pal/paldevice.cpp index 376a6ead90..6426d1f036 100644 --- a/rocclr/runtime/device/pal/paldevice.cpp +++ b/rocclr/runtime/device/pal/paldevice.cpp @@ -213,7 +213,7 @@ bool NullDevice::create(Pal::AsicRevision asicRevision, Pal::GfxIpLevel ipLevel, // Report 512MB for all offline devices Pal::GpuMemoryHeapProperties heaps[Pal::GpuHeapCount]; - heaps[Pal::GpuHeapLocal].heapSize = + heaps[Pal::GpuHeapLocal].heapSize = heaps[Pal::GpuHeapLocal].physicalHeapSize = 512 * Mi; Pal::WorkStationCaps wscaps = {}; @@ -547,10 +547,9 @@ Device::XferBuffers::~XferBuffers() { } bool Device::XferBuffers::create() { - Memory* xferBuf = nullptr; bool result = false; // Create a buffer object - xferBuf = new Memory(dev(), bufSize_); + Memory* xferBuf = new Memory(dev(), bufSize_); // Try to allocate memory for the transfer buffer if ((nullptr == xferBuf) || !xferBuf->create(type_)) { @@ -990,14 +989,13 @@ bool Device::initializeHeapResources() { device::VirtualDevice* Device::createVirtualDevice(amd::CommandQueue* queue) { bool profiling = false; - bool interopQueue = false; uint rtCUs = amd::CommandQueue::RealTimeDisabled; uint deviceQueueSize = 0; if (queue != nullptr) { profiling = queue->properties().test(CL_QUEUE_PROFILING_ENABLE); if (queue->asHostQueue() != nullptr) { - interopQueue = (0 != (queue->context().info().flags_ & + bool interopQueue = (0 != (queue->context().info().flags_ & (amd::Context::GLDeviceKhr | amd::Context::D3D10DeviceKhr | amd::Context::D3D11DeviceKhr))); rtCUs = queue->rtCUs(); @@ -1044,11 +1042,10 @@ typedef std::map requestedDevices_t; //! Parses the requested list of devices to be exposed to the user. static void parseRequestedDeviceList(requestedDevices_t& requestedDevices) { - char* pch = nullptr; int requestedDeviceCount = 0; const char* requestedDeviceList = GPU_DEVICE_ORDINAL; - pch = strtok(const_cast(requestedDeviceList), ","); + char* pch = strtok(const_cast(requestedDeviceList), ","); while (pch != nullptr) { bool deviceIdValid = true; int currentDeviceIndex = atoi(pch); @@ -1196,10 +1193,8 @@ Pal::ChNumFormat Device::getPalFormat(const amd::Image::Format& format, // Create buffer without an owner (merge common code with createBuffer() ?) pal::Memory* Device::createScratchBuffer(size_t size) const { - Memory* gpuMemory = nullptr; - // Create a memory object - gpuMemory = new pal::Memory(*this, size); + Memory* gpuMemory = new pal::Memory(*this, size); if (nullptr == gpuMemory || !gpuMemory->create(Resource::Local)) { delete gpuMemory; gpuMemory = nullptr; @@ -1381,7 +1376,6 @@ pal::Memory* Device::createBuffer(amd::Memory& owner, bool directAccess) const { } pal::Memory* Device::createImage(amd::Memory& owner, bool directAccess) const { - size_t size = owner.getSize(); amd::Image& image = *owner.asImage(); pal::Memory* gpuImage = nullptr; @@ -1527,8 +1521,6 @@ bool Device::createSampler(const amd::Sampler& owner, device::Sampler** sampler) //! Otherwise a deadlock in lockVgpus() is possible bool Device::reallocMemory(amd::Memory& owner) const { - bool directAccess = false; - // For now we have to serialize reallocation code amd::ScopedLock lk(*lockAsyncOps_); @@ -1548,7 +1540,7 @@ bool Device::reallocMemory(amd::Memory& owner) const { } if (owner.asBuffer()) { - gpuMemory = createBuffer(owner, directAccess); + gpuMemory = createBuffer(owner, false); } else if (owner.asImage()) { return true; } else { @@ -1584,17 +1576,14 @@ bool Device::reallocMemory(amd::Memory& owner) const { } device::Memory* Device::createView(amd::Memory& owner, const device::Memory& parent) const { - size_t size = owner.getSize(); assert((owner.asImage() != nullptr) && "View supports images only"); const amd::Image& image = *owner.asImage(); - pal::Memory* gpuImage = nullptr; - - gpuImage = new pal::Image(*this, owner, image.getWidth(), image.getHeight(), image.getDepth(), - image.getImageFormat(), image.getType(), image.getMipLevels()); + pal::Memory* gpuImage = new pal::Image( + *this, owner, image.getWidth(), image.getHeight(), image.getDepth(), + image.getImageFormat(), image.getType(), image.getMipLevels()); // Create resource if (nullptr != gpuImage) { - bool result = false; Resource::ImageViewParams params; const pal::Memory& gpuMem = static_cast(parent); @@ -1606,7 +1595,7 @@ device::Memory* Device::createView(amd::Memory& owner, const device::Memory& par params.memory_ = &gpuMem; // Create memory object - result = gpuImage->create(Resource::ImageView, ¶ms); + bool result = gpuImage->create(Resource::ImageView, ¶ms); if (!result) { delete gpuImage; return nullptr; @@ -2033,8 +2022,7 @@ void Device::svmFree(void* ptr) const { if (freeCPUMem_) { amd::Os::alignedFree(ptr); } else { - amd::Memory* svmMem = nullptr; - svmMem = amd::SvmManager::FindSvmBuffer(ptr); + amd::Memory* svmMem = amd::SvmManager::FindSvmBuffer(ptr); if (nullptr != svmMem) { svmMem->release(); amd::SvmManager::RemoveSvmBuffer(ptr); diff --git a/rocclr/runtime/device/pal/paldevice.hpp b/rocclr/runtime/device/pal/paldevice.hpp index 48ba237d31..f972afe72e 100644 --- a/rocclr/runtime/device/pal/paldevice.hpp +++ b/rocclr/runtime/device/pal/paldevice.hpp @@ -159,7 +159,7 @@ class ThreadTrace; class Sampler : public device::Sampler { public: //! Constructor - Sampler(const Device& dev) : dev_(dev) {} + Sampler(const Device& dev) : dev_(dev) {} //! Default destructor for the device memory object virtual ~Sampler(); @@ -252,7 +252,7 @@ class Device : public NullDevice { uint64_t size_; //!< Scratch buffer size on this queue //! Default constructor - ScratchBuffer() : regNum_(0), memObj_(NULL), offset_(0) {} + ScratchBuffer() : regNum_(0), memObj_(NULL), offset_(0), size_(0) {} //! Default constructor ~ScratchBuffer(); @@ -493,7 +493,7 @@ class Device : public NullDevice { bool resGLFree(void* GLplatformContext, void* mbResHandle, uint type) const; //! Adds a resource to the global list - void addResource(GpuMemoryReference* mem) const { + void addResource(GpuMemoryReference* mem) const { amd::ScopedLock lock(lockResources()); auto findIt = std::find(resourceList_->begin(), resourceList_->end(), mem); mem->events_.resize(numOfVgpus()); diff --git a/rocclr/runtime/device/pal/paldevicegl.cpp b/rocclr/runtime/device/pal/paldevicegl.cpp index aff888ee9b..75826918e1 100644 --- a/rocclr/runtime/device/pal/paldevicegl.cpp +++ b/rocclr/runtime/device/pal/paldevicegl.cpp @@ -639,7 +639,7 @@ bool Device::glCanInterop(void* GLplatformContext, void* GLdeviceContext) const GLXContext ctx = static_cast(GLplatformContext); Display* disp = static_cast(GLdeviceContext); - + if (glXGetContextMVPUInfoAMD(ctx, &glDeviceId, &glChainMask)) { mesa_glinterop_device_info info = {}; if (pfnMesaGLInteropGLXQueryDeviceInfo(disp, ctx, &info) == 0) { @@ -661,7 +661,6 @@ bool Device::glAssociate(void* GLplatformContext, void* GLdeviceContext) const { return false; } - int flags = 0; /* if (m_adp->pAsicInfo->svmFineGrainSystem) { @@ -673,12 +672,11 @@ bool Device::glAssociate(void* GLplatformContext, void* GLdeviceContext) const { return (glXBeginCLInteropAMD(ctx, 0)) ? true : false; #else HGLRC hRC = (HGLRC)GLplatformContext; - return (wglBeginCLInteropAMD(hRC, flags)) ? true : false; + return (wglBeginCLInteropAMD(hRC, 0)) ? true : false; #endif } bool Device::glDissociate(void* GLplatformContext, void* GLdeviceContext) const { - int flags = 0; /* if (m_adp->pAsicInfo->svmFineGrainSystem) { @@ -690,7 +688,7 @@ bool Device::glDissociate(void* GLplatformContext, void* GLdeviceContext) const return (glXEndCLInteropAMD(ctx, 0)) ? true : false; #else HGLRC hRC = (HGLRC)GLplatformContext; - return (wglEndCLInteropAMD(hRC, flags)) ? true : false; + return (wglEndCLInteropAMD(hRC, 0)) ? true : false; #endif } diff --git a/rocclr/runtime/device/pal/palkernel.cpp b/rocclr/runtime/device/pal/palkernel.cpp index cc081d7db2..d32956860f 100644 --- a/rocclr/runtime/device/pal/palkernel.cpp +++ b/rocclr/runtime/device/pal/palkernel.cpp @@ -770,7 +770,6 @@ void HSAILKernel::findLocalWorkSize(size_t workDim, const amd::NDRange& gblWorkS if (workGroupInfo()->compileSize_[0] == 0) { // Find the default local workgroup size, if it wasn't specified if (lclWorkSize[0] == 0) { - size_t thrPerGrp; bool b1DOverrideSet = !flagIsDefault(GPU_MAX_WORKGROUP_SIZE); bool b2DOverrideSet = !flagIsDefault(GPU_MAX_WORKGROUP_SIZE_2D_X) || !flagIsDefault(GPU_MAX_WORKGROUP_SIZE_2D_Y); @@ -782,7 +781,7 @@ void HSAILKernel::findLocalWorkSize(size_t workDim, const amd::NDRange& gblWorkS ((workDim == 3) && b3DOverrideSet); if (!overrideSet) { // Find threads per group - thrPerGrp = workGroupInfo()->size_; + size_t thrPerGrp = workGroupInfo()->size_; // Check if kernel uses images if (flags_.imageEna_ && @@ -1378,7 +1377,7 @@ static inline HSAIL_ADDRESS_QUALIFIER GetKernelAddrQual(const KernelArgMD& lcArg } LogError("Unsupported address type"); return HSAIL_ADDRESS_ERROR; - } else if (lcArg.mValueKind == ValueKind::Image || + } else if (lcArg.mValueKind == ValueKind::Image || lcArg.mValueKind == ValueKind::Sampler || lcArg.mValueKind == ValueKind::Pipe) { return HSAIL_ADDRESS_GLOBAL; diff --git a/rocclr/runtime/device/pal/palmemory.cpp b/rocclr/runtime/device/pal/palmemory.cpp index bdb7687f54..4777390de9 100644 --- a/rocclr/runtime/device/pal/palmemory.cpp +++ b/rocclr/runtime/device/pal/palmemory.cpp @@ -170,7 +170,7 @@ bool Memory::create(Resource::MemoryType memType, Resource::CreateParams* params } if (result) { - if ((params != nullptr) && (memoryType() == Pinned)) { + if ((params != nullptr) && (memoryType() == Pinned)) { memRef()->gpu_ = params->gpu_; } } @@ -789,7 +789,6 @@ void* Memory::allocMapTarget(const amd::Coord3D& origin, const amd::Coord3D& reg if (memory == nullptr) { // for map target of svm buffer , we need use svm host ptr memory = new (dev().context()) amd::Buffer(dev().context(), flag, owner()->getSize()); - Memory* gpuMemory; do { if ((memory == nullptr) || !memory->create(initHostPtr, SysMem)) { @@ -798,7 +797,7 @@ void* Memory::allocMapTarget(const amd::Coord3D& origin, const amd::Coord3D& reg } memory->setCacheStatus(canBeCached); - gpuMemory = reinterpret_cast(memory->getDeviceMemory(dev())); + Memory* gpuMemory = reinterpret_cast(memory->getDeviceMemory(dev())); // Create, Map and get the base pointer for the resource if ((gpuMemory == nullptr) || (nullptr == gpuMemory->map(nullptr))) { @@ -1099,14 +1098,13 @@ void* Image::allocMapTarget(const amd::Coord3D& origin, const amd::Coord3D& regi amd::Buffer(dev().context(), 0, desc().width_ * height * depth * elementSize()); memory->setVirtualDevice(owner()->getVirtualDevice()); - Memory* gpuMemory; do { if ((memory == nullptr) || !memory->create(nullptr, SysMem)) { failed = true; break; } - gpuMemory = reinterpret_cast(memory->getDeviceMemory(dev())); + Memory* gpuMemory = reinterpret_cast(memory->getDeviceMemory(dev())); // Create, Map and get the base pointer for the resource if ((gpuMemory == nullptr) || (nullptr == gpuMemory->map(nullptr))) { diff --git a/rocclr/runtime/device/pal/palprintf.cpp b/rocclr/runtime/device/pal/palprintf.cpp index 8f027ae847..d43d739c80 100644 --- a/rocclr/runtime/device/pal/palprintf.cpp +++ b/rocclr/runtime/device/pal/palprintf.cpp @@ -386,7 +386,6 @@ void PrintfDbg::outputDbgBuffer(const PrintfInfo& info, const uint32_t* workitem if (posStart != std::string::npos) { bool printFloat = false; int vectorSize = 0; - size_t length; size_t idPos = 0; // Search for PrintfDbg specifier in the format string. @@ -423,7 +422,7 @@ void PrintfDbg::outputDbgBuffer(const PrintfInfo& info, const uint32_t* workitem // Is it a scalar value? if (vectorSize == 0) { - length = outputArgument(fmt, printFloat, info.arguments_[j], &s[i]); + size_t length = outputArgument(fmt, printFloat, info.arguments_[j], &s[i]); if (0 == length) { return; } diff --git a/rocclr/runtime/device/pal/palprogram.cpp b/rocclr/runtime/device/pal/palprogram.cpp index 6cd74ea278..b8d664c3c1 100644 --- a/rocclr/runtime/device/pal/palprogram.cpp +++ b/rocclr/runtime/device/pal/palprogram.cpp @@ -93,8 +93,7 @@ void Segment::copy(size_t offset, const void* src, size_t size) { size_t srcOffs = 0; while (size != 0) { xferBuf.hostWrite(&gpu, reinterpret_cast(src) + srcOffs, 0, tmpSize); - bool result = - xferBuf.partialMemCopyTo(gpu, 0, (offset + srcOffs), tmpSize, *gpuAccess_, false, true); + xferBuf.partialMemCopyTo(gpu, 0, (offset + srcOffs), tmpSize, *gpuAccess_, false, true); size -= tmpSize; srcOffs += tmpSize; tmpSize = std::min(static_cast(xferBuf.vmSize()), size); @@ -648,11 +647,11 @@ bool HSAILProgram::linkImpl(amd::option::Options* options) { &kernelNamesSize); if (errorCode != ACL_SUCCESS) { buildLog_ += "Error: Querying of kernel names from the binary failed.\n"; - delete kernelNames; + delete [] kernelNames; return false; } std::vector vKernels = splitSpaceSeparatedString(kernelNames); - delete kernelNames; + delete [] kernelNames; std::vector::iterator it = vKernels.begin(); bool dynamicParallelism = false; for (it; it != vKernels.end(); ++it) { @@ -862,11 +861,10 @@ hsa_isa_t PALHSALoaderContext::IsaFromName(const char* name) { uint32_t gfxip = 0; std::string gfx_target(name); uint32_t shift = 1; - size_t first; size_t last = gfx_target.length(); std::string ver; do { - first = gfx_target.find_last_of(':', last); + size_t first = gfx_target.find_last_of(':', last); ver = gfx_target.substr(first + 1, last - first); last = first - 1; gfxip += static_cast(atoi(ver.c_str())) * shift; diff --git a/rocclr/runtime/device/pal/palresource.cpp b/rocclr/runtime/device/pal/palresource.cpp index c13f5e6fb2..f84ec1517d 100644 --- a/rocclr/runtime/device/pal/palresource.cpp +++ b/rocclr/runtime/device/pal/palresource.cpp @@ -614,7 +614,7 @@ bool Resource::create(MemoryType memType, CreateParams* params) { if (memImg != nullptr) { result = dev().iDev()->CreateImage(imgCreateInfo, memImg, &image_); if (result != Pal::Result::Success) { - delete memImg; + delete [] memImg; return false; } } @@ -782,7 +782,6 @@ bool Resource::create(MemoryType memType, CreateParams* params) { Pal::ImageViewInfo viewInfo = {}; Pal::ImageCreateInfo imgCreateInfo = {}; Pal::GpuMemoryRequirements req = {}; - char* memImg; imgCreateInfo.imageType = Pal::ImageType::Tex2d; viewInfo.viewType = Pal::ImageViewType::Tex2d; imgCreateInfo.extent.width = desc_.width_; @@ -868,11 +867,11 @@ bool Resource::create(MemoryType memType, CreateParams* params) { return false; } - memImg = new char[imageSize]; + char* memImg = new char[imageSize]; if (memImg != nullptr) { result = dev().iDev()->CreateImage(imgCreateInfo, memImg, &image_); if (result != Pal::Result::Success) { - delete memImg; + delete [] memImg; return false; } } @@ -1208,7 +1207,6 @@ bool Resource::partialMemCopyTo(VirtualGPU& gpu, const amd::Coord3D& srcOrigin, Resource& dstResource, bool enableCopyRect, bool flushDMA, uint bytesPerElement) const { GpuEvent event; - bool result = true; EngineType activeEngineID = gpu.engineID_; static const bool waitOnBusyEngine = true; @@ -1350,19 +1348,17 @@ bool Resource::partialMemCopyTo(VirtualGPU& gpu, const amd::Coord3D& srcOrigin, gpu.eventEnd(gpu.engineID_, event); - if (result) { - // Mark source and destination as busy - setBusy(gpu, event); - dstResource.setBusy(gpu, event); + // Mark source and destination as busy + setBusy(gpu, event); + dstResource.setBusy(gpu, event); - // Update the global GPU event - gpu.setGpuEvent(event, flushDMA); - } + // Update the global GPU event + gpu.setGpuEvent(event, flushDMA); // Restore the original engine gpu.engineID_ = activeEngineID; - return result; + return true; } void Resource::setBusy(VirtualGPU& gpu, GpuEvent gpuEvent) const { @@ -1380,7 +1376,7 @@ void Resource::wait(VirtualGPU& gpu, bool waitOnBusyEngine) const { // Check if we have to wait unconditionally if (!waitOnBusyEngine || // or we have to wait only if another engine was used on this resource - (waitOnBusyEngine && (gpuEvent->engineId_ != gpu.engineID_))) { + (gpuEvent->engineId_ != gpu.engineID_)) { gpu.waitForEvent(gpuEvent); } @@ -1418,9 +1414,7 @@ bool Resource::hostWrite(VirtualGPU* gpu, const void* hostPtr, const amd::Coord3 // Copy memory amd::Os::fastMemcpy(dst, hostPtr, copySize); } else { - size_t srcOffs = 0; size_t dstOffsBase = origin[0] * elementSize_; - size_t dstOffs; // Make sure we use the right pitch if it's not specified if (rowPitch == 0) { @@ -1440,8 +1434,8 @@ bool Resource::hostWrite(VirtualGPU* gpu, const void* hostPtr, const amd::Coord3 // Copy memory slice by slice for (size_t slice = 0; slice < size[2]; ++slice) { - dstOffs = dstOffsBase + slice * desc().slice_ * elementSize_; - srcOffs = slice * slicePitch; + size_t dstOffs = dstOffsBase + slice * desc().slice_ * elementSize_; + size_t srcOffs = slice * slicePitch; // Copy memory line by line for (size_t row = 0; row < size[1]; ++row) { @@ -1490,8 +1484,6 @@ bool Resource::hostRead(VirtualGPU* gpu, void* hostPtr, const amd::Coord3D& orig amd::Os::fastMemcpy(hostPtr, src, copySize); } else { size_t srcOffsBase = origin[0] * elementSize_; - size_t srcOffs; - size_t dstOffs = 0; // Make sure we use the right pitch if it's not specified if (rowPitch == 0) { @@ -1511,8 +1503,8 @@ bool Resource::hostRead(VirtualGPU* gpu, void* hostPtr, const amd::Coord3D& orig // Copy memory line by line for (size_t slice = 0; slice < size[2]; ++slice) { - srcOffs = srcOffsBase + slice * desc().slice_ * elementSize_; - dstOffs = slice * slicePitch; + size_t srcOffs = srcOffsBase + slice * desc().slice_ * elementSize_; + size_t dstOffs = slice * slicePitch; // Copy memory line by line for (size_t row = 0; row < size[1]; ++row) { @@ -1701,85 +1693,8 @@ void* Resource::map(VirtualGPU* gpu, uint flags, uint startLayer, uint numLayers } void* Resource::mapLayers(VirtualGPU* gpu, uint flags) { - size_t srcOffs = 0; - size_t dstOffs = 0; - Pal::IGpuMemory* sliceResource = 0; - PalGpuMemoryType palDim = PAL_TEXTURE_2D; - size_t layers = desc().depth_; - size_t height = desc().height_; - - // Use 1D layers - if (CL_MEM_OBJECT_IMAGE1D_ARRAY == desc().topology_) { - palDim = PAL_TEXTURE_1D; - height = 1; - layers = desc().height_; - } - - desc_.pitch_ = desc().width_; - desc_.slice_ = desc().pitch_ * height; - address_ = new char[desc().slice_ * layers * elementSize()]; - if (nullptr == address_) { - return nullptr; - } - - // Check if map is write only - if (flags & WriteOnly) { - return address_; - } - - if (numLayers_ != 0) { - layers = startLayer_ + numLayers_; - } - - dstOffs = startLayer_ * desc().slice_ * elementSize(); - - // Loop through all layers - for (uint i = startLayer_; i < layers; ++i) { - // gslResource3D gslSize; - size_t calOffset; - void* sliceAddr; - size_t pitch; - Unimplemented(); - // Allocate a layer from the image - // gslSize.width = desc().width_; - // gslSize.height = height; - // gslSize.depth = 1; - calOffset = 0; - /* - sliceResource = dev().resAllocView( - iMem(), gslSize, - calOffset, desc().format_, desc().channelOrder_, palDim, - 0, i, CAL_RESALLOCSLICEVIEW_LEVEL_AND_LAYER); - if (0 == sliceResource) { - LogError("Map layer. resAllocSliceView failed!"); - return nullptr; - } - */ - // Map 2D layer - sliceAddr = gpuMemoryMap(&pitch, ReadOnly, sliceResource); - if (sliceAddr == nullptr) { - LogError("Map layer. CalResMap failed!"); - return nullptr; - } - - srcOffs = 0; - // Copy memory line by line - for (size_t rows = 0; rows < height; ++rows) { - // Copy memory - amd::Os::fastMemcpy((reinterpret_cast
(address_) + dstOffs), - (reinterpret_cast(sliceAddr) + srcOffs), - desc().width_ * elementSize_); - - dstOffs += desc().pitch_ * elementSize(); - srcOffs += pitch * elementSize(); - } - - // Unmap a layer - gpuMemoryUnmap(sliceResource); - // dev().resFree(sliceResource); - } - - return address_; + Unimplemented(); + return nullptr; } void Resource::unmap(VirtualGPU* gpu) { @@ -1809,77 +1724,7 @@ void Resource::unmap(VirtualGPU* gpu) { } void Resource::unmapLayers(VirtualGPU* gpu) { - size_t srcOffs = 0; - size_t dstOffs = 0; - PalGpuMemoryType palDim = PAL_TEXTURE_2D; - Pal::IGpuMemory* sliceResource = nullptr; - uint layers = desc().depth_; - uint height = desc().height_; - - // Use 1D layers - if (CL_MEM_OBJECT_IMAGE1D_ARRAY == desc().topology_) { - palDim = PAL_TEXTURE_1D; - height = 1; - layers = desc().height_; - } - - if (numLayers_ != 0) { - layers = startLayer_ + numLayers_; - } - - srcOffs = startLayer_ * desc().slice_ * elementSize(); - - // Check if map is write only - if (!(mapFlags_ & ReadOnly)) { - // Loop through all layers - for (uint i = startLayer_; i < layers; ++i) { - Unimplemented(); - // gslResource3D gslSize; - size_t calOffset; - void* sliceAddr; - size_t pitch; - - // Allocate a layer from the image - // gslSize.width = desc().width_; - // gslSize.height = height; - // gslSize.depth = 1; - calOffset = 0; - /*sliceResource = dev().resAllocView( - iMem(), gslSize, - calOffset, desc().format_, desc().channelOrder_, palDim, - 0, i, CAL_RESALLOCSLICEVIEW_LEVEL_AND_LAYER); - if (0 == sliceResource) { - LogError("Unmap layer. resAllocSliceView failed!"); - return; - } -*/ - // Map a layer - sliceAddr = gpuMemoryMap(&pitch, WriteOnly, sliceResource); - if (sliceAddr == nullptr) { - LogError("Unmap layer. CalResMap failed!"); - return; - } - - dstOffs = 0; - // Copy memory line by line - for (size_t rows = 0; rows < height; ++rows) { - // Copy memory - amd::Os::fastMemcpy((reinterpret_cast
(sliceAddr) + dstOffs), - (reinterpret_cast(address_) + srcOffs), - desc().width_ * elementSize_); - - dstOffs += pitch * elementSize(); - srcOffs += desc().pitch_ * elementSize(); - } - - // Unmap a layer - gpuMemoryUnmap(sliceResource); - // dev().resFree(sliceResource); - } - } - - // Destroy the mapped memory - delete[] reinterpret_cast(address_); + Unimplemented(); } void Resource::setActiveRename(VirtualGPU& gpu, GpuMemoryReference* rename) { diff --git a/rocclr/runtime/device/pal/palvirtual.cpp b/rocclr/runtime/device/pal/palvirtual.cpp index d8db321394..ce8c0aa518 100644 --- a/rocclr/runtime/device/pal/palvirtual.cpp +++ b/rocclr/runtime/device/pal/palvirtual.cpp @@ -384,7 +384,6 @@ void VirtualGPU::Queue::DumpMemoryReferences() const { } if (last_kernel_ != nullptr) { const amd::KernelSignature& signature = last_kernel_->signature(); - const amd::KernelParameters& params = last_kernel_->parameters(); dump << last_kernel_->name() << std::endl; for (size_t i = 0; i < signature.numParameters(); ++i) { const amd::KernelParameterDescriptor& desc = signature.at(i); @@ -1427,7 +1426,6 @@ void VirtualGPU::submitMapMemory(amd::MapMemoryCommand& vcmd) { vcmd.setStatus(CL_MAP_FAILURE); } } else if ((vcmd.memory().getType() == CL_MEM_OBJECT_IMAGE1D_BUFFER)) { - amd::Memory* bufferFromImage = nullptr; Memory* memoryBuf = memory; amd::Coord3D origin(vcmd.origin()[0]); amd::Coord3D size(vcmd.size()[0]); @@ -1435,7 +1433,7 @@ void VirtualGPU::submitMapMemory(amd::MapMemoryCommand& vcmd) { origin.c[0] *= elemSize; size.c[0] *= elemSize; - bufferFromImage = createBufferFromImage(vcmd.memory()); + amd::Memory* bufferFromImage = createBufferFromImage(vcmd.memory()); if (nullptr == bufferFromImage) { LogError("We should not fail buffer creation from image_buffer!"); } else { @@ -1531,7 +1529,6 @@ void VirtualGPU::submitUnmapMemory(amd::UnmapMemoryCommand& vcmd) { vcmd.setStatus(CL_OUT_OF_RESOURCES); } } else if ((vcmd.memory().getType() == CL_MEM_OBJECT_IMAGE1D_BUFFER)) { - amd::Memory* bufferFromImage = nullptr; Memory* memoryBuf = memory; amd::Coord3D origin(writeMapInfo->origin_[0]); amd::Coord3D size(writeMapInfo->region_[0]); @@ -1539,7 +1536,7 @@ void VirtualGPU::submitUnmapMemory(amd::UnmapMemoryCommand& vcmd) { origin.c[0] *= elemSize; size.c[0] *= elemSize; - bufferFromImage = createBufferFromImage(vcmd.memory()); + amd::Memory* bufferFromImage = createBufferFromImage(vcmd.memory()); if (nullptr == bufferFromImage) { LogError("We should not fail buffer creation from image_buffer!"); } else { @@ -1747,12 +1744,10 @@ void VirtualGPU::submitSvmFillMemory(amd::SvmFillMemoryCommand& vcmd) { if (!dev().isFineGrainedSystem()) { size_t patternSize = vcmd.patternSize(); size_t fillSize = patternSize * vcmd.times(); - size_t offset = 0; amd::Memory* dstMemory = amd::SvmManager::FindSvmBuffer(vcmd.dst()); assert(dstMemory && "No svm Buffer to fill with!"); - offset = reinterpret_cast(vcmd.dst()) - + size_t offset = reinterpret_cast(vcmd.dst()) - reinterpret_cast(dstMemory->getSvmPtr()); - assert((offset >= 0) && "wrong svm ptr to fill with!"); pal::Memory* memory = dev().getGpuMemory(dstMemory); @@ -1785,7 +1780,7 @@ void VirtualGPU::submitMigrateMemObjects(amd::MigrateMemObjectsCommand& vcmd) { profilingBegin(vcmd, true); std::vector::const_iterator itr; - for (itr = vcmd.memObjects().begin(); itr != vcmd.memObjects().end(); itr++) { + for (itr = vcmd.memObjects().begin(); itr != vcmd.memObjects().end(); ++itr) { // Find device memory pal::Memory* memory = dev().getGpuMemory(*itr); @@ -1814,7 +1809,7 @@ void VirtualGPU::submitSvmFreeMemory(amd::SvmFreeMemoryCommand& vcmd) { std::vector& svmPointers = vcmd.svmPointers(); if (vcmd.pfnFreeFunc() == nullptr) { // pointers allocated using clSVMAlloc - for (cl_uint i = 0; i < svmPointers.size(); i++) { + for (cl_uint i = 0; i < svmPointers.size(); ++i) { dev().svmFree(svmPointers[i]); } } else { @@ -2428,7 +2423,7 @@ void VirtualGPU::submitAcquireExtObjects(amd::AcquireExtObjectsCommand& vcmd) { profilingBegin(vcmd); for (std::vector::const_iterator it = vcmd.getMemList().begin(); - it != vcmd.getMemList().end(); it++) { + it != vcmd.getMemList().end(); ++it) { // amd::Memory object should never be nullptr assert(*it && "Memory object for interop is nullptr"); pal::Memory* memory = dev().getGpuMemory(*it); @@ -2467,7 +2462,7 @@ void VirtualGPU::submitReleaseExtObjects(amd::ReleaseExtObjectsCommand& vcmd) { profilingBegin(vcmd); for (std::vector::const_iterator it = vcmd.getMemList().begin(); - it != vcmd.getMemList().end(); it++) { + it != vcmd.getMemList().end(); ++it) { // amd::Memory object should never be nullptr assert(*it && "Memory object for interop is nullptr"); pal::Memory* memory = dev().getGpuMemory(*it); @@ -2992,7 +2987,6 @@ bool VirtualGPU::processMemObjectsHSA(const amd::Kernel& kernel, const_address p const amd::KernelParameterDescriptor& desc = signature.at(i); const HSAILKernel::Argument* arg = hsaKernel.argumentAt(i); Memory* memory = nullptr; - bool readOnly = false; amd::Memory* svmMem = nullptr; // Find if current argument is a buffer @@ -3024,7 +3018,7 @@ bool VirtualGPU::processMemObjectsHSA(const amd::Kernel& kernel, const_address p if (memory != nullptr) { // Check image - readOnly = (desc.accessQualifier_ == CL_KERNEL_ARG_ACCESS_READ_ONLY) ? true : false; + bool readOnly = (desc.accessQualifier_ == CL_KERNEL_ARG_ACCESS_READ_ONLY) ? true : false; // Check buffer readOnly |= (arg->access_ == HSAIL_ACCESS_TYPE_RO) ? true : false; // Validate memory for a dependency in the queue @@ -3236,7 +3230,7 @@ void VirtualGPU::submitTransferBufferFromFile(amd::TransferBufferFileCommand& cm } staging->cpuUnmap(*this); - bool result = blitMgr().copyBuffer(*staging, *mem, 0, dstOffset, dstSize, false); + blitMgr().copyBuffer(*staging, *mem, 0, dstOffset, dstSize, false); flushDMA(staging->getGpuEvent(*this)->engineId_); fileOffset += dstSize; dstOffset += dstSize; @@ -3248,7 +3242,7 @@ void VirtualGPU::submitTransferBufferFromFile(amd::TransferBufferFileCommand& cm Memory* staging = dev().getGpuMemory(&cmd.staging(idx)); size_t srcSize = amd::TransferBufferFileCommand::StagingBufferSize; srcSize = std::min(srcSize, copySize); - bool result = blitMgr().copyBuffer(*mem, *staging, srcOffset, 0, srcSize, false); + blitMgr().copyBuffer(*mem, *staging, srcOffset, 0, srcSize, false); void* srcBuffer = staging->cpuMap(*this); if (!cmd.file()->transferBlock(writeBuffer, srcBuffer, staging->size(), fileOffset, 0,