Changeset 3085 in CLRX


Ignore:
Timestamp:
May 28, 2017, 11:51:32 AM (2 years ago)
Author:
matszpk
Message:

CLRadeonExtender: Asm: Add new pseudo-ops: '.get_64bit', '.get_arch', '.get_format', '.get_gpu'.

Location:
CLRadeonExtender/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/amdasm/AsmInternals.h

    r2915 r3085  
    125125   
    126126    static bool parseDimensions(Assembler& asmr, const char*& linePtr, cxuint& dimMask);
     127};
     128
     129enum class AsmPredefined: cxbyte
     130{
     131    ARCH,
     132    BIT64,
     133    FORMAT,
     134    GPU
    127135};
    128136
     
    280288   
    281289    static void setAbsoluteOffset(Assembler& asmr, const char* linePtr);
     290   
     291    static void getPredefinedValue(Assembler& asmr, const char* linePtr,
     292                        AsmPredefined predefined);
    282293   
    283294    static void ignoreString(Assembler& asmr, const char* linePtr);
  • CLRadeonExtender/trunk/amdasm/AsmPseudoOps.cpp

    r2960 r3085  
    106106    "err", "error", "exitm", "extern",
    107107    "fail", "file", "fill", "fillq",
    108     "float", "format", "gallium", "global",
     108    "float", "format", "gallium", "get_64bit", "get_arch",
     109    "get_format", "get_gpu", "global",
    109110    "globl", "gpu", "half", "hword", "if", "if32", "if64",
    110111    "ifarch", "ifb", "ifc", "ifdef", "ifeq",
     
    146147    ASMOP_ERR, ASMOP_ERROR, ASMOP_EXITM, ASMOP_EXTERN,
    147148    ASMOP_FAIL, ASMOP_FILE, ASMOP_FILL, ASMOP_FILLQ,
    148     ASMOP_FLOAT, ASMOP_FORMAT, ASMOP_GALLIUM, ASMOP_GLOBAL,
     149    ASMOP_FLOAT, ASMOP_FORMAT, ASMOP_GALLIUM, ASMOP_GET_64BIT, ASMOP_GET_ARCH,
     150    ASMOP_GET_FORMAT, ASMOP_GET_GPU, ASMOP_GLOBAL,
    149151    ASMOP_GLOBL, ASMOP_GPU, ASMOP_HALF, ASMOP_HWORD, ASMOP_IF, ASMOP_IF32, ASMOP_IF64,
    150152    ASMOP_IFARCH, ASMOP_IFB, ASMOP_IFC, ASMOP_IFDEF, ASMOP_IFEQ,
     
    22212223}
    22222224
     2225void AsmPseudoOps::getPredefinedValue(Assembler& asmr, const char* linePtr,
     2226                            AsmPredefined predefined)
     2227{
     2228    const char* end = asmr.line + asmr.lineSize;
     2229    skipSpacesToEnd(linePtr, end);
     2230   
     2231    const char* symNamePlace = linePtr;
     2232    const CString symName = extractScopedSymName(linePtr, end, false);
     2233    if (symName.empty())
     2234    {
     2235        asmr.printError(symNamePlace, "Illegal symbol name");
     2236        return;
     2237    }
     2238    size_t symNameLength = symName.size();
     2239    if (symNameLength >= 3 && symName.compare(symNameLength-3, 3, "::.")==0)
     2240    {
     2241        asmr.printError(symNamePlace, "Symbol '.' can be only in global scope");
     2242        return;
     2243    }
     2244    if (!checkGarbagesAtEnd(asmr, linePtr))
     2245        return;
     2246   
     2247    cxuint predefValue = 0;
     2248    asmr.initializeOutputFormat();
     2249    switch (predefined)
     2250    {
     2251        case AsmPredefined::ARCH:
     2252            predefValue = cxuint(getGPUArchitectureFromDeviceType(asmr.deviceType));
     2253            break;
     2254        case AsmPredefined::BIT64:
     2255            predefValue = asmr._64bit;
     2256            break;
     2257        case AsmPredefined::GPU:
     2258            predefValue = cxuint(asmr.deviceType);
     2259            break;
     2260        case AsmPredefined::FORMAT:
     2261            predefValue = cxuint(asmr.format);
     2262            break;
     2263        default:
     2264            break;
     2265    }
     2266    std::pair<AsmSymbolEntry*, bool> res = asmr.insertSymbolInScope(symName,
     2267                AsmSymbol(ASMSECT_ABS, predefValue));
     2268    if (!res.second)
     2269    {   // found
     2270        if (res.first->second.onceDefined && res.first->second.isDefined()) // if label
     2271            asmr.printError(symNamePlace, (std::string("Symbol '")+symName.c_str()+
     2272                        "' is already defined").c_str());
     2273        else
     2274            asmr.setSymbol(*res.first, predefValue, ASMSECT_ABS);
     2275    }
     2276}
     2277
    22232278void AsmPseudoOps::ignoreString(Assembler& asmr, const char* linePtr)
    22242279{
     
    24852540        case ASMOP_FORMAT:
    24862541            AsmPseudoOps::setOutFormat(*this, linePtr);
     2542            break;
     2543        case ASMOP_GET_64BIT:
     2544            AsmPseudoOps::getPredefinedValue(*this, linePtr, AsmPredefined::BIT64);
     2545            break;
     2546        case ASMOP_GET_ARCH:
     2547            AsmPseudoOps::getPredefinedValue(*this, linePtr, AsmPredefined::ARCH);
     2548            break;
     2549        case ASMOP_GET_FORMAT:
     2550            AsmPseudoOps::getPredefinedValue(*this, linePtr, AsmPredefined::FORMAT);
     2551            break;
     2552        case ASMOP_GET_GPU:
     2553            AsmPseudoOps::getPredefinedValue(*this, linePtr, AsmPredefined::GPU);
    24872554            break;
    24882555        case ASMOP_GLOBAL:
  • CLRadeonExtender/trunk/doc/ClrxAsmPseudoOps.md

    r2992 r3085  
    317317Choose GalliumCompute OpenCL program binary format.
    318318
     319### .get_64bit SYMBOL
     320
     321Store 64-bitness in specified symbol. Store 1 to symbol if 64-bit mode enabled.
     322
     323### .get_arch SYMBOL
     324
     325Store GPU architecture identifier to symbol. List of architecture ids:
     326
     327Id | Description
     328---|-------------------------------------------
     329 0 | GCN1.0 (Pitcairn, Tahiti)
     330 1 | GCN1.1 (Bonaire, Hawaii)
     331 2 | GCN1.2 (Tonga, Fiji, Ellesmere)
     332 3 | VEGA (AMD RX VEGA)
     333
     334### .get_format SYMBOL
     335
     336Store binary format identifier to symbol. List of format ids:
     337
     338Id | Description
     339---|-------------------------------------------
     340 0 | AMD OpenCL 1.2 binary format
     341 1 | Gallium Compute binary format
     342 2 | AMD OpenCL 2.0 (new driver) binary format
     343 3 | ROCm binary format
     344
     345### .get_gpu SYMBOL
     346
     347Store GPU device identifier to symbol. List of GPU device ids:
     348
     349Id  | Description
     350----|-------------------------------------------
     351 0  | Cape Verde (Radeon HD 7700)
     352 1  | Pitcairn (Radeon HD 7850)
     353 2  | Tahiti  (Radeon HD 7900)
     354 3  | Oland
     355 4  | Bonaire  (Radeon R7 260)
     356 5  | Spectre
     357 6  | Spooky
     358 7  | Kalindi
     359 8  | Hainan
     360 9  | Hawaii (Radeon R9 290)
     361 10 | Iceland
     362 11 | Tonga (Radeon R9 285)
     363 12 | Mullins
     364 13 | Fiji (Radeon Fury)
     365 14 | Carrizo
     366 15 | Dummy
     367 16 | Goose
     368 17 | Horse
     369 18 | Stoney
     370 19 | Ellesmere (Radeon RX 470/480)
     371 20 | Baffin (Radeon 460)
     372 21 | Gfx804
     373 22 | Gfx900 (Radeon RX VEGA)
     374
    319375### .global, .globl
    320376
  • CLRadeonExtender/trunk/editors/clrx.vim

    r2932 r3085  
    154154syntax match asmPseudoOps "\.gdssize"
    155155syntax match asmPseudoOps "\.get_driver_version"
     156syntax match asmPseudoOps "\.get_arch"
     157syntax match asmPseudoOps "\.get_64bit"
     158syntax match asmPseudoOps "\.get_gpu"
     159syntax match asmPseudoOps "\.get_format"
    156160syntax match asmPseudoOps "\.global"
    157161syntax match asmPseudoOps "\.globalbuffers"
  • CLRadeonExtender/trunk/editors/gedit.lang

    r2933 r3085  
    168168            <keyword>gdssize</keyword>
    169169            <keyword>get_driver_version</keyword>
     170            <keyword>get_arch</keyword>
     171            <keyword>get_64bit</keyword>
     172            <keyword>get_format</keyword>
     173            <keyword>get_gpu</keyword>
    170174            <keyword>global</keyword>
    171175            <keyword>globalbuffers</keyword>
  • CLRadeonExtender/trunk/editors/kate.xml

    r2932 r3085  
    16181618            <item>.gdssize</item>
    16191619            <item>.get_driver_version</item>
     1620            <item>.get_arch</item>
     1621            <item>.get_64bit</item>
     1622            <item>.get_gpu</item>
     1623            <item>.get_format</item>
    16201624            <item>.global</item>
    16211625            <item>.globalbuffers</item>
  • CLRadeonExtender/trunk/editors/notepad++.xml

    r2932 r3085  
    12511251.gdssize
    12521252.get_driver_version
     1253.get_arch
     1254.get_64bit
     1255.get_format
     1256.get_gpu
    12531257.global
    12541258.globalbuffers
Note: See TracChangeset for help on using the changeset viewer.