From 2a25ce7472a64963cfd6c49f026d4c235940629b Mon Sep 17 00:00:00 2001 From: Tim Rowley Date: Tue, 16 Aug 2016 12:40:47 -0600 Subject: swr: [rasterizer core] make dirtytile list point directly to macrotilequeues Speeds up high geometry HPC workloads. Signed-off-by: Tim Rowley --- src/gallium/drivers/swr/rasterizer/core/threads.cpp | 20 ++++++++++---------- src/gallium/drivers/swr/rasterizer/core/tilemgr.cpp | 3 ++- src/gallium/drivers/swr/rasterizer/core/tilemgr.h | 6 +++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/core/threads.cpp b/src/gallium/drivers/swr/rasterizer/core/threads.cpp index dce23b2486e..9665f09e2c8 100644 --- a/src/gallium/drivers/swr/rasterizer/core/threads.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/threads.cpp @@ -465,10 +465,12 @@ void WorkOnFifoBE( } // Grab the list of all dirty macrotiles. A tile is dirty if it has work queued to it. - std::vector ¯oTiles = pDC->pTileMgr->getDirtyTiles(); + auto ¯oTiles = pDC->pTileMgr->getDirtyTiles(); - for (uint32_t tileID : macroTiles) + for (auto tile : macroTiles) { + uint32_t tileID = tile->mId; + // Only work on tiles for this numa node uint32_t x, y; pDC->pTileMgr->getTileIndices(tileID, x, y); @@ -477,9 +479,7 @@ void WorkOnFifoBE( continue; } - MacroTileQueue &tile = pDC->pTileMgr->getMacroTileQueue(tileID); - - if (!tile.getNumQueued()) + if (!tile->getNumQueued()) { continue; } @@ -490,26 +490,26 @@ void WorkOnFifoBE( continue; } - if (tile.tryLock()) + if (tile->tryLock()) { BE_WORK *pWork; RDTSC_START(WorkerFoundWork); - uint32_t numWorkItems = tile.getNumQueued(); + uint32_t numWorkItems = tile->getNumQueued(); SWR_ASSERT(numWorkItems); - pWork = tile.peek(); + pWork = tile->peek(); SWR_ASSERT(pWork); if (pWork->type == DRAW) { pContext->pHotTileMgr->InitializeHotTiles(pContext, pDC, tileID); } - while ((pWork = tile.peek()) != nullptr) + while ((pWork = tile->peek()) != nullptr) { pWork->pfnWork(pDC, workerId, tileID, &pWork->desc); - tile.dequeue(); + tile->dequeue(); } RDTSC_STOP(WorkerFoundWork, numWorkItems, pDC->drawId); diff --git a/src/gallium/drivers/swr/rasterizer/core/tilemgr.cpp b/src/gallium/drivers/swr/rasterizer/core/tilemgr.cpp index e0aa8dd0307..1bd1805b52b 100644 --- a/src/gallium/drivers/swr/rasterizer/core/tilemgr.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/tilemgr.cpp @@ -54,11 +54,12 @@ void MacroTileMgr::enqueue(uint32_t x, uint32_t y, BE_WORK *pWork) MacroTileQueue &tile = mTiles[id]; tile.mWorkItemsFE++; + tile.mId = id; if (tile.mWorkItemsFE == 1) { tile.clear(mArena); - mDirtyTiles.push_back(id); + mDirtyTiles.push_back(&tile); } mWorkItemsProduced++; diff --git a/src/gallium/drivers/swr/rasterizer/core/tilemgr.h b/src/gallium/drivers/swr/rasterizer/core/tilemgr.h index 41d29ba0c7a..4ec02838ab9 100644 --- a/src/gallium/drivers/swr/rasterizer/core/tilemgr.h +++ b/src/gallium/drivers/swr/rasterizer/core/tilemgr.h @@ -95,6 +95,7 @@ struct MacroTileQueue ///@todo This will all be private. uint32_t mWorkItemsFE = 0; uint32_t mWorkItemsBE = 0; + uint32_t mId = 0; private: QUEUE mFifo; @@ -123,8 +124,7 @@ public: mDirtyTiles.clear(); } - INLINE std::vector& getDirtyTiles() { return mDirtyTiles; } - INLINE MacroTileQueue& getMacroTileQueue(uint32_t id) { return mTiles[id]; } + INLINE std::vector& getDirtyTiles() { return mDirtyTiles; } void markTileComplete(uint32_t id); INLINE bool isWorkComplete() @@ -145,7 +145,7 @@ private: std::unordered_map mTiles; // Any tile that has work queued to it is a dirty tile. - std::vector mDirtyTiles; + std::vector mDirtyTiles; OSALIGNLINE(LONG) mWorkItemsProduced { 0 }; OSALIGNLINE(volatile LONG) mWorkItemsConsumed { 0 }; -- cgit v1.2.3