Ignore:
Timestamp:
Nov 28, 2016, 1:57:39 PM (4 years ago)
Author:
matszpk
Message:

CLRadeonExtender: AsmROCm: add '.codeversion' and '.machine' pseudo-ops.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/amdasm/AsmROCmFormat.cpp

    r2595 r2596  
    643643}
    644644
     645void AsmROCmPseudoOps::setMachine(AsmROCmHandler& handler, const char* pseudoOpPlace,
     646                      const char* linePtr)
     647{
     648    Assembler& asmr = handler.assembler;
     649    const char* end = asmr.line + asmr.lineSize;
     650    if (asmr.currentKernel==ASMKERN_GLOBAL ||
     651        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
     652    {
     653        asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
     654        return;
     655    }
     656   
     657    skipSpacesToEnd(linePtr, end);
     658    uint64_t kindValue = BINGEN_NOTSUPPLIED;
     659    uint64_t majorValue = BINGEN_NOTSUPPLIED;
     660    uint64_t minorValue = BINGEN_NOTSUPPLIED;
     661    uint64_t steppingValue = BINGEN_NOTSUPPLIED;
     662    bool good = getAbsoluteValueArg(asmr, kindValue, linePtr, true);
     663    if (!skipRequiredComma(asmr, linePtr))
     664        return;
     665    good &= getAbsoluteValueArg(asmr, majorValue, linePtr, true);
     666    if (!skipRequiredComma(asmr, linePtr))
     667        return;
     668    good &= getAbsoluteValueArg(asmr, minorValue, linePtr, true);
     669    if (!skipRequiredComma(asmr, linePtr))
     670        return;
     671    good &= getAbsoluteValueArg(asmr, steppingValue, linePtr, true);
     672   
     673    if (!good || !checkGarbagesAtEnd(asmr, linePtr))
     674        return;
     675   
     676    handler.kernelStates[asmr.currentKernel]->initializeKernelConfig();
     677    AsmROCmKernelConfig* config = handler.kernelStates[asmr.currentKernel]->config.get();
     678    config->amdMachineKind = kindValue;
     679    config->amdMachineMajor = majorValue;
     680    config->amdMachineMinor = minorValue;
     681    config->amdMachineStepping = steppingValue;
     682}
     683
     684void AsmROCmPseudoOps::setCodeVersion(AsmROCmHandler& handler, const char* pseudoOpPlace,
     685                  const char* linePtr)
     686{
     687    Assembler& asmr = handler.assembler;
     688    const char* end = asmr.line + asmr.lineSize;
     689    if (asmr.currentKernel==ASMKERN_GLOBAL ||
     690        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
     691    {
     692        asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
     693        return;
     694    }
     695   
     696    skipSpacesToEnd(linePtr, end);
     697    uint64_t majorValue = BINGEN_NOTSUPPLIED;
     698    uint64_t minorValue = BINGEN_NOTSUPPLIED;
     699    bool good = getAbsoluteValueArg(asmr, majorValue, linePtr, true);
     700    if (!skipRequiredComma(asmr, linePtr))
     701        return;
     702    good &= getAbsoluteValueArg(asmr, minorValue, linePtr, true);
     703   
     704    if (!good || !checkGarbagesAtEnd(asmr, linePtr))
     705        return;
     706   
     707    handler.kernelStates[asmr.currentKernel]->initializeKernelConfig();
     708    AsmROCmKernelConfig* config = handler.kernelStates[asmr.currentKernel]->config.get();
     709    config->amdCodeVersionMajor = majorValue;
     710    config->amdCodeVersionMinor = minorValue;
     711}
     712
    645713void AsmROCmPseudoOps::setUseGridWorkGroupCount(AsmROCmHandler& handler,
    646714                   const char* pseudoOpPlace, const char* linePtr)
     
    788856            break;
    789857        case ROCMOP_CODEVERSION:
     858            AsmROCmPseudoOps::setCodeVersion(*this, stmtPlace, linePtr);
    790859            break;
    791860        case ROCMOP_CONFIG:
     
    865934            break;
    866935        case ROCMOP_MACHINE:
     936            AsmROCmPseudoOps::setMachine(*this, stmtPlace, linePtr);
    867937            break;
    868938        case ROCMOP_MAX_SCRATCH_BACKING_MEMORY:
Note: See TracChangeset for help on using the changeset viewer.