Ignore:
Timestamp:
Sep 28, 2017, 12:06:39 PM (2 years ago)
Author:
matszpk
Message:

CLRadeonExtender: Move tables with arch values (arch versions) to GPUId.

File:
1 edited

Legend:

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

    r3420 r3443  
    133133}
    134134
    135 struct AMDGPUArchValuesEntry
    136 {
    137     uint32_t major;
    138     uint32_t minor;
    139     uint32_t stepping;
    140     GPUDeviceType deviceType;
    141 };
    142 
    143 // list of AMDGPU arch entries for GPU devices
    144 static const AMDGPUArchValuesEntry amdGpuArchValuesTbl[] =
    145 {
    146     { 0, 0, 0, GPUDeviceType::CAPE_VERDE },
    147     { 7, 0, 0, GPUDeviceType::BONAIRE },
    148     { 7, 0, 1, GPUDeviceType::HAWAII },
    149     { 8, 0, 0, GPUDeviceType::ICELAND },
    150     { 8, 0, 1, GPUDeviceType::CARRIZO },
    151     { 8, 0, 2, GPUDeviceType::ICELAND },
    152     { 8, 0, 3, GPUDeviceType::FIJI },
    153     { 8, 0, 4, GPUDeviceType::FIJI },
    154     { 8, 1, 0, GPUDeviceType::STONEY },
    155     { 9, 0, 0, GPUDeviceType::GFX900 },
    156     { 9, 0, 1, GPUDeviceType::GFX901 }
    157 };
    158 
    159 static const size_t amdGpuArchValuesNum = sizeof(amdGpuArchValuesTbl) /
    160                 sizeof(AMDGPUArchValuesEntry);
    161 
    162 
    163135/// determint GPU device from ROCm notes
    164136GPUDeviceType ROCmBinary::determineGPUDeviceType(uint32_t& outArchMinor,
     
    196168    }
    197169    // determine device type
    198     GPUDeviceType deviceType = GPUDeviceType::CAPE_VERDE;
    199     // choose lowest GPU device by archMajor by default
    200     if (archMajor==0)
    201         deviceType = GPUDeviceType::CAPE_VERDE;
    202     else if (archMajor==7)
    203         deviceType = GPUDeviceType::BONAIRE;
    204     else if (archMajor==8)
    205         deviceType = GPUDeviceType::ICELAND;
    206     else if (archMajor==9)
    207         deviceType = GPUDeviceType::GFX900;
    208    
    209     // recognize device type by arch major, minor and stepping
    210     for (cxuint i = 0; i < amdGpuArchValuesNum; i++)
    211         if (amdGpuArchValuesTbl[i].major==archMajor &&
    212             amdGpuArchValuesTbl[i].minor==archMinor &&
    213             amdGpuArchValuesTbl[i].stepping==archStepping)
    214         {
    215             deviceType = amdGpuArchValuesTbl[i].deviceType;
    216             break;
    217         }
     170    GPUDeviceType deviceType = getGPUDeviceTypeFromArchValues(archMajor, archMinor,
     171                                    archStepping);
    218172    outArchMinor = archMinor;
    219173    outArchStepping = archStepping;
     
    315269};
    316270
    317 static const AMDGPUArchValues rocmAmdGpuArchValuesTbl[] =
    318 {
    319     { 0, 0, 0 }, // GPUDeviceType::CAPE_VERDE
    320     { 0, 0, 0 }, // GPUDeviceType::PITCAIRN
    321     { 0, 0, 0 }, // GPUDeviceType::TAHITI
    322     { 0, 0, 0 }, // GPUDeviceType::OLAND
    323     { 7, 0, 0 }, // GPUDeviceType::BONAIRE
    324     { 7, 0, 0 }, // GPUDeviceType::SPECTRE
    325     { 7, 0, 0 }, // GPUDeviceType::SPOOKY
    326     { 7, 0, 0 }, // GPUDeviceType::KALINDI
    327     { 0, 0, 0 }, // GPUDeviceType::HAINAN
    328     { 7, 0, 1 }, // GPUDeviceType::HAWAII
    329     { 8, 0, 0 }, // GPUDeviceType::ICELAND
    330     { 8, 0, 0 }, // GPUDeviceType::TONGA
    331     { 7, 0, 0 }, // GPUDeviceType::MULLINS
    332     { 8, 0, 3 }, // GPUDeviceType::FIJI
    333     { 8, 0, 1 }, // GPUDeviceType::CARRIZO
    334     { 8, 0, 1 }, // GPUDeviceType::DUMMY
    335     { 8, 0, 4 }, // GPUDeviceType::GOOSE
    336     { 8, 0, 4 }, // GPUDeviceType::HORSE
    337     { 8, 0, 1 }, // GPUDeviceType::STONEY
    338     { 8, 0, 4 }, // GPUDeviceType::ELLESMERE
    339     { 8, 0, 4 }, // GPUDeviceType::BAFFIN
    340     { 8, 0, 4 }, // GPUDeviceType::GFX804
    341     { 9, 0, 0 }, // GPUDeviceType::GFX900
    342     { 9, 0, 1 }  // GPUDeviceType::GFX901
    343 };
    344 
    345271void ROCmBinGenerator::generateInternal(std::ostream* osPtr, std::vector<char>* vPtr,
    346272             Array<cxbyte>* aPtr) const
    347273{
    348     AMDGPUArchValues amdGpuArchValues = rocmAmdGpuArchValuesTbl[cxuint(input->deviceType)];
     274    AMDGPUArchValues amdGpuArchValues = getGPUArchValues(input->deviceType,
     275                GPUArchValuesTable::OPENSOURCE);
    349276    if (input->archMinor!=UINT32_MAX)
    350277        amdGpuArchValues.minor = input->archMinor;
Note: See TracChangeset for help on using the changeset viewer.