Changeset 2540 in CLRX


Ignore:
Timestamp:
Nov 6, 2016, 6:19:18 PM (4 years ago)
Author:
matszpk
Message:

CLRadeonExtender: ElfBinaries?: Add skipFirst (skip STN_UNDEF) to hashtable routines.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/amdbin/ElfBinaries.cpp

    r2539 r2540  
    534534
    535535/// return bucket number
    536 static uint32_t optimizeHashBucketsNum(uint32_t hashNum, const uint32_t* hashCodes)
     536static uint32_t optimizeHashBucketsNum(uint32_t hashNum, bool skipFirst,
     537                           const uint32_t* hashCodes)
    537538{
    538539    uint32_t bestBucketNum = 0;
     
    548549        std::fill(chainLengths.get(), chainLengths.get() + buckets, 0U);
    549550        // calculate chain lengths
    550         for (size_t i = 0; i < hashNum; i++)
     551        for (size_t i = skipFirst; i < hashNum; i++)
    551552            chainLengths[hashCodes[i] % buckets]++;
    552553        /// value, smaller is better
     
    563564}
    564565
    565 static void createHashTable(uint32_t bucketsNum, uint32_t hashNum,
     566static void createHashTable(uint32_t bucketsNum, uint32_t hashNum, bool skipFirst,
    566567                           const uint32_t* hashCodes, uint32_t* output)
    567568{
     
    575576    std::unique_ptr<uint32_t[]> lastNodes(new uint32_t[bucketsNum]);
    576577    std::fill(lastNodes.get(), lastNodes.get() + bucketsNum, UINT32_MAX);
    577     for (uint32_t i = 0; i < hashNum; i++)
     578    for (uint32_t i = skipFirst; i < hashNum; i++)
    578579    {
    579580        const uint32_t bucket = hashCodes[i] % bucketsNum;
Note: See TracChangeset for help on using the changeset viewer.