Ignore:
Timestamp:
Feb 3, 2018, 1:41:12 PM (2 years ago)
Author:
matszpk
Message:

CLRadeonExtender: AmdCL2: Handle vectypehint and work_group_size_hint in kernel metadata. Add '.vectypehint' and '.work_group_size_hint' pseudo-ops
to AmdCL2 format handling. Add new pseudo-ops to editor's syntaxes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/tests/amdbin/AmdCL2BinGen.cpp

    r3575 r3712  
    221221    typedef AmdCL2MainGPUBinary32 MainBinary;
    222222    typedef AmdCL2GPUMetadataHeader32 MetadataHeader;
     223    typedef AmdCL2GPUMetadataHeaderEnd32 MetadataHeaderEnd;
    223224    typedef AmdCL2GPUKernelArgEntry32 KernelArgEntry;
    224225    static const KernelArgType wordType = KernelArgType::INT;
     226    static const size_t newMetadataHeaderSize = 0xa4;
    225227};
    226228
     
    229231    typedef AmdCL2MainGPUBinary64 MainBinary;
    230232    typedef AmdCL2GPUMetadataHeader64 MetadataHeader;
     233    typedef AmdCL2GPUMetadataHeaderEnd64 MetadataHeaderEnd;
    231234    typedef AmdCL2GPUKernelArgEntry64 KernelArgEntry;
    232235    static const KernelArgType wordType = KernelArgType::LONG;
     236    static const size_t newMetadataHeaderSize = 0x110;
    233237};
    234238
     
    245249    for (size_t i = 0; i < 3; i++)
    246250        config.reqdWorkGroupSize[i] = ULEV(mdHdr->reqdWorkGroupSize[i]);
     251    for (size_t i = 0; i < 3; i++)
     252        config.workGroupSizeHint[i] = 0;
    247253    const IntAmdCL2SetupData* setupData =
    248254            reinterpret_cast<const IntAmdCL2SetupData*>(setup + 48);
     
    286292    config.samplers.resize(std::unique(config.samplers.begin(), config.samplers.end()) -
    287293                config.samplers.begin());
     294   
     295    size_t vecTypeHintLength = 0;
     296    if (headerSize >= Types::newMetadataHeaderSize)
     297    {
     298        const typename Types::MetadataHeaderEnd* hdrEnd =
     299            reinterpret_cast<const typename Types::MetadataHeaderEnd*>(
     300                metadata +  Types::newMetadataHeaderSize -
     301                        sizeof(typename Types::MetadataHeaderEnd));
     302        for (cxuint k = 0; k < 3; k++)
     303            config.workGroupSizeHint[k] = ULEV(hdrEnd->workGroupSizeHint[k]);
     304        vecTypeHintLength = ULEV(hdrEnd->vecTypeHintLength);
     305    }
    288306    // get kernel args
    289307    size_t argOffset = headerSize + ULEV(mdHdr->firstNameLength) +
    290308            ULEV(mdHdr->secondNameLength)+2;
    291     if (ULEV(*((const uint32_t*)(metadata+argOffset))) ==
     309    if (vecTypeHintLength!=0 || ULEV(*((const uint32_t*)(metadata+argOffset))) ==
    292310            (sizeof(typename Types::KernelArgEntry)<<8))
    293         argOffset++;
     311    {
     312        config.vecTypeHint.assign((const char*)metadata + argOffset, vecTypeHintLength);
     313        argOffset += vecTypeHintLength+1;
     314    }
    294315    const typename Types::KernelArgEntry* argPtr = reinterpret_cast<
    295316            const typename Types::KernelArgEntry*>(metadata + argOffset);
Note: See TracChangeset for help on using the changeset viewer.