Changeset 4931 in CLRX


Ignore:
Timestamp:
Aug 25, 2019, 12:48:28 PM (3 weeks ago)
Author:
matszpk
Message:

CLRadeonExtender: ROCm: Rewrite getKernelDescriptor in ROCmBinary. Remove obsolete structures for DisasmROCm. Next stuff for LLVM10 binformat in disassembler.

Location:
CLRadeonExtender/trunk
Files:
4 edited

Legend:

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

    r4929 r4931  
    298298};
    299299
    300 /// disasm ROCm kernel input
    301 struct ROCmDisasmKernelInput
    302 {
    303     CString kernelName; ///< kernel name
    304     const cxbyte* setup;    ///< setup
    305     size_t codeSize;    ///< code size
    306     size_t offset;      ///< kernel offset
    307 };
    308 
    309300/// disasm ROCm region
    310301struct ROCmDisasmRegionInput
     
    335326    const char* metadata;   ///< metadata
    336327    Array<std::pair<CString, size_t> > gotSymbols; ///< GOT symbols names
     328    std::vector<const ROCmKernelDescriptor*> kernelDescs; ///< kernel descriptors
    337329};
    338330
  • CLRadeonExtender/trunk/CLRX/amdbin/ROCmBinaries.h

    r4928 r4931  
    328328   
    329329    /// get kernel descriptor
    330     const ROCmKernelDescriptor& getKernelDescriptor(size_t index) const
    331     {
    332         if (kernelDescs[index]==nullptr)
    333             throw BinException("No kernel descriptor for region index");
    334         return *(kernelDescs[index]);
    335     }
     330    const ROCmKernelDescriptor* getKernelDescriptor(size_t index) const
     331    { return kernelDescs[index]; }
    336332    // get kernel descriptor by name
    337     const ROCmKernelDescriptor& getKernelDescriptor(const char* name) const;
     333    const ROCmKernelDescriptor* getKernelDescriptor(const char* name) const;
    338334   
    339335    /// get target
  • CLRadeonExtender/trunk/amdasm/DisasmROCm.cpp

    r4930 r4931  
    5252        input->regions[i] = { region.regionName, size_t(region.size),
    5353            size_t(region.offset - codeOffset), region.type };
     54    }
     55    if (binary.isLLVM10BinaryFormat())
     56    {
     57        input->kernelDescs.resize(regionsNum);
     58        for (size_t i = 0; i < regionsNum; i++)
     59            input->kernelDescs[i] = binary.getKernelDescriptor(i);
    5460    }
    5561   
     
    10631069            if (doDumpConfig)
    10641070            {
    1065                 dumpKernelConfig(output, maxSgprsNum, arch,
    1066                      *reinterpret_cast<const ROCmKernelConfig*>(
    1067                              rocmInput->code + rinput.offset));
     1071                if (!rocmInput->llvm10BinFormat)
     1072                    dumpKernelConfig(output, maxSgprsNum, arch,
     1073                        *reinterpret_cast<const ROCmKernelConfig*>(
     1074                                rocmInput->code + rinput.offset));
     1075                else
     1076                {
     1077                }
    10681078               
    10691079                if (!haveMetadataInfo)
  • CLRadeonExtender/trunk/amdbin/ROCmBinaries.cpp

    r4928 r4931  
    378378}
    379379
    380 const ROCmKernelDescriptor& ROCmBinary::getKernelDescriptor(const char* name) const
     380const ROCmKernelDescriptor* ROCmBinary::getKernelDescriptor(const char* name) const
    381381{
    382382    RegionMap::const_iterator it = binaryMapFind(regionsMap.begin(),
     
    384384    if (it == regionsMap.end())
    385385        throw BinException("Can't find kernel descriptor name");
    386     if (kernelDescs[it->second]==nullptr)
    387         throw BinException("No kernel descriptor for region name");
    388     return *(kernelDescs[it->second]);
     386    return kernelDescs[it->second];
    389387}
    390388
Note: See TracChangeset for help on using the changeset viewer.