Changeset 3153 in CLRX


Ignore:
Timestamp:
Jun 14, 2017, 7:52:04 PM (2 years ago)
Author:
matszpk
Message:

CLRadeonExtender: GalliumBinGen?: fixed generating binaries for LLVM390. Add support for new Mesa and new LLVM for samples (not tested).

Location:
CLRadeonExtender/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/amdbin/GalliumBinaries.cpp

    r3152 r3153  
    526526                }
    527527            }
    528             fob.writeArray(3, outEntries);
     528            fob.writeArray(progInfoEntriesNum, outEntries);
    529529        }
    530530    }
     
    549549            SHT_NOBITS, SHF_ALLOC|SHF_WRITE));
    550550    // write configuration for kernel execution
    551     elfBinGen.addRegion(ElfRegion(uint64_t(24U)*kernelsNum, &amdGpuConfigContent, 1,
    552             ".AMDGPU.config", SHT_PROGBITS, 0));
     551    const cxuint progInfoEntriesNum = input->isLLVM390 ? 5 : 3;
     552    elfBinGen.addRegion(ElfRegion(uint64_t(8U*progInfoEntriesNum)*kernelsNum,
     553            &amdGpuConfigContent, 1, ".AMDGPU.config", SHT_PROGBITS, 0));
    553554   
    554555    if (input->globalData!=nullptr)
  • CLRadeonExtender/trunk/samples/CLUtils.cpp

    r2907 r3153  
    259259   
    260260    // get bits from device name (LLVM version)
    261 #if HAVE_64BIT
     261    cxuint llvmVersion = 0;
     262    cxuint mesaVersion = 0;
    262263    if (binaryFormat == BinaryFormat::GALLIUM)
    263264    {
     
    273274                minorVerPart++; // skip '.'
    274275                cxuint minorVersion = cstrtoui(minorVerPart, nullptr, end);
     276                llvmVersion = majorVersion*10000U + minorVersion*100U;
     277#if HAVE_64BIT
    275278                if (majorVersion*10000U + minorVersion*100U >= 30900U)
    276279                    bits = 64; // use 64-bit
     280#endif
    277281            }
    278282            catch(const ParseException& ex)
    279283            { } // ignore error
    280284        }
    281     }
    282 #endif
     285        const char* mesaPart = strstr(deviceName.get(), "Mesa ");
     286        if (mesaPart!=nullptr)
     287        {
     288            try
     289            {
     290                const char* majorVerPart = mesaPart+5;
     291                const char* minorVerPart;
     292                const char* end;
     293                cxuint majorVersion = cstrtoui(majorVerPart, nullptr, minorVerPart);
     294                minorVerPart++; // skip '.'
     295                cxuint minorVersion = cstrtoui(minorVerPart, nullptr, end);
     296                mesaVersion = majorVersion*10000U + minorVersion*100U;
     297            }
     298            catch(const ParseException& ex)
     299            { } // ignore error
     300        }
     301    }
    283302    /* assemble source code */
    284303    /// determine device type
     
    317336        Assembler assembler("", astream, 0, binaryFormat, devType);
    318337        assembler.set64Bit(bits==64);
     338        assembler.setLLVMVersion(llvmVersion);
     339        if (binaryFormat == BinaryFormat::GALLIUM)
     340            assembler.setDriverVersion(mesaVersion);
    319341        assembler.assemble();
    320342        assembler.writeBinary(binary);
  • CLRadeonExtender/trunk/tests/amdbin/GalliumBinGen.cpp

    r2682 r3153  
    6363    input.commentSize = ULEV(commentHdr.sh_size);
    6464    input.comment = (const char*)elfBin.getSectionContent(".comment");
     65    input.isMesa170 = galliumBin->isMesa170();
     66    input.isLLVM390 = elfBin.isLLVM390();
    6567   
    6668    // kernel input
Note: See TracChangeset for help on using the changeset viewer.