Changeset 3322 in CLRX


Ignore:
Timestamp:
Sep 6, 2017, 8:40:31 PM (4 months ago)
Author:
matszpk
Message:

CLRadeonExtender: AsmGallium?: Calculate default UserDataNum? from EnableFeatureFlags? from HSA config.

Location:
CLRadeonExtender/trunk
Files:
3 edited

Legend:

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

    r3313 r3322  
    18311831        GalliumKernelConfig& config = output.kernels[i].config;
    18321832        cxuint userSGPRsNum = config.userDataNum;
     1833       
     1834        if (llvmVersion >= 40000U && config.userDataNum == BINGEN8_DEFAULT)
     1835        {   // fixed userdatanum for LLVM 4.0
     1836            const AmdHsaKernelConfig& hsaConfig  = *kernelStates[i]->config.get();
     1837            // calcuate userSGPRs
     1838            const uint16_t sgprFlags = hsaConfig.enableSgprRegisterFlags;
     1839            userSGPRsNum =
     1840                ((sgprFlags&ROCMFLAG_USE_PRIVATE_SEGMENT_BUFFER)!=0 ? 4 : 0) +
     1841                ((sgprFlags&ROCMFLAG_USE_DISPATCH_PTR)!=0 ? 2 : 0) +
     1842                ((sgprFlags&ROCMFLAG_USE_QUEUE_PTR)!=0 ? 2 : 0) +
     1843                ((sgprFlags&ROCMFLAG_USE_KERNARG_SEGMENT_PTR)!=0 ? 2 : 0) +
     1844                ((sgprFlags&ROCMFLAG_USE_DISPATCH_ID)!=0 ? 2 : 0) +
     1845                ((sgprFlags&ROCMFLAG_USE_FLAT_SCRATCH_INIT)!=0 ? 2 : 0) +
     1846                ((sgprFlags&ROCMFLAG_USE_PRIVATE_SEGMENT_SIZE)!=0) +
     1847                /* use_grid_workgroup_count */
     1848                ((sgprFlags&ROCMFLAG_USE_GRID_WORKGROUP_COUNT_X)!=0) +
     1849                ((sgprFlags&ROCMFLAG_USE_GRID_WORKGROUP_COUNT_Y)!=0) +
     1850                ((sgprFlags&ROCMFLAG_USE_GRID_WORKGROUP_COUNT_Z)!=0);
     1851            userSGPRsNum = std::min(16U, userSGPRsNum);
     1852            config.userDataNum = userSGPRsNum;
     1853        }
     1854       
    18331855        /* include userData sgprs */
    18341856        cxuint dimMask = (config.dimMask!=BINGEN_DEFAULT) ? config.dimMask :
  • CLRadeonExtender/trunk/amdbin/GalliumBinaries.cpp

    r3298 r3322  
    374374    kinput.config.usedSGPRsNum = BINGEN_DEFAULT;
    375375    kinput.config.floatMode = 0xc0;
    376     kinput.config.userDataNum = (llvmVersion >= 40000U) ? 8 : 4;
     376    kinput.config.userDataNum = (llvmVersion >= 40000U) ? BINGEN_DEFAULT : 4;
    377377    kinput.config.spilledVGPRs = kinput.config.spilledSGPRs = 0;
    378378    kernels.push_back(std::move(kinput));
  • CLRadeonExtender/trunk/tests/amdasm/AsmGalliumFormat.cpp

    r3310 r3322  
    626626      maxScrachBackingMemorySize=0
    627627      computePgmRsrc1=0x8eb5e2
    628       computePgmRsrc2=0x7fbd1
     628      computePgmRsrc2=0x7fbc5
    629629      enableSgprRegisterFlags=0x20
    630630      enableFeatureFlags=0x0
     
    660660  Code:
    661661  0100000000000000010008000000030000010000000000000000000000000000
    662   00000000000000000000000000000000e2b58e00d1fb070020000000e6000000
     662  00000000000000000000000000000000e2b58e00c5fb070020000000e6000000
    663663  16000000640000001000000000000000fc0c00003d008b000000000000000000
    664664  6000620005040406ac4d03000000000000000000000000000000000000000000
Note: See TracChangeset for help on using the changeset viewer.