Changeset 3300 in CLRX


Ignore:
Timestamp:
Sep 3, 2017, 7:20:18 AM (10 months ago)
Author:
matszpk
Message:

CLRadeonExtender: Asm: Refactor defaultXXXVersion to detectedXXXVersion. Small commenting.

Location:
CLRadeonExtender/trunk
Files:
5 edited

Legend:

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

    r3285 r3300  
    243243    cxuint extraSectionCount;
    244244   
    245     cxuint defaultDriverVersion;
     245    cxuint detectedDriverVersion;
    246246   
    247247    void saveCurrentSection();
     
    326326    cxuint innerExtraSectionCount;
    327327   
    328     cxuint defaultDriverVersion;
     328    cxuint detectedDriverVersion;
    329329   
    330330    void saveCurrentSection();
     
    419419    cxuint extraSectionCount;
    420420   
    421     cxuint defaultDriverVersion;
    422     cxuint defaultLLVMVersion;
     421    cxuint detectedDriverVersion;
     422    cxuint detectedLLVMVersion;
    423423   
    424424    uint32_t archMinor;
  • CLRadeonExtender/trunk/amdasm/AsmAmdCL2Format.cpp

    r3278 r3300  
    7777            ".rodata" });
    7878    savedSection = innerSavedSection = 0;
    79     defaultDriverVersion = detectAmdDriverVersion();
     79    detectedDriverVersion = detectAmdDriverVersion();
    8080}
    8181
     
    9696}
    9797
     98cxuint AsmAmdCL2Handler::getDriverVersion() const
     99{
     100    cxuint driverVersion = 0;
     101    if (output.driverVersion==0)
     102    {
     103        if (assembler.driverVersion==0) // just detect driver version
     104            driverVersion = detectedDriverVersion;
     105        else // from assembler setup
     106            driverVersion = assembler.driverVersion;
     107    }
     108    else
     109        driverVersion = output.driverVersion;
     110    return driverVersion;
     111}
     112
    98113void AsmAmdCL2Handler::restoreCurrentAllocRegs()
    99114{
     
    104119                kernelStates[assembler.currentKernel]->allocRegs,
    105120                kernelStates[assembler.currentKernel]->allocRegFlags);
    106 }
    107 
    108 cxuint AsmAmdCL2Handler::getDriverVersion() const
    109 {
    110     cxuint driverVersion = 0;
    111     if (output.driverVersion==0)
    112     {
    113         if (assembler.driverVersion==0) // just detect driver version
    114             driverVersion = defaultDriverVersion;
    115         else // from assembler setup
    116             driverVersion = assembler.driverVersion;
    117     }
    118     else
    119         driverVersion = output.driverVersion;
    120     return driverVersion;
    121121}
    122122
     
    443443            asmr.printError(symNamePlace, (std::string("Symbol '")+symName.c_str()+
    444444                        "' is already defined").c_str());
    445         else
     445        else // set value of symbol
    446446            asmr.setSymbol(*res.first, driverVersion, ASMSECT_ABS);
    447447    }
    448448}
    449449
     450// go to inner binary
    450451void AsmAmdCL2PseudoOps::doInner(AsmAmdCL2Handler& handler, const char* pseudoOpPlace,
    451452                      const char* linePtr)
     
    14461447                    ((asmSection.flags&ASMELFSECT_WRITEABLE) ? SHF_WRITE : 0) |
    14471448                    ((asmSection.flags&ASMELFSECT_EXECUTABLE) ? SHF_EXECINSTR : 0);
     1449                // put extra sections to binary
    14481450                if (section.kernelId == ASMKERN_GLOBAL)
    14491451                    output.extraSections.push_back({section.name, sectionSize, sectionData,
    14501452                            asmSection.alignment!=0?asmSection.alignment:1, elfSectType,
    14511453                            elfSectFlags, ELFSECTID_NULL, 0, 0 });
    1452                 else
     1454                else // to inner binary
    14531455                    output.innerExtraSections.push_back({section.name, sectionSize,
    14541456                            sectionData, asmSection.alignment!=0?asmSection.alignment:1,
     
    15701572    {
    15711573        if (assembler.driverVersion==0) // just detect driver version
    1572             output.driverVersion = defaultDriverVersion;
     1574            output.driverVersion = detectedDriverVersion;
    15731575        else // from assembler setup
    15741576            output.driverVersion = assembler.driverVersion;
  • CLRadeonExtender/trunk/amdasm/AsmAmdFormat.cpp

    r3278 r3300  
    7878    sections.push_back({ ASMKERN_GLOBAL, AsmSectionType::DATA, ELFSECTID_UNDEF, nullptr });
    7979    savedSection = 0;
    80     defaultDriverVersion = detectAmdDriverVersion();
     80    detectedDriverVersion = detectAmdDriverVersion();
    8181}
    8282
     
    9292    {
    9393        if (assembler.getDriverVersion() == 0)
    94             return defaultDriverVersion;
     94            return detectedDriverVersion;
    9595        else
    9696            return assembler.getDriverVersion();
     
    18541854                    ((asmSection.flags&ASMELFSECT_WRITEABLE) ? SHF_WRITE : 0) |
    18551855                    ((asmSection.flags&ASMELFSECT_EXECUTABLE) ? SHF_EXECINSTR : 0);
     1856                // put extra sections to binary
    18561857                if (section.kernelId == ASMKERN_GLOBAL)
    18571858                    output.extraSections.push_back({section.name, sectionSize, sectionData,
    18581859                            asmSection.alignment!=0?asmSection.alignment:1, elfSectType,
    18591860                            elfSectFlags, ELFSECTID_NULL, 0, 0 });
    1860                 else
     1861                else // to inner binary
    18611862                    kernel->extraSections.push_back({section.name, sectionSize, sectionData,
    18621863                            asmSection.alignment!=0?asmSection.alignment:1, elfSectType,
     
    19261927    {
    19271928        if (assembler.driverVersion==0) // just detect driver version
    1928             output.driverVersion = defaultDriverVersion;
     1929            output.driverVersion = detectedDriverVersion;
    19291930        else // from assembler setup
    19301931            output.driverVersion = assembler.driverVersion;
  • CLRadeonExtender/trunk/amdasm/AsmGalliumFormat.cpp

    r3297 r3300  
    164164    currentKcodeKernel = ASMKERN_GLOBAL;
    165165    savedSection = 0;
    166     defaultLLVMVersion = detectLLVMCompilerVersion();
    167     defaultDriverVersion = detectMesaDriverVersion();
     166    detectedLLVMVersion = detectLLVMCompilerVersion();
     167    detectedDriverVersion = detectMesaDriverVersion();
    168168}
    169169
     
    174174}
    175175
     176// determine LLVM version from assembler settings or CLRX settings
    176177cxuint AsmGalliumHandler::determineLLVMVersion() const
    177178{
    178179    if (assembler.getLLVMVersion() == 0)
    179         return defaultLLVMVersion;
     180        return detectedLLVMVersion;
    180181    else
    181182        return assembler.getLLVMVersion();
    182183}
    183184
     185// determine Mesa3D driver version from assembler settings or CLRX settings
    184186cxuint AsmGalliumHandler::determineDriverVersion() const
    185187{
    186188    if (assembler.getDriverVersion() == 0)
    187         return defaultDriverVersion;
     189        return detectedDriverVersion;
    188190    else
    189191        return assembler.getDriverVersion();
     
    18771879    cxuint llvmVersion = assembler.llvmVersion;
    18781880    if (llvmVersion == 0 && (assembler.flags&ASM_TESTRUN)==0)
    1879         llvmVersion = defaultLLVMVersion;
     1881        llvmVersion = detectedLLVMVersion;
    18801882   
    18811883    const cxuint ldsShift = arch<GPUArchitecture::GCN1_1 ? 8 : 9;
     
    21122114    // set versions
    21132115    if (assembler.driverVersion == 0 && (assembler.flags&ASM_TESTRUN)==0) // auto detection
    2114         output.isMesa170 = defaultDriverVersion >= 170000U;
     2116        output.isMesa170 = detectedDriverVersion >= 170000U;
    21152117    else
    21162118        output.isMesa170 = assembler.driverVersion >= 170000U;
  • CLRadeonExtender/trunk/amdasm/AsmROCmFormat.cpp

    r3297 r3300  
    788788}
    789789
     790// parse machine version - used also in AsmGalliumFormat
    790791bool AsmROCmPseudoOps::parseMachine(Assembler& asmr, const char* linePtr,
    791792        uint16_t& machineKind, uint16_t& machineMajor, uint16_t& machineMinor,
     
    856857}
    857858
     859// parse code version (amd code version) - used also in AsmGalliumFormat
    858860bool AsmROCmPseudoOps::parseCodeVersion(Assembler& asmr, const char* linePtr,
    859861                uint16_t& codeMajor, uint16_t& codeMinor)
     
    903905}
    904906
     907// parse reserved gprs - used also in AsmGalliumFormat
    905908bool AsmROCmPseudoOps::parseReservedXgprs(Assembler& asmr, const char* linePtr,
    906909                bool inVgpr, uint16_t& gprFirst, uint16_t& gprCount)
Note: See TracChangeset for help on using the changeset viewer.