Changeset 4133 in CLRX


Ignore:
Timestamp:
May 10, 2018, 11:43:45 AM (6 months ago)
Author:
matszpk
Message:

CLRadeonExtender: Add CLRX_VERSION_NUMER. Add CLRX_POLICY_UNIFIED_SGPR_COUNT (for disassembler).
Add code to implement new rules of unified SGPR counting in disassembler.

Location:
CLRadeonExtender/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/CLRX/Config.h.in

    r3575 r4133  
    3636/// CLRadeonExtender revision string
    3737#define CLRX_REVISION "${CLRX_REVISION}"
     38/// CLRadeonExtender version number
     39#define CLRX_VERSION_NUMBER (CLRX_MAJOR_VERSION*10000U + CLRX_MINOR_VERSION*100U + \
     40                        CLRX_MICRO_VERSION)
    3841
    3942#cmakedefine HAVE_GNU11
  • CLRadeonExtender/trunk/CLRX/amdasm/Assembler.h

    r4132 r4133  
    4848
    4949enum: cxuint {
    50     ASM_POLICY_DEFAULT = CLRX_MAJOR_VERSION*10000U + CLRX_MINOR_VERSION*100U +
    51                 CLRX_MICRO_VERSION,        // version 107
    52     ASM_POLICY_UNIFIED_SGPR_COUNT = 200
     50    ASM_POLICY_DEFAULT = CLRX_VERSION_NUMBER,        // version 107
     51    ASM_POLICY_UNIFIED_SGPR_COUNT = CLRX_POLICY_UNIFIED_SGPR_COUNT
    5352};
    5453
  • CLRadeonExtender/trunk/CLRX/amdasm/Commons.h

    r3575 r4133  
    4040};
    4141
     42#define CLRX_POLICY_UNIFIED_SGPR_COUNT (200U)
     43
    4244};
    4345
  • CLRadeonExtender/trunk/amdasm/AsmPseudoOps.cpp

    r4132 r4133  
    22932293            break;
    22942294        case AsmPredefined::VERSION:
    2295             predefValue = CLRX_MAJOR_VERSION*10000U + CLRX_MINOR_VERSION*100U +
    2296                     CLRX_MICRO_VERSION;
     2295            predefValue = CLRX_VERSION_NUMBER;
    22972296            break;
    22982297        case AsmPredefined::POLICY:
  • CLRadeonExtender/trunk/amdasm/DisasmAmd.cpp

    r3726 r4133  
    14081408    }
    14091409   
     1410#if CLRX_VERSION_NUMBER >= CLRX_POLICY_UNIFIED_SGPR_COUNT
     1411    bufSize = snprintf(buf, 100, "        .sgprsnum %u\n", config.usedSGPRsNum+2);
     1412#else
    14101413    bufSize = snprintf(buf, 100, "        .sgprsnum %u\n", config.usedSGPRsNum);
     1414#endif
    14111415    output.write(buf, bufSize);
    14121416    bufSize = snprintf(buf, 100, "        .vgprsnum %u\n", config.usedVGPRsNum);
  • CLRadeonExtender/trunk/amdasm/DisasmAmdCL2.cpp

    r3833 r4133  
    668668}
    669669
    670 static void dumpAmdCL2KernelConfig(std::ostream& output,
    671                     const AmdCL2KernelConfig& config, bool hsaConfig)
     670static void dumpAmdCL2KernelConfig(std::ostream& output, const AmdCL2KernelConfig& config,
     671                GPUArchitecture arch, bool hsaConfig)
    672672{
    673673    size_t bufSize;
     
    724724    {
    725725        // do not print old-config style params if HSA config enabled
     726#if CLRX_VERSION_NUMBER >= CLRX_POLICY_UNIFIED_SGPR_COUNT
     727        const cxuint neededExtraSGPRsNum = arch>=GPUArchitecture::GCN1_2 ? 6 : 4;
     728        const cxuint extraSGPRsNum = (config.useEnqueue || config.useGeneric) ?
     729                    neededExtraSGPRsNum : 2;
     730       
     731        bufSize = snprintf(buf, 100, "        .sgprsnum %u\n",
     732                    config.usedSGPRsNum + extraSGPRsNum);
     733#else
    726734        bufSize = snprintf(buf, 100, "        .sgprsnum %u\n", config.usedSGPRsNum);
     735#endif
    727736        output.write(buf, bufSize);
    728737        bufSize = snprintf(buf, 100, "        .vgprsnum %u\n", config.usedVGPRsNum);
     
    971980                        kinput.textRelocs, isGCN14);
    972981           
    973             dumpAmdCL2KernelConfig(output, config, doHSAConfig);
     982            dumpAmdCL2KernelConfig(output, config, arch, doHSAConfig);
    974983            if (doHSAConfig)
    975984            {
  • CLRadeonExtender/trunk/tests/amdasm/AsmBasicsCases2.cpp

    r4132 r4133  
    20052005        {
    20062006            { ".", 0U, 0, 0U, true, false, false, 0, 0 },
    2007             { "CLRX_VERSION", CLRX_MAJOR_VERSION*10000U + CLRX_MINOR_VERSION*100U +
    2008                     CLRX_MICRO_VERSION, ASMSECT_ABS, 0U, true, false, false, 0, 0 },
     2007            { "CLRX_VERSION", CLRX_VERSION_NUMBER, ASMSECT_ABS, 0U, true, false, false, 0, 0 },
    20092008        }, true, "", ""
    20102009    },
     
    24002399        {
    24012400            { ".", 0U, 0, 0U, true, false, false, 0, 0 },
    2402             { "POLICY0", CLRX_MAJOR_VERSION*10000U + CLRX_MINOR_VERSION*100U +
    2403                     CLRX_MICRO_VERSION, ASMSECT_ABS, 0U, true, false, false, 0, 0 },
     2401            { "POLICY0", CLRX_VERSION_NUMBER, ASMSECT_ABS, 0U, true, false, false, 0, 0 },
    24042402            { "POLICY1", 12, ASMSECT_ABS, 0U, true, false, false, 0, 0 }
    24052403        }, true,
Note: See TracChangeset for help on using the changeset viewer.