Changeset 3150 in CLRX


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.

Location:
CLRadeonExtender/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/CLRX/amdasm/Disassembler.h

    r3074 r3150  
    318318    GPUDeviceType deviceType;   ///< GPU device type
    319319    bool is64BitMode;       ///< true if 64-bit mode of addressing
     320    bool isLLVM390;
     321    bool isMesa170;
    320322    size_t globalDataSize;  ///< global (constants for kernels) data size
    321323    const cxbyte* globalData;   ///< global (constants for kernels) data
  • CLRadeonExtender/trunk/CLRX/amdbin/GalliumBinaries.h

    r2682 r3150  
    117117    DATA_LOCAL,     ///< local data (???)
    118118    DATA_PRIVATE,   ///< private data (???)
    119     MAX_VALUE = DATA_PRIVATE    ///< last value
     119    TEXT_INTERMEDIATE_170 = 0,
     120    TEXT_LIBRARY_170,
     121    TEXT_EXECUTABLE_170,
     122    DATA_CONSTANT_170,
     123    DATA_GLOBAL_170,
     124    DATA_LOCAL_170,
     125    DATA_PRIVATE_170,
     126    MAX_VALUE = DATA_PRIVATE_170    ///< last value
    120127};
    121128
     
    141148    size_t disasmSize;  ///< disassembly size
    142149    size_t disasmOffset;    ///< disassembly offset
     150    bool llvm390;
    143151   
    144152    /// routine to load binary fro internal ELF
    145153    template<typename ElfBinary>
    146     void loadFromElf(ElfBinary& elfBinary);
     154    void loadFromElf(ElfBinary& elfBinary, size_t kernelsNum);
    147155public:
    148156    /// empty constructor
     
    183191    size_t getDisassemblySize() const
    184192    { return disasmSize; }
     193   
     194    bool isLLVM390() const
     195    { return llvm390; }
    185196};
    186197
     
    198209    GalliumElfBinary32();
    199210    /// constructor
    200     GalliumElfBinary32(size_t binaryCodeSize, cxbyte* binaryCode, Flags creationFlags);
     211    GalliumElfBinary32(size_t binaryCodeSize, cxbyte* binaryCode, Flags creationFlags,
     212            size_t kernelsNum);
    201213    /// destructor
    202214    virtual ~GalliumElfBinary32();
     
    218230    GalliumElfBinary64();
    219231    /// constructor
    220     GalliumElfBinary64(size_t binaryCodeSize, cxbyte* binaryCode, Flags creationFlags);
     232    GalliumElfBinary64(size_t binaryCodeSize, cxbyte* binaryCode, Flags creationFlags,
     233            size_t kernelsNum);
    221234    /// destructor
    222235    virtual ~GalliumElfBinary64();
     
    246259    bool elf64BitBinary;
    247260    std::unique_ptr<GalliumElfBinaryBase> elfBinary;
     261    bool mesa170;
     262   
    248263public:
    249264    /// constructor
     
    329344    const GalliumKernel& getKernel(const char* name) const
    330345    { return kernels[getKernelIndex(name)]; }
     346   
     347    bool isMesa170() const
     348    { return mesa170; };
    331349};
    332350
     
    360378    size_t localSize; ///< used local size (not local defined in kernel arguments)
    361379    uint32_t scratchBufferSize; ///< size of scratch buffer
     380    cxuint spilledVGPRs;
     381    cxuint spilledSGPRs;
    362382};
    363383
  • CLRadeonExtender/trunk/amdasm/DisasmGallium.cpp

    r2682 r3150  
    5656        input->globalData = nullptr;
    5757    }
     58    input->isMesa170 = binary.isMesa170();
     59    input->isLLVM390 = elfBin.isLLVM390();
    5860    // kernels
    5961    input->kernels.resize(binary.getKernelsNum());
     
    194196        printDisasmData(galliumInput->globalDataSize, galliumInput->globalData, output);
    195197    }
     198    if (galliumInput->isLLVM390)
     199        output.write(".llvm390\n", 9);
     200    if (galliumInput->isMesa170)
     201        output.write(".mesa170\n", 9);
    196202   
    197203    const GPUArchitecture arch = getGPUArchitectureFromDeviceType(galliumInput->deviceType);
  • 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}
  • CLRadeonExtender/trunk/doc/GcnInstrsVop1.md

    r2468 r3150  
    6060NOTE: OMOD and CLAMP modifier affects only for instruction that output is
    6161floating point value. 
    62 NOTE: ABS and negation is applied to source operand for any instruction.
     62NOTE: ABS and negation is applied to source operand for any instruction. 
     63NOTE: OMOD modifier doesn't work for half precision (FP16) instructions.
    6364
    6465Negation and absolute value can be combined: `-ABS(V0)`. Modifiers CLAMP and
  • CLRadeonExtender/trunk/doc/GcnInstrsVop2.md

    r3149 r3150  
    6262floating point value. 
    6363NOTE: ABS and negation is applied to source operand for any instruction. 
    64 OMOD: OMOD modifier doesn't work for half precision (FP16) instructions (except V_MAC_F16).
     64NOTE: OMOD modifier doesn't work for half precision (FP16) instructions (except V_MAC_F16).
    6565
    6666Negation and absolute value can be combined: `-ABS(V0)`. Modifiers CLAMP and
  • CLRadeonExtender/trunk/tests/amdasm/DisasmDataTest.cpp

    r2682 r3150  
    185185static const GalliumDisasmInput galliumDisasmData =
    186186{
    187     GPUDeviceType::PITCAIRN, false,
     187    GPUDeviceType::PITCAIRN, false, false, false,
    188188    sizeof(galliumInput1Global), galliumInput1Global,
    189189    {
Note: See TracChangeset for help on using the changeset viewer.