Changeset 3151 in CLRX


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

CLRadeonExtender: GalliumDisasm?: Correct handling progInfo with 5 entries (in dumpConfig and printing progInfo).

Location:
CLRadeonExtender/trunk
Files:
4 edited

Legend:

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

    r3150 r3151  
    308308{
    309309    CString kernelName;   ///< kernel's name
    310     GalliumProgInfoEntry progInfo[3];   ///< program info for kernel
     310    GalliumProgInfoEntry progInfo[5];   ///< program info for kernel
    311311    uint32_t offset;    ///< offset of kernel code
    312312    std::vector<GalliumArgInfo> argInfos;   ///< arguments
  • CLRadeonExtender/trunk/CLRX/amdbin/GalliumBinaries.h

    r3150 r3151  
    397397{
    398398    bool is64BitElf;   ///< is 64-bit elf binary
     399    bool isLLVM390;
     400    bool isMesa170;
    399401    GPUDeviceType deviceType;   ///< GPU device type
    400402    size_t globalDataSize;  ///< global constant data size
  • CLRadeonExtender/trunk/amdasm/DisasmGallium.cpp

    r3150 r3151  
    5858    input->isMesa170 = binary.isMesa170();
    5959    input->isLLVM390 = elfBin.isLLVM390();
     60    const cxuint progInfoEntriesNum = input->isLLVM390 ? 5 : 3;
    6061    // kernels
    6162    input->kernels.resize(binary.getKernelsNum());
     
    6465        const GalliumKernel& kernel = binary.getKernel(i);
    6566        const GalliumProgInfoEntry* progInfo = elfBin.getProgramInfo(i);
    66         GalliumProgInfoEntry outProgInfo[3];
    67         for (cxuint k = 0; k < 3; k++)
     67        GalliumProgInfoEntry outProgInfo[5];
     68        for (cxuint k = 0; k < progInfoEntriesNum; k++)
    6869        {
    6970            outProgInfo[k].address = ULEV(progInfo[k].address);
    7071            outProgInfo[k].value = ULEV(progInfo[k].value);
    7172        }
    72         input->kernels[i] = { kernel.kernelName,
    73             {outProgInfo[0],outProgInfo[1],outProgInfo[2]}, kernel.offset,
     73        input->kernels[i] = { kernel.kernelName, {}, kernel.offset,
    7474            std::vector<GalliumArgInfo>(kernel.argInfos.begin(), kernel.argInfos.end()) };
     75        std::copy(outProgInfo, outProgInfo+progInfoEntriesNum, input->kernels[i].progInfo);
    7576    }
    7677    input->code = elfBin.getSectionContent(textIndex);
     
    108109
    109110static void dumpKernelConfig(std::ostream& output, cxuint maxSgprsNum,
    110              GPUArchitecture arch, const GalliumProgInfoEntry* progInfo)
     111             GPUArchitecture arch, const GalliumProgInfoEntry* progInfo, bool isLLVM390)
    111112{
    112113    output.write("    .config\n", 12);
     
    117118    const uint32_t pgmRsrc2 = progInfo[1].value;
    118119    const uint32_t scratchVal = progInfo[2].value;
     120    const uint32_t spilledSGPRs = progInfo[3].value;
     121    const uint32_t spilledVGPRs = progInfo[4].value;
    119122   
    120123    const cxuint dimMask = (pgmRsrc2 >> 7) & 7;
     
    174177    bufSize = snprintf(buf, 100, "        .pgmrsrc2 0x%08x\n", pgmRsrc2);
    175178    output.write(buf, bufSize);
     179    if (isLLVM390)
     180    {
     181        bufSize = snprintf(buf, 100, "        .spilledsgprs %d\n", spilledSGPRs);
     182        output.write(buf, bufSize);
     183        bufSize = snprintf(buf, 100, "        .spilledvgprs %d\n", spilledVGPRs);
     184        output.write(buf, bufSize);
     185    }
    176186}
    177187
     
    259269            if (!doDumpConfig)
    260270            {   /// proginfo
     271                const cxuint progInfoEntriesNum = galliumInput->isLLVM390 ? 5 : 3;
    261272                output.write("    .proginfo\n", 14);
    262                 for (const GalliumProgInfoEntry& piEntry: kinput.progInfo)
     273                for (cxuint k = 0; k < progInfoEntriesNum; k++)
    263274                {
     275                    const GalliumProgInfoEntry& piEntry = kinput.progInfo[k];
    264276                    output.write("        .entry ", 15);
    265277                    char buf[32];
     
    274286            }
    275287            else
    276                 dumpKernelConfig(output, maxSgprsNum, arch, kinput.progInfo);
     288                dumpKernelConfig(output, maxSgprsNum, arch, kinput.progInfo,
     289                    galliumInput->isLLVM390);
    277290        }
    278291        isaDisassembler->addNamedLabel(kinput.offset, kinput.kernelName);
  • CLRadeonExtender/trunk/amdbin/GalliumBinaries.cpp

    r3150 r3151  
    8181        throw Exception("Wrong size of .AMDGPU.config section!");
    8282    llvm390 = amdGPUConfigSize==40;
     83    const cxuint progInfoEntriesNum = amdGPUConfigSize>>3;
    8384   
    8485    const bool hasProgInfoMap = (elfBinary.getCreationFlags() &
     
    9899                throw Exception("kernel symbol offset out of range");
    99100            if (hasProgInfoMap)
    100                 progInfoEntryMap[progInfosNum] = std::make_pair(symName, 3*progInfosNum);
     101                progInfoEntryMap[progInfosNum] = std::make_pair(symName,
     102                                progInfoEntriesNum*progInfosNum);
    101103            progInfosNum++;
    102104        }
     
    392394        : manageable(true), input(nullptr)
    393395{
    394     input = new GalliumInput{ _64bitMode, deviceType, globalDataSize, globalData, kernels,
    395             codeSize, code, 0, nullptr };
     396    input = new GalliumInput{ _64bitMode, false, false, deviceType, globalDataSize,
     397            globalData, kernels, codeSize, code, 0, nullptr };
    396398}
    397399
     
    402404        : manageable(true), input(nullptr)
    403405{
    404     input = new GalliumInput{ _64bitMode, deviceType, globalDataSize, globalData,
    405         std::move(kernels), codeSize, code, 0, nullptr };
     406    input = new GalliumInput{ _64bitMode, false, false, deviceType, globalDataSize,
     407            globalData, std::move(kernels), codeSize, code, 0, nullptr };
    406408}
    407409
Note: See TracChangeset for help on using the changeset viewer.