Changeset 3307 in CLRX


Ignore:
Timestamp:
Sep 4, 2017, 5:20:44 AM (10 months ago)
Author:
matszpk
Message:

CLRadeonExtender: AmdCL2BinGen: Replace word 'generic' by 'GFX?' in kernel metadata for binaries generated for later drivers.

File:
1 edited

Legend:

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

    r3306 r3307  
    398398};
    399399
     400static const char* amdcl2GPUArchNameWordTable[] =
     401{
     402    "GFX6", "GFX7", "GFX8", "GFX9"
     403};
     404
    400405static void prepareKernelTempData(const AmdCL2Input* input,
    401406          Array<TempAmdCL2KernelData>& tempDatas)
     
    404409    const bool is16_3Ver = input->driverVersion >= 200406;
    405410    const size_t kernelsNum = input->kernels.size();
     411    const GPUArchitecture arch = getGPUArchitectureFromDeviceType(input->deviceType);
    406412   
    407413    const size_t samplersNum = (input->samplerConfig) ?
     
    454460                out += 24;
    455461            }
     462            // fix for new word (GFX?)
     463            if (input->driverVersion >= 223600U)
     464                out += ::strlen(amdcl2GPUArchNameWordTable[cxuint(arch)]) - 7;
    456465           
    457466            /// if kernels uses locals
     
    875884        const bool newBinaries = input->driverVersion >= 191205;
    876885        const bool is16_3Ver = input->driverVersion >= 200406;
     886        const GPUArchitecture arch = getGPUArchitectureFromDeviceType(input->deviceType);
     887       
    877888        typename Types::MetadataHeader header;
    878889        cxuint argsNum = config.args.size();
     
    900911        ::memset(header.unknown3, 0, sizeof header.unknown3);
    901912        SLEV(header.firstNameLength, 0x15);
    902         SLEV(header.secondNameLength, 0x7);
     913        if (input->driverVersion < 223600U)
     914            SLEV(header.secondNameLength, 0x7); // generic word
     915        else  // GFX? word
     916            SLEV(header.secondNameLength,
     917                        ::strlen(amdcl2GPUArchNameWordTable[cxuint(arch)]));
    903918        for (cxuint i = 0; i < 3; i++)
    904919            header.unknown4[i] = 0;
     
    926941        // two null terminated strings
    927942        fob.writeArray(22, "__OpenCL_dummy_kernel");
    928         fob.writeArray(8, "generic");
     943        if (input->driverVersion < 223600U)
     944            fob.writeArray(8, "generic");
     945        else    // GFX?
     946            fob.writeArray(::strlen(amdcl2GPUArchNameWordTable[cxuint(arch)])+1,
     947                           amdcl2GPUArchNameWordTable[cxuint(arch)]);
    929948        if (is16_3Ver)
    930949            fob.writeObject<cxbyte>(0);
Note: See TracChangeset for help on using the changeset viewer.