From 8ef5da00c76aaca1b1bbd59aeeefcc22596a9ddc Mon Sep 17 00:00:00 2001 From: Jason Tang Date: Sat, 1 Aug 2020 12:55:11 -0400 Subject: [PATCH] SWDEV-246687 - Do not use std::vector reference as class member cuMask_ The current implementation creates default reference in the stack and assigns it to class member cuMasks_, so whenever the content of the stack changes, cuMask_ would change. Change-Id: Iefab63c335d504b83c4ae90bd34ae76c6afb8f3c --- rocclr/device/rocm/rocvirtual.cpp | 4 ++-- rocclr/device/rocm/rocvirtual.hpp | 2 +- rocclr/platform/commandqueue.hpp | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/rocclr/device/rocm/rocvirtual.cpp b/rocclr/device/rocm/rocvirtual.cpp index 09f1fea156..88dca80160 100644 --- a/rocclr/device/rocm/rocvirtual.cpp +++ b/rocclr/device/rocm/rocvirtual.cpp @@ -492,7 +492,7 @@ bool VirtualGPU::dispatchGenericAqlPacket( // NOTE: need multiple packets to dispatch the performance counter // packet blob of the legacy devices (gfx8) for (uint i = 0; i < size; i++, index++, packet++) { - AqlPacket* aql_loc = &((AqlPacket*)(gpu_queue_->base_address))[index & queueMask]; + AqlPacket* aql_loc = &((AqlPacket*)(gpu_queue_->base_address))[index & queueMask]; *aql_loc = *packet; if (header != 0) { packet_store_release(reinterpret_cast(aql_loc), header, rest); @@ -503,7 +503,7 @@ bool VirtualGPU::dispatchGenericAqlPacket( "group_seg_size=%zu, kernel_obj=0x%zx, kernarg_address=0x%zx, completion_signal=0x%zx", std::this_thread::get_id(), gpu_queue_, header, extractAqlBits(header, HSA_PACKET_HEADER_TYPE, HSA_PACKET_HEADER_WIDTH_TYPE), - extractAqlBits(header, HSA_PACKET_HEADER_BARRIER, + extractAqlBits(header, HSA_PACKET_HEADER_BARRIER, HSA_PACKET_HEADER_WIDTH_BARRIER), extractAqlBits(header, HSA_PACKET_HEADER_SCACQUIRE_FENCE_SCOPE, HSA_PACKET_HEADER_WIDTH_SCACQUIRE_FENCE_SCOPE), diff --git a/rocclr/device/rocm/rocvirtual.hpp b/rocclr/device/rocm/rocvirtual.hpp index 6266553caf..862a2dd593 100644 --- a/rocclr/device/rocm/rocvirtual.hpp +++ b/rocclr/device/rocm/rocvirtual.hpp @@ -368,7 +368,7 @@ class VirtualGPU : public device::VirtualDevice { uint16_t dispatchPacketHeader_; //!< bit-vector representing the CU mask. Each active bit represents using one CU - const std::vector& cuMask_; + const std::vector cuMask_; amd::CommandQueue::Priority priority_; //!< The priority for the hsa queue }; diff --git a/rocclr/platform/commandqueue.hpp b/rocclr/platform/commandqueue.hpp index fbe7b5b401..50a2faf06d 100644 --- a/rocclr/platform/commandqueue.hpp +++ b/rocclr/platform/commandqueue.hpp @@ -131,14 +131,14 @@ class CommandQueue : public RuntimeObject { context_(context), cuMask_(cuMask){} - Properties properties_; //!< Queue properties - uint rtCUs_; //!< The number of used RT compute units - Priority priority_; //!< Queue priority - Monitor queueLock_; //!< Lock protecting the queue - Monitor lastCmdLock_; //!< Lock protecting the last queued command - Device& device_; //!< The device - SharedReference context_; //!< The context of this command queue - const std::vector& cuMask_; //!< The CU mask + Properties properties_; //!< Queue properties + uint rtCUs_; //!< The number of used RT compute units + Priority priority_; //!< Queue priority + Monitor queueLock_; //!< Lock protecting the queue + Monitor lastCmdLock_; //!< Lock protecting the last queued command + Device& device_; //!< The device + SharedReference context_; //!< The context of this command queue + const std::vector cuMask_; //!< The CU mask private: //! Disable copy constructor