Ignore:
Timestamp:
Jun 14, 2017, 6:13:21 PM (2 years ago)
Author:
matszpk
Message:

CLRadeonExtender: CLRX: small typos. GalliumBinary/GalliumDisasm?: Add support new LLVM 3.9.0 (spilledGPR info) and new Mesa3D 17.0.

File:
1 edited

Legend:

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

    r2682 r3150  
    3636
    3737GalliumElfBinaryBase::GalliumElfBinaryBase() :
    38         progInfosNum(0), progInfoEntries(nullptr), disasmSize(0), disasmOffset(0)
     38        progInfosNum(0), progInfoEntries(nullptr), disasmSize(0), disasmOffset(0),
     39        llvm390(false)
    3940{ }
    4041
    4142template<typename ElfBinary>
    42 void GalliumElfBinaryBase::loadFromElf(ElfBinary& elfBinary)
     43void GalliumElfBinaryBase::loadFromElf(ElfBinary& elfBinary, size_t kernelsNum)
    4344{
    4445    uint16_t amdGpuConfigIndex = SHN_UNDEF;
     
    7475    // create amdGPU config systems
    7576    const auto& shdr = elfBinary.getSectionHeader(amdGpuConfigIndex);
    76     if ((ULEV(shdr.sh_size) % 24U) != 0)
     77    size_t shdrSize = ULEV(shdr.sh_size);
     78    size_t amdGPUConfigSize = (shdrSize / kernelsNum);
     79    if (amdGPUConfigSize != 24 && amdGPUConfigSize != 40 &&
     80        shdrSize % amdGPUConfigSize != 0)
    7781        throw Exception("Wrong size of .AMDGPU.config section!");
     82    llvm390 = amdGPUConfigSize==40;
    7883   
    7984    const bool hasProgInfoMap = (elfBinary.getCreationFlags() &
     
    97102        }
    98103    }
    99     if (progInfosNum*24U != ULEV(shdr.sh_size))
     104    if (progInfosNum*amdGPUConfigSize != ULEV(shdr.sh_size))
    100105        throw Exception("Number of symbol kernels doesn't match progInfos number!");
    101106    cxbyte* binaryCode = (cxbyte*)elfBinary.getBinaryCode();
     
    120125
    121126GalliumElfBinary32::GalliumElfBinary32(size_t binaryCodeSize, cxbyte* binaryCode,
    122            Flags creationFlags) : ElfBinary32(binaryCodeSize, binaryCode, creationFlags)
     127           Flags creationFlags, size_t kernelsNum) :
     128           ElfBinary32(binaryCodeSize, binaryCode, creationFlags)
    123129       
    124130{
    125     loadFromElf(static_cast<const ElfBinary32&>(*this));
     131    loadFromElf(static_cast<const ElfBinary32&>(*this), kernelsNum);
    126132}
    127133
     
    133139
    134140GalliumElfBinary64::GalliumElfBinary64(size_t binaryCodeSize, cxbyte* binaryCode,
    135            Flags creationFlags) : ElfBinary64(binaryCodeSize, binaryCode, creationFlags)
     141           Flags creationFlags, size_t kernelsNum) :
     142           ElfBinary64(binaryCodeSize, binaryCode, creationFlags)
    136143       
    137144{
    138     loadFromElf(static_cast<const ElfBinary64&>(*this));
     145    loadFromElf(static_cast<const ElfBinary64&>(*this), kernelsNum);
    139146}
    140147
     
    200207         binaryCodeSize(_binaryCodeSize), binaryCode(_binaryCode),
    201208         kernelsNum(0), sectionsNum(0), kernels(nullptr), sections(nullptr),
    202          elf64BitBinary(false)
     209         elf64BitBinary(false), mesa170(false)
    203210{
    204211    if (binaryCodeSize < 4)
     
    302309        section.offset = data-binaryCode;
    303310       
    304         if (!elfBinary && section.type == GalliumSectionType::TEXT)
    305         {
     311        if (!elfBinary && (section.type == GalliumSectionType::TEXT ||
     312            section.type == GalliumSectionType::TEXT_EXECUTABLE_170))
     313        {   // if new Mesa3D 17.0
     314            mesa170 = (section.type == GalliumSectionType::TEXT_EXECUTABLE_170);
    306315            if (section.size < sizeof(Elf32_Ehdr))
    307316                throw Exception("Wrong GalliumElfBinary size");
     
    310319            {   // 32-bit
    311320                elfBinary.reset(new GalliumElfBinary32(section.size, data,
    312                                  creationFlags>>GALLIUM_INNER_SHIFT));
     321                                 creationFlags>>GALLIUM_INNER_SHIFT, kernelsNum));
    313322                elf64BitBinary = false;
    314323            }
     
    317326                elfSectionId = section.sectionId;
    318327                elfBinary.reset(new GalliumElfBinary64(section.size, data,
    319                                  creationFlags>>GALLIUM_INNER_SHIFT));
     328                                 creationFlags>>GALLIUM_INNER_SHIFT, kernelsNum));
    320329                elf64BitBinary = true;
    321330            }
     
    362371    kinput.config.floatMode = 0xc0;
    363372    kinput.config.userDataNum = 4;
     373    kinput.config.spilledVGPRs = kinput.config.spilledSGPRs = 0;
    364374    kernels.push_back(std::move(kinput));
    365375}
Note: See TracChangeset for help on using the changeset viewer.