Changeset 3671 in CLRX


Ignore:
Timestamp:
Jan 28, 2018, 9:23:05 AM (2 years ago)
Author:
matszpk
Message:

CLRadeonExtender: AsmROCm: Add '.tripple' to set same LLVM target tripple without device name.
CLRXDocs: add '.tripple' and '.target' descriptions.

Location:
CLRadeonExtender/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/CLRX/amdbin/ROCmBinaries.h

    r3666 r3671  
    213213    size_t commentSize; ///< comment size (can be null)
    214214    const char* comment; ///< comment
    215     CString target;     ///< LLVM target triple
     215    CString target;     ///< LLVM target triple with device name
     216    CString targetTripple; ///< same LLVM target tripple
    216217    size_t metadataSize;    ///< metadata size
    217218    const char* metadata;   ///< metadata
  • CLRadeonExtender/trunk/amdasm/AsmROCmFormat.cpp

    r3668 r3671  
    5151    "privmode", "reserved_sgprs", "reserved_vgprs",
    5252    "runtime_loader_kernel_symbol",
    53     "scratchbuffer", "sgprsnum", "target", "tgsize",
     53    "scratchbuffer", "sgprsnum", "target", "tgsize", "tripple",
    5454    "use_debug_enabled", "use_dispatch_id",
    5555    "use_dispatch_ptr", "use_dynamic_call_stack",
     
    8383    ROCMOP_PRIVMODE, ROCMOP_RESERVED_SGPRS, ROCMOP_RESERVED_VGPRS,
    8484    ROCMOP_RUNTIME_LOADER_KERNEL_SYMBOL,
    85     ROCMOP_SCRATCHBUFFER, ROCMOP_SGPRSNUM, ROCMOP_TARGET, ROCMOP_TGSIZE,
     85    ROCMOP_SCRATCHBUFFER, ROCMOP_SGPRSNUM,
     86    ROCMOP_TARGET, ROCMOP_TGSIZE, ROCMOP_TRIPPLE,
    8687    ROCMOP_USE_DEBUG_ENABLED, ROCMOP_USE_DISPATCH_ID,
    8788    ROCMOP_USE_DISPATCH_PTR, ROCMOP_USE_DYNAMIC_CALL_STACK,
     
    382383}
    383384
    384 void AsmROCmPseudoOps::setTarget(AsmROCmHandler& handler, const char* linePtr)
     385void AsmROCmPseudoOps::setTarget(AsmROCmHandler& handler, const char* linePtr,
     386                        bool tripple)
    385387{
    386388    Assembler& asmr = handler.assembler;
     
    392394    if (!checkGarbagesAtEnd(asmr, linePtr))
    393395        return;
    394     handler.output.target = out;
    395 }
    396    
     396    if (tripple)
     397        handler.output.targetTripple = out;
     398    else
     399        handler.output.target = out;
     400}
     401
    397402void AsmROCmPseudoOps::doConfig(AsmROCmHandler& handler, const char* pseudoOpPlace,
    398403                  const char* linePtr)
     
    13371342            break;
    13381343        case ROCMOP_TARGET:
    1339             AsmROCmPseudoOps::setTarget(*this, linePtr);
     1344            AsmROCmPseudoOps::setTarget(*this, linePtr, false);
    13401345            break;
    13411346        case ROCMOP_TGSIZE:
    13421347            AsmROCmPseudoOps::setConfigBoolValue(*this, stmtPlace, linePtr,
    13431348                             ROCMCVAL_TGSIZE);
     1349            break;
     1350        case ROCMOP_TRIPPLE:
     1351            AsmROCmPseudoOps::setTarget(*this, linePtr, true);
    13441352            break;
    13451353        case ROCMOP_USE_DEBUG_ENABLED:
  • CLRadeonExtender/trunk/amdasm/AsmROCmInternals.h

    r3668 r3671  
    9696   
    9797    // .target
    98     static void setTarget(AsmROCmHandler& handler, const char* linePtr);
     98    static void setTarget(AsmROCmHandler& handler, const char* linePtr, bool tripple);
    9999   
    100100    /* user configuration pseudo-ops */
  • CLRadeonExtender/trunk/amdbin/ROCmBinaries.cpp

    r3669 r3671  
    2020#include <CLRX/Config.h>
    2121#include <cassert>
     22#include <cstdio>
    2223#include <cstdint>
    2324#include <algorithm>
     
    422423                    Elf64Types::nobase, Elf64Types::nobase, 0, 4 });
    423424   
     425    std::string target = input->target.c_str();
     426    if (target.empty() && !input->targetTripple.empty())
     427    {
     428        target = input->targetTripple.c_str();
     429        char dbuf[20];
     430        snprintf(dbuf, 20, "-gfx%u%u%u", amdGpuArchValues.major, amdGpuArchValues.minor,
     431                 amdGpuArchValues.stepping);
     432        target += dbuf;
     433    }
    424434    // elf notes
    425435    elfBinGen64.addNote({"AMD", sizeof noteDescType1, noteDescType1, 1U});
     
    430440    SULEV(*(uint32_t*)(noteBuf.get()+12), amdGpuArchValues.stepping);
    431441    elfBinGen64.addNote({"AMD", 0x1b, noteBuf.get(), 3U});
    432     if (!input->target.empty())
    433         elfBinGen64.addNote({"AMD", input->target.size(),
    434                 (const cxbyte*)input->target.c_str(), 0xbU});
     442    if (!target.empty())
     443        elfBinGen64.addNote({"AMD", target.size(), (const cxbyte*)target.c_str(), 0xbU});
    435444    if (input->metadataSize != 0)
    436445        elfBinGen64.addNote({"AMD", input->metadataSize,
  • CLRadeonExtender/trunk/doc/ClrxAsmRocm.md

    r3668 r3671  
    319319It counts SGPR registers including VCC, FLAT_SCRATCH and XNACK_MASK.
    320320
     321### .target
     322
     323Syntax: .target "TARGET"
     324
     325Set LLVM target with device name. For example: "amdgcn-amd-amdhsa-amdgizcl-gfx803".
     326
    321327### .tgsize
    322328
    323329This pseudo-op must be inside kernel configuration (`.config`).
    324330Enable usage of the TG_SIZE_EN.
     331
     332### .tripple
     333
     334Syntax: .tripple "TRIPPLE"
     335
     336Set LLVM target without device name. For example "amdgcn-amd-amdhsa-amdgizcl" with
     337Fiji device generates target "amdgcn-amd-amdhsa-amdgizcl-gfx803".
    325338
    326339### .use_debug_enabled
Note: See TracChangeset for help on using the changeset viewer.