diff --git a/rocclr/runtime/device/gpu/gpumemory.cpp b/rocclr/runtime/device/gpu/gpumemory.cpp index 45ae2e09c6..3dacc145fc 100644 --- a/rocclr/runtime/device/gpu/gpumemory.cpp +++ b/rocclr/runtime/device/gpu/gpumemory.cpp @@ -875,7 +875,9 @@ Memory::decIndMapCount() amd::ScopedLock lock(owner()->lockMemoryOps()); if (indirectMapCount_ == 0) { - LogError("decIndMapCount() called when indirectMapCount_ already zero"); + if (!mipMapped()) { + LogError("decIndMapCount() called when indirectMapCount_ already zero"); + } return; } diff --git a/rocclr/runtime/device/gpu/gpuresource.cpp b/rocclr/runtime/device/gpu/gpuresource.cpp index 96e7ad21da..0a197a615d 100644 --- a/rocclr/runtime/device/gpu/gpuresource.cpp +++ b/rocclr/runtime/device/gpu/gpuresource.cpp @@ -667,11 +667,11 @@ Resource::create(MemoryType memType, CreateParams* params, bool heap) viewLevel = imageView->level_; gslResource = imageView->resource_->gslResource(); viewOwner_ = imageView->resource_; - if ((viewLevel != 0) || (viewOwner_->cal()->mipLevels_ > 1)) { + if ((viewLevel != 0) || viewOwner_->mipMapped()) { viewFlags |= CAL_RESALLOCSLICEVIEW_LEVEL; } if ((viewOwner_->viewOwner_ != NULL) && - (viewOwner_->viewOwner_->cal()->mipLevels_ > 1)) { + viewOwner_->viewOwner_->mipMapped()) { mipLevelPitchPad = true; } @@ -1598,7 +1598,7 @@ Resource::map(VirtualGPU* gpu, uint flags, uint startLayer, uint numLayers) // Check if memory wasn't mapped yet if (++mapCount_ == 1) { if ((cal()->dimSize_ == 3) || cal()->imageArray_ || - ((cal()->type_ == ImageView) && (viewOwner_->cal()->mipLevels_ > 1))) { + ((cal()->type_ == ImageView) && viewOwner_->mipMapped())) { // Save map info for multilayer map/unmap startLayer_ = startLayer; numLayers_ = numLayers; @@ -1729,7 +1729,7 @@ Resource::unmap(VirtualGPU* gpu) // Check if it's the last unmap if (count == 0) { if ((cal()->dimSize_ == 3) || cal()->imageArray_ || - ((cal()->type_ == ImageView) && (viewOwner_->cal()->mipLevels_ > 1))) { + ((cal()->type_ == ImageView) && viewOwner_->mipMapped())) { // Unmap layers unmapLayers(gpu); } diff --git a/rocclr/runtime/device/gpu/gpuresource.hpp b/rocclr/runtime/device/gpu/gpuresource.hpp index 8eeba3e905..c0aaf4c25a 100644 --- a/rocclr/runtime/device/gpu/gpuresource.hpp +++ b/rocclr/runtime/device/gpu/gpuresource.hpp @@ -277,6 +277,9 @@ public: //! Returns global memory offset uint64_t vmAddress() const { return gslResource()->getSurfaceAddress(); } + //! Returns global memory offset + bool mipMapped() const { return (cal()->mipLevels_ > 1) ? true : false; } + //! Checks if persistent memory can have a direct map bool isPersistentDirectMap() const;