Changeset 4973 in CLRX


Ignore:
Timestamp:
Sep 19, 2019, 1:13:06 PM (4 weeks ago)
Author:
matszpk
Message:

CLRadeonExtender: AsmROCm: Add calculatePgmRsrc3 and setup PGMRSRC3. Check shared vgprs number before setting.

Location:
CLRadeonExtender/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/CLRX/utils/GPUId.h

    r4687 r4973  
    236236            cxuint ldsSize, cxuint exceptions);
    237237
     238extern uint32_t calculatePgmRSrc3(GPUArchitecture arch, cxuint sharedVgprsNum);
    238239
    239240/// ADMGPUArchValues table type
  • CLRadeonExtender/trunk/amdasm/AsmFormats.cpp

    r4968 r4973  
    287287            asmr.printError(pseudoOpPlace, "Code flags mismatch for kernel set");
    288288        else
    289             asmr.printError(AsmSourcePos{}, "Code flags mismatch for kernel set");
     289            asmr.printError(AsmSourcePos(), "Code flags mismatch for kernel set");
    290290    }
    291291    asmr.isaAssembler->setAllocatedRegisters();
  • CLRadeonExtender/trunk/amdasm/AsmROCmFormat.cpp

    r4971 r4973  
    11561156                ASM_NOTGOOD_BY_ERROR(valuePlace, buf)
    11571157            }
     1158            break;
     1159        }
     1160        case ROCMCVAL_SHARED_VGPRSNUM:
     1161        {
     1162            const GPUArchitecture arch = getGPUArchitectureFromDeviceType(
     1163                        asmr.deviceType);
     1164            if (arch >= GPUArchitecture::GCN1_5 && value > 120)
     1165            {
     1166                char buf[64];
     1167                snprintf(buf, 64, "Shared VGPRs number out of range (0-120)");
     1168                ASM_NOTGOOD_BY_ERROR(valuePlace, buf)
     1169            }
     1170            else if (value != 0)
     1171                ASM_NOTGOOD_BY_ERROR(valuePlace,
     1172                        "Shared VGPRS number must be zero for device older than GCN1.5");
    11581173            break;
    11591174        }
     
    25292544                            (output.newBinFormat ? 0 : config.workgroupGroupSegmentSize),
    25302545                            config.exceptions);
     2546        // shared_vgprs
     2547        cxuint sharedVgprsNum = 0;
     2548        if (config.sharedVGPRsNum != BINGEN_DEFAULT)
     2549            sharedVgprsNum = config.sharedVGPRsNum;
     2550        if (sharedVgprsNum + vgprsNum > 256)
     2551        {
     2552            assembler.printError(AsmSourcePos(), (std::string(
     2553                    "Number of total VGPRs with shared VGPRs for kernel '")+
     2554                    kernelName.c_str()+"' is higher than 256").c_str());
     2555            good = false;
     2556        }
     2557        config.pgmRsrc3 |= calculatePgmRSrc3(arch, sharedVgprsNum);
    25312558       
    25322559        if (config.wavefrontSgprCount == BINGEN16_DEFAULT)
  • CLRadeonExtender/trunk/utils/GPUId.cpp

    r4970 r4973  
    405405}
    406406
     407uint32_t CLRX::calculatePgmRSrc3(GPUArchitecture arch, cxuint sharedVgprsNum)
     408{
     409    if (arch < GPUArchitecture::GCN1_5)
     410        return 0;
     411    return ((sharedVgprsNum+7)>>3);
     412}
     413
    407414// AMD GPU architecture for Gallium
    408415static const AMDGPUArchVersion galliumGpuArchVersionTbl[] =
Note: See TracChangeset for help on using the changeset viewer.