From 8d65e72045a1ee220f8147f2288bb5075db3e76a Mon Sep 17 00:00:00 2001 From: Oak Zeng Date: Thu, 8 Nov 2018 12:24:13 -0500 Subject: [PATCH] Move m_Type to a local variable BaseQueue class has a member function GetQueueType so m_Type is duplicated. m_Type is only used in one function. Move it to a local variable. Change-Id: Ice144cf723178dd628cb49261c23d10605f9ee7d Signed-off-by: Oak Zeng --- tests/kfdtest/src/BaseQueue.cpp | 9 ++++----- tests/kfdtest/src/BaseQueue.hpp | 1 - 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/kfdtest/src/BaseQueue.cpp b/tests/kfdtest/src/BaseQueue.cpp index e8a65ff10a..635dd12692 100644 --- a/tests/kfdtest/src/BaseQueue.cpp +++ b/tests/kfdtest/src/BaseQueue.cpp @@ -28,8 +28,7 @@ #include "hsakmt.h" BaseQueue::BaseQueue() - :m_Type(HSA_QUEUE_TYPE_SIZE), - m_QueueBuf(NULL), + :m_QueueBuf(NULL), m_SkipWaitConsumption(true) { } @@ -39,6 +38,7 @@ BaseQueue::~BaseQueue(void) { HSAKMT_STATUS BaseQueue::Create(unsigned int NodeId, unsigned int size, HSAuint64 *pointers) { HSAKMT_STATUS status; + HSA_QUEUE_TYPE type = GetQueueType(); if (m_QueueBuf != NULL) { // Queue already exists, one queue per object @@ -47,16 +47,15 @@ HSAKMT_STATUS BaseQueue::Create(unsigned int NodeId, unsigned int size, HSAuint6 memset(&m_Resources, 0, sizeof(m_Resources)); - m_Type = GetQueueType(); m_QueueBuf = new HsaMemoryBuffer(size, NodeId, true/*zero*/, false/*local*/, true/*exec*/); - if (m_Type == HSA_QUEUE_COMPUTE_AQL) { + if (type == HSA_QUEUE_COMPUTE_AQL) { m_Resources.Queue_read_ptr_aql = &pointers[0]; m_Resources.Queue_write_ptr_aql = &pointers[1]; } status = hsaKmtCreateQueue(NodeId, - m_Type, + type, DEFAULT_QUEUE_PERCENTAGE, DEFAULT_PRIORITY, m_QueueBuf->As(), diff --git a/tests/kfdtest/src/BaseQueue.hpp b/tests/kfdtest/src/BaseQueue.hpp index ba0464a6e0..9d354448fa 100644 --- a/tests/kfdtest/src/BaseQueue.hpp +++ b/tests/kfdtest/src/BaseQueue.hpp @@ -95,7 +95,6 @@ class BaseQueue { unsigned int CMD_NOP; unsigned int m_pendingWptr; HSAuint64 m_pendingWptr64; - HSA_QUEUE_TYPE m_Type; HsaQueueResource m_Resources; HsaMemoryBuffer *m_QueueBuf; unsigned int m_Node;