build: add clang-tidy restriction for Enum case

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2023-12-19 12:39:07 +00:00
committed by Compute-Runtime-Automation
parent 590418a588
commit a4888b39c6
107 changed files with 834 additions and 1367 deletions

View File

@@ -149,7 +149,7 @@ BinaryFormats getBinaryFormatForDisassemble(OclocArgHelper *argHelper, const std
template ZebinDecoder<Elf::EI_CLASS_32>::ZebinDecoder(OclocArgHelper *argHelper);
template ZebinDecoder<Elf::EI_CLASS_64>::ZebinDecoder(OclocArgHelper *argHelper);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ZebinDecoder<numBits>::ZebinDecoder(OclocArgHelper *argHelper) : argHelper(argHelper),
iga(new IgaWrapper) {
iga->setMessagePrinter(argHelper->getPrinterRef());
@@ -157,12 +157,12 @@ ZebinDecoder<numBits>::ZebinDecoder(OclocArgHelper *argHelper) : argHelper(argHe
template ZebinDecoder<Elf::EI_CLASS_32>::~ZebinDecoder();
template ZebinDecoder<Elf::EI_CLASS_64>::~ZebinDecoder();
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ZebinDecoder<numBits>::~ZebinDecoder() {}
template ErrorCode ZebinDecoder<Elf::EI_CLASS_32>::decode();
template ErrorCode ZebinDecoder<Elf::EI_CLASS_64>::decode();
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ErrorCode ZebinDecoder<numBits>::decode() {
auto zebinBinary = argHelper->readBinaryFile(this->arguments.binaryFile);
ArrayRef<const uint8_t> zebinBinaryRef = {reinterpret_cast<const uint8_t *>(zebinBinary.data()),
@@ -202,14 +202,14 @@ ErrorCode ZebinDecoder<numBits>::decode() {
template ErrorCode ZebinDecoder<Elf::EI_CLASS_32>::validateInput(const std::vector<std::string> &args);
template ErrorCode ZebinDecoder<Elf::EI_CLASS_64>::validateInput(const std::vector<std::string> &args);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ErrorCode ZebinDecoder<numBits>::validateInput(const std::vector<std::string> &args) {
return Manipulator::validateInput(args, iga.get(), argHelper, arguments);
}
template void ZebinDecoder<Elf::EI_CLASS_32>::printHelp();
template void ZebinDecoder<Elf::EI_CLASS_64>::printHelp();
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
void ZebinDecoder<numBits>::printHelp() {
argHelper->printf(R"===(Disassembles Zebin.
Output of such operation is a set of files that can be later used to reassemble back.
@@ -230,13 +230,13 @@ Usage: ocloc disasm -file <file> [-dump <dump_dir>] [-device <device_type>] [-sk
)===");
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
void ZebinDecoder<numBits>::dump(ConstStringRef name, ArrayRef<const uint8_t> data) {
auto outPath = arguments.pathToDump + name.str();
argHelper->saveOutput(outPath, data.begin(), data.size());
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
void ZebinDecoder<numBits>::dumpKernelData(ConstStringRef name, ArrayRef<const uint8_t> data) {
std::string disassembledKernel;
if (false == arguments.skipIGAdisassembly &&
@@ -247,7 +247,7 @@ void ZebinDecoder<numBits>::dumpKernelData(ConstStringRef name, ArrayRef<const u
}
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
void ZebinDecoder<numBits>::dumpSymtab(ElfT &elf, ArrayRef<const uint8_t> symtabData) {
ArrayRef<const ElfSymT> symbols(reinterpret_cast<const ElfSymT *>(symtabData.begin()),
symtabData.size() / sizeof(ElfSymT));
@@ -277,7 +277,7 @@ void ZebinDecoder<numBits>::dumpSymtab(ElfT &elf, ArrayRef<const uint8_t> symtab
dump(Zebin::Elf::SectionNames::symtab, ArrayRef<const uint8_t>::fromAny(symbolsFileStr.data(), symbolsFileStr.size()));
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
std::vector<SectionInfo> ZebinDecoder<numBits>::dumpElfSections(ElfT &elf) {
std::vector<SectionInfo> sectionInfos;
for (size_t secId = 1U; secId < elf.sectionHeaders.size(); secId++) {
@@ -302,7 +302,7 @@ std::vector<SectionInfo> ZebinDecoder<numBits>::dumpElfSections(ElfT &elf) {
return sectionInfos;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
void ZebinDecoder<numBits>::dumpSectionInfo(const std::vector<SectionInfo> &sectionInfos) {
std::stringstream sectionsInfoStr;
sectionsInfoStr << "ElfType " << (numBits == Elf::EI_CLASS_64 ? "64b" : "32b") << std::endl;
@@ -314,7 +314,7 @@ void ZebinDecoder<numBits>::dumpSectionInfo(const std::vector<SectionInfo> &sect
dump(sectionsInfoFilename, ArrayRef<const uint8_t>::fromAny(sectionInfoStr.data(), sectionInfoStr.size()));
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ErrorCode ZebinDecoder<numBits>::decodeZebin(ArrayRef<const uint8_t> zebin, ElfT &outElf) {
std::string errors, warnings;
outElf = Elf::decodeElf<numBits>(zebin, errors, warnings);
@@ -327,7 +327,7 @@ ErrorCode ZebinDecoder<numBits>::decodeZebin(ArrayRef<const uint8_t> zebin, ElfT
return OCLOC_SUCCESS;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
std::vector<NEO::Zebin::Elf::IntelGTNote> ZebinDecoder<numBits>::getIntelGTNotes(ElfT &elf) {
std::vector<Zebin::Elf::IntelGTNote> intelGTNotes;
std::string errors, warnings;
@@ -338,7 +338,7 @@ std::vector<NEO::Zebin::Elf::IntelGTNote> ZebinDecoder<numBits>::getIntelGTNotes
return intelGTNotes;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
void ZebinDecoder<numBits>::dumpRel(ConstStringRef name, ArrayRef<const uint8_t> data) {
ArrayRef<const ElfRelT> relocs = {reinterpret_cast<const ElfRelT *>(data.begin()),
data.size() / sizeof(ElfRelT)};
@@ -353,7 +353,7 @@ void ZebinDecoder<numBits>::dumpRel(ConstStringRef name, ArrayRef<const uint8_t>
dump(name, ArrayRef<const uint8_t>::fromAny(relocsFileStr.data(), relocsFileStr.length()));
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
void ZebinDecoder<numBits>::dumpRela(ConstStringRef name, ArrayRef<const uint8_t> data) {
ArrayRef<const ElfRelaT> relocs = {reinterpret_cast<const ElfRelaT *>(data.begin()),
data.size() / sizeof(ElfRelaT)};
@@ -371,19 +371,19 @@ void ZebinDecoder<numBits>::dumpRela(ConstStringRef name, ArrayRef<const uint8_t
template ZebinEncoder<Elf::EI_CLASS_32>::ZebinEncoder(OclocArgHelper *argHelper);
template ZebinEncoder<Elf::EI_CLASS_64>::ZebinEncoder(OclocArgHelper *argHelper);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ZebinEncoder<numBits>::ZebinEncoder(OclocArgHelper *argHelper) : argHelper(argHelper), iga(new IgaWrapper) {
iga->setMessagePrinter(argHelper->getPrinterRef());
}
template ZebinEncoder<Elf::EI_CLASS_32>::~ZebinEncoder();
template ZebinEncoder<Elf::EI_CLASS_64>::~ZebinEncoder();
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ZebinEncoder<numBits>::~ZebinEncoder() {}
template ErrorCode ZebinEncoder<Elf::EI_CLASS_32>::encode();
template ErrorCode ZebinEncoder<Elf::EI_CLASS_64>::encode();
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ErrorCode ZebinEncoder<numBits>::encode() {
ErrorCode retVal = OCLOC_SUCCESS;
@@ -409,8 +409,8 @@ ErrorCode ZebinEncoder<numBits>::encode() {
}
ElfEncoderT elfEncoder;
elfEncoder.getElfFileHeader().machine = Elf::ELF_MACHINE::EM_INTELGT;
elfEncoder.getElfFileHeader().type = Zebin::Elf::ELF_TYPE_ZEBIN::ET_ZEBIN_EXE;
elfEncoder.getElfFileHeader().machine = Elf::ElfMachine::EM_INTELGT;
elfEncoder.getElfFileHeader().type = Zebin::Elf::ElfTypeZebin::ET_ZEBIN_EXE;
retVal = appendSections(elfEncoder, sectionInfos);
if (retVal != OCLOC_SUCCESS) {
@@ -426,14 +426,14 @@ ErrorCode ZebinEncoder<numBits>::encode() {
template ErrorCode ZebinEncoder<Elf::EI_CLASS_32>::validateInput(const std::vector<std::string> &args);
template ErrorCode ZebinEncoder<Elf::EI_CLASS_64>::validateInput(const std::vector<std::string> &args);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ErrorCode ZebinEncoder<numBits>::validateInput(const std::vector<std::string> &args) {
return Manipulator::validateInput(args, iga.get(), argHelper, arguments);
}
template void ZebinEncoder<Elf::EI_CLASS_32>::printHelp();
template void ZebinEncoder<Elf::EI_CLASS_64>::printHelp();
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
void ZebinEncoder<numBits>::printHelp() {
argHelper->printf(R"===(Assembles Zebin from input files.
It's expected that input files were previously generated by 'ocloc disasm'
@@ -452,7 +452,7 @@ Usage: ocloc asm -file <file> [-dump <dump_dir>] [-device <device_type>] [-skip-
)===");
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
std::vector<char> ZebinEncoder<numBits>::getIntelGTNotesSection(const std::vector<SectionInfo> &sectionInfos) {
bool containsIntelGTNoteSection = false;
for (auto &sectionInfo : sectionInfos) {
@@ -469,7 +469,7 @@ std::vector<char> ZebinEncoder<numBits>::getIntelGTNotesSection(const std::vecto
return argHelper->readBinaryFile(getFilePath(Zebin::Elf::SectionNames::noteIntelGT.data()));
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
std::vector<NEO::Zebin::Elf::IntelGTNote> ZebinEncoder<numBits>::getIntelGTNotes(const std::vector<char> &intelGtNotesSection) {
std::vector<Zebin::Elf::IntelGTNote> intelGTNotes;
std::string errors, warnings;
@@ -482,7 +482,7 @@ std::vector<NEO::Zebin::Elf::IntelGTNote> ZebinEncoder<numBits>::getIntelGTNotes
return intelGTNotes;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ErrorCode ZebinEncoder<numBits>::loadSectionsInfo(std::vector<SectionInfo> &sectionInfos) {
std::vector<std::string> sectionsInfoLines;
argHelper->readFileToVectorOfStrings(getFilePath(sectionsInfoFilename.data()), sectionsInfoLines);
@@ -501,7 +501,7 @@ ErrorCode ZebinEncoder<numBits>::loadSectionsInfo(std::vector<SectionInfo> &sect
return OCLOC_SUCCESS;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ErrorCode ZebinEncoder<numBits>::checkIfAllFilesExist(const std::vector<SectionInfo> &sectionInfos) {
for (auto &sectionInfo : sectionInfos) {
bool fileExists = argHelper->fileExists(getFilePath(sectionInfo.name));
@@ -517,7 +517,7 @@ ErrorCode ZebinEncoder<numBits>::checkIfAllFilesExist(const std::vector<SectionI
return OCLOC_SUCCESS;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ErrorCode ZebinEncoder<numBits>::appendSections(ElfEncoderT &encoder, const std::vector<SectionInfo> &sectionInfos) {
SecNameToIdMapT secNameToId;
size_t symtabIdx = std::numeric_limits<size_t>::max();
@@ -545,7 +545,7 @@ ErrorCode ZebinEncoder<numBits>::appendSections(ElfEncoderT &encoder, const std:
return retVal;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ErrorCode ZebinEncoder<numBits>::appendRel(ElfEncoderT &encoder, const SectionInfo &section, size_t targetSecId, size_t symtabSecId) {
std::vector<std::string> relocationLines;
argHelper->readFileToVectorOfStrings(getFilePath(section.name), relocationLines);
@@ -560,7 +560,7 @@ ErrorCode ZebinEncoder<numBits>::appendRel(ElfEncoderT &encoder, const SectionIn
return OCLOC_SUCCESS;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ErrorCode ZebinEncoder<numBits>::appendRela(ElfEncoderT &encoder, const SectionInfo &section, size_t targetSecId, size_t symtabSecId) {
std::vector<std::string> relocationLines;
argHelper->readFileToVectorOfStrings(getFilePath(section.name), relocationLines);
@@ -575,12 +575,12 @@ ErrorCode ZebinEncoder<numBits>::appendRela(ElfEncoderT &encoder, const SectionI
return OCLOC_SUCCESS;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
std::string ZebinEncoder<numBits>::getFilePath(const std::string &filename) {
return arguments.pathToDump + filename;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
std::string ZebinEncoder<numBits>::parseKernelAssembly(ArrayRef<const char> kernelAssembly) {
std::string kernelAssemblyString(kernelAssembly.begin(), kernelAssembly.end());
std::string outBinary;
@@ -590,7 +590,7 @@ std::string ZebinEncoder<numBits>::parseKernelAssembly(ArrayRef<const char> kern
return {};
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ErrorCode ZebinEncoder<numBits>::appendKernel(ElfEncoderT &encoder, const SectionInfo &section) {
if (argHelper->fileExists(getFilePath(section.name + ".asm"))) {
auto data = argHelper->readBinaryFile(getFilePath(section.name + ".asm"));
@@ -604,7 +604,7 @@ ErrorCode ZebinEncoder<numBits>::appendKernel(ElfEncoderT &encoder, const Sectio
return OCLOC_SUCCESS;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ErrorCode ZebinEncoder<numBits>::appendSymtab(ElfEncoderT &encoder, const SectionInfo &section, size_t strtabSecId, SecNameToIdMapT secNameToId) {
std::vector<std::string> symTabLines;
argHelper->readFileToVectorOfStrings(getFilePath(section.name), symTabLines);
@@ -622,14 +622,14 @@ ErrorCode ZebinEncoder<numBits>::appendSymtab(ElfEncoderT &encoder, const Sectio
return OCLOC_SUCCESS;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ErrorCode ZebinEncoder<numBits>::appendOther(ElfEncoderT &encoder, const SectionInfo &section) {
auto sectionData = argHelper->readBinaryFile(getFilePath(section.name));
encoder.appendSection(section.type, section.name, ArrayRef<const uint8_t>::fromAny(sectionData.data(), sectionData.size()));
return OCLOC_SUCCESS;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
std::vector<std::string> ZebinEncoder<numBits>::parseLine(const std::string &line) {
std::vector<std::string> out;
auto ss = std::stringstream(line);
@@ -640,7 +640,7 @@ std::vector<std::string> ZebinEncoder<numBits>::parseLine(const std::string &lin
return out;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
std::vector<typename ZebinEncoder<numBits>::ElfRelT> ZebinEncoder<numBits>::parseRel(const std::vector<std::string> &relocationsFile) {
std::vector<ElfRelT> relocs;
relocs.resize(relocationsFile.size() - 1);
@@ -658,7 +658,7 @@ std::vector<typename ZebinEncoder<numBits>::ElfRelT> ZebinEncoder<numBits>::pars
return relocs;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
std::vector<typename ZebinEncoder<numBits>::ElfRelaT> ZebinEncoder<numBits>::parseRela(const std::vector<std::string> &relocationsFile) {
std::vector<ElfRelaT> relocs;
relocs.resize(relocationsFile.size() - 1);
@@ -677,7 +677,7 @@ std::vector<typename ZebinEncoder<numBits>::ElfRelaT> ZebinEncoder<numBits>::par
return relocs;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
std::vector<typename ZebinEncoder<numBits>::ElfSymT> ZebinEncoder<numBits>::parseSymbols(const std::vector<std::string> &symbolsFile, ElfEncoderT &encoder, size_t &outNumLocalSymbols, SecNameToIdMapT secNameToId) {
std::vector<ElfSymT> symbols;
symbols.resize(symbolsFile.size() - 1);

View File

@@ -23,10 +23,10 @@ namespace NEO {
namespace Elf {
struct IntelGTNote;
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
struct Elf;
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
struct ElfEncoder;
} // namespace Elf
@@ -61,7 +61,7 @@ bool is64BitZebin(OclocArgHelper *argHelper, const std::string &sectionsInfoFile
constexpr ConstStringRef sectionsInfoFilename = "sections.txt";
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
class ZebinDecoder {
public:
using ElfT = Elf::Elf<numBits>;
@@ -95,7 +95,7 @@ class ZebinDecoder {
std::unique_ptr<IgaWrapper> iga;
};
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
class ZebinEncoder {
public:
using ElfEncoderT = Elf::ElfEncoder<numBits>;

View File

@@ -18,6 +18,7 @@
#define OCLOC_MAKE_VERSION(_major, _minor) ((_major << 16) | (_minor & 0x0000ffff))
#endif // OCLOC_MAKE_VERSION
// NOLINTBEGIN(readability-identifier-naming)
typedef enum _ocloc_version_t {
OCLOC_VERSION_1_0 = OCLOC_MAKE_VERSION(1, 0), ///< version 1.0
OCLOC_VERSION_CURRENT = OCLOC_MAKE_VERSION(1, 0), ///< latest known version
@@ -40,6 +41,7 @@ typedef struct _ocloc_name_version {
unsigned int version;
char name[OCLOC_NAME_VERSION_MAX_NAME_SIZE];
} ocloc_name_version;
// NOLINTEND(readability-identifier-naming)
#ifdef _WIN32
#define SIGNATURE __declspec(dllexport) int __cdecl

View File

@@ -15,7 +15,7 @@
#include <vector>
namespace AOT {
enum PRODUCT_CONFIG : uint32_t;
enum PRODUCT_CONFIG : uint32_t; // NOLINT(readability-identifier-naming)
}
class OclocArgHelper;
namespace NEO {

View File

@@ -37,9 +37,9 @@ uint64_t AubHelper::getPTEntryBits(uint64_t pdEntryBits) {
uint32_t AubHelper::getMemType(uint32_t addressSpace) {
if (addressSpace == AubMemDump::AddressSpaceValues::TraceLocal) {
return mem_types::MEM_TYPE_LOCALMEM;
return MemType::local;
}
return mem_types::MEM_TYPE_SYSTEM;
return MemType::system;
}
uint64_t AubHelper::getPerTileLocalMemorySize(const HardwareInfo *pHwInfo) {

View File

@@ -175,7 +175,7 @@ void LinkerInput::addElfTextSegmentRelocation(RelocationInfo relocationInfo, uin
template bool LinkerInput::addRelocation(Elf::Elf<Elf::EI_CLASS_32> &elf, const SectionNameToSegmentIdMap &nameToSegmentId, const typename Elf::Elf<Elf::EI_CLASS_32>::RelocationInfo &reloc);
template bool LinkerInput::addRelocation(Elf::Elf<Elf::EI_CLASS_64> &elf, const SectionNameToSegmentIdMap &nameToSegmentId, const typename Elf::Elf<Elf::EI_CLASS_64>::RelocationInfo &reloc);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
bool LinkerInput::addRelocation(Elf::Elf<numBits> &elf, const SectionNameToSegmentIdMap &nameToSegmentId, const typename Elf::Elf<numBits>::RelocationInfo &reloc) {
auto sectionName = elf.getSectionName(reloc.targetSectionIndex);
@@ -214,7 +214,7 @@ std::optional<uint32_t> LinkerInput::getInstructionSegmentId(const SectionNameTo
template bool LinkerInput::addSymbol(Elf::Elf<Elf::EI_CLASS_32> &elf, const SectionNameToSegmentIdMap &nameToSegmentId, size_t symId);
template bool LinkerInput::addSymbol(Elf::Elf<Elf::EI_CLASS_64> &elf, const SectionNameToSegmentIdMap &nameToSegmentId, size_t symId);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
bool LinkerInput::addSymbol(Elf::Elf<numBits> &elf, const SectionNameToSegmentIdMap &nameToSegmentId, size_t symId) {
auto &elfSymbols = elf.getSymbols();
if (symId >= elfSymbols.size()) {
@@ -271,7 +271,7 @@ bool LinkerInput::addSymbol(Elf::Elf<numBits> &elf, const SectionNameToSegmentId
template void LinkerInput::decodeElfSymbolTableAndRelocations<Elf::EI_CLASS_32>(Elf::Elf<Elf::EI_CLASS_32> &elf, const SectionNameToSegmentIdMap &nameToSegmentId);
template void LinkerInput::decodeElfSymbolTableAndRelocations<Elf::EI_CLASS_64>(Elf::Elf<Elf::EI_CLASS_64> &elf, const SectionNameToSegmentIdMap &nameToSegmentId);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
void LinkerInput::decodeElfSymbolTableAndRelocations(Elf::Elf<numBits> &elf, const SectionNameToSegmentIdMap &nameToSegmentId) {
symbols.reserve(elf.getSymbols().size());
@@ -603,9 +603,9 @@ void Linker::applyDebugDataRelocations(const NEO::Elf::Elf<NEO::Elf::EI_CLASS_64
auto targetSectionOffset = decodedElf.sectionHeaders[reloc.targetSectionIndex].header->offset;
auto relocLocation = reinterpret_cast<uint64_t>(inputOutputElf.begin()) + targetSectionOffset + reloc.offset;
if (static_cast<Elf::RELOCATION_X8664_TYPE>(reloc.relocType) == Elf::RELOCATION_X8664_TYPE::relocation64) {
if (static_cast<Elf::RelocationX8664Type>(reloc.relocType) == Elf::RelocationX8664Type::relocation64) {
*reinterpret_cast<uint64_t *>(relocLocation) = symbolAddress;
} else if (static_cast<Elf::RELOCATION_X8664_TYPE>(reloc.relocType) == Elf::RELOCATION_X8664_TYPE::relocation32) {
} else if (static_cast<Elf::RelocationX8664Type>(reloc.relocType) == Elf::RelocationX8664Type::relocation32) {
*reinterpret_cast<uint32_t *>(relocLocation) = static_cast<uint32_t>(symbolAddress & uint32_t(-1));
}
}

View File

@@ -118,13 +118,13 @@ struct LinkerInput {
void addElfTextSegmentRelocation(RelocationInfo relocationInfo, uint32_t instructionsSegmentId);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
void decodeElfSymbolTableAndRelocations(Elf::Elf<numBits> &elf, const SectionNameToSegmentIdMap &nameToSegmentId);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
bool addSymbol(Elf::Elf<numBits> &elf, const SectionNameToSegmentIdMap &nameToSegmentId, size_t symId);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
bool addRelocation(Elf::Elf<numBits> &elf, const SectionNameToSegmentIdMap &nameToSegmentId, const typename Elf::Elf<numBits>::RelocationInfo &relocation);
std::optional<uint32_t> getInstructionSegmentId(const SectionNameToSegmentIdMap &kernelNameToSegId, const std::string &kernelName);

View File

@@ -21,7 +21,7 @@
namespace NEO {
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
SingleDeviceBinary unpackSingleZebin(const ArrayRef<const uint8_t> archive, const ConstStringRef requestedProductAbbreviation, const TargetDevice &requestedTargetDevice,
std::string &outErrReason, std::string &outWarning) {
if (1 == NEO::debugManager.flags.DumpZEBin.get()) {
@@ -58,7 +58,7 @@ SingleDeviceBinary unpackSingleZebin(const ArrayRef<const uint8_t> archive, cons
}
bool validForTarget = true;
if (elf.elfFileHeader->machine == Elf::ELF_MACHINE::EM_INTELGT) {
if (elf.elfFileHeader->machine == Elf::ElfMachine::EM_INTELGT) {
validForTarget &= Zebin::validateTargetDevice(elf, requestedTargetDevice, outErrReason, outWarning, ret.generator);
} else {
const auto &flags = reinterpret_cast<const NEO::Zebin::Elf::ZebinTargetFlags &>(elf.elfFileHeader->flags);
@@ -92,7 +92,7 @@ SingleDeviceBinary unpackSingleDeviceBinary<NEO::DeviceBinaryFormat::zebin>(cons
: unpackSingleZebin<Elf::EI_CLASS_64>(archive, requestedProductAbbreviation, requestedTargetDevice, outErrReason, outWarning);
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
void prepareLinkerInputForZebin(ProgramInfo &programInfo, Elf::Elf<numBits> &elf) {
programInfo.prepareLinkerInputStorage();
@@ -107,7 +107,7 @@ void prepareLinkerInputForZebin(ProgramInfo &programInfo, Elf::Elf<numBits> &elf
programInfo.linkerInput->decodeElfSymbolTableAndRelocations(elf, nameToKernelId);
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
DecodeError decodeSingleZebin(ProgramInfo &dst, const SingleDeviceBinary &src, std::string &outErrReason, std::string &outWarning) {
auto elf = Elf::decodeElf<numBits>(src.deviceBinary, outErrReason, outWarning);
if (nullptr == elf.elfFileHeader) {

View File

@@ -17,46 +17,46 @@ namespace NEO {
namespace Elf {
// Elf identifier class
enum ELF_IDENTIFIER_CLASS : uint8_t {
enum ElfIdentifierClass : uint8_t {
EI_CLASS_NONE = 0, // undefined
EI_CLASS_32 = 1, // 32-bit elf file
EI_CLASS_64 = 2, // 64-bit elf file
};
// Elf identifier data
enum ELF_IDENTIFIER_DATA : uint8_t {
enum ElfIdentifierData : uint8_t {
EI_DATA_NONE = 0, // undefined
EI_DATA_LITTLE_ENDIAN = 1, // little-endian
EI_DATA_BIG_ENDIAN = 2, // big-endian
};
// Target machine
enum ELF_MACHINE : uint16_t {
enum ElfMachine : uint16_t {
EM_NONE = 0, // No specific instruction set
EM_INTELGT = 205,
};
// Elf version
enum ELF_VERSION_ : uint8_t {
enum ElfVersion : uint8_t {
EV_INVALID = 0, // undefined
EV_CURRENT = 1, // current
};
// Elf type
enum ELF_TYPE : uint16_t {
enum ElfType : uint16_t {
ET_NONE = 0, // undefined
ET_REL = 1, // relocatable
ET_EXEC = 2, // executable
ET_DYN = 3, // shared object
ET_CORE = 4, // core file
ET_LOPROC = 0xff00, // start of processor-specific type
ET_OPENCL_RESERVED_START = 0xff01, // start of Intel OCL ELF_TYPES
ET_OPENCL_RESERVED_END = 0xff05, // end of Intel OCL ELF_TYPES
ET_OPENCL_RESERVED_START = 0xff01, // start of Intel OCL ElfTypeS
ET_OPENCL_RESERVED_END = 0xff05, // end of Intel OCL ElfTypeS
ET_HIPROC = 0xffff // end of processor-specific types
};
// Section header type
enum SECTION_HEADER_TYPE : uint32_t {
enum SectionHeaderType : uint32_t {
SHT_NULL = 0, // inactive section header
SHT_PROGBITS = 1, // program data
SHT_SYMTAB = 2, // symbol table
@@ -80,11 +80,11 @@ enum SECTION_HEADER_TYPE : uint32_t {
SHT_OPENCL_RESERVED_END = 0xff00000c // end of Intel OCL SHT_TYPES
};
enum SPECIAL_SECTION_HEADER_NUMBER : uint16_t {
enum SpecialSectionHeaderNumber : uint16_t {
SHN_UNDEF = 0U, // undef section
};
enum SECTION_HEADER_FLAGS : uint32_t {
enum SectionHeaderFlags : uint32_t {
SHF_NONE = 0x0, // no flags
SHF_WRITE = 0x1, // writeable data
SHF_ALLOC = 0x2, // occupies memory during execution
@@ -100,7 +100,7 @@ enum SECTION_HEADER_FLAGS : uint32_t {
SHF_MASKPROC = 0xf0000000, // processor-specific flags
};
enum PROGRAM_HEADER_TYPE {
enum ProgramHeaderType {
PT_NULL = 0x0, // unused segment
PT_LOAD = 0x1, // loadable segment
PT_DYNAMIC = 0x2, // dynamic linking information
@@ -115,7 +115,7 @@ enum PROGRAM_HEADER_TYPE {
PT_HIPROC = 0x7FFFFFFF // end processor-specific segments
};
enum PROGRAM_HEADER_FLAGS : uint32_t {
enum ProgramHeaderFlags : uint32_t {
PF_NONE = 0x0, // all access denied
PF_X = 0x1, // execute
PF_W = 0x2, // write
@@ -125,14 +125,14 @@ enum PROGRAM_HEADER_FLAGS : uint32_t {
};
enum SYMBOL_TABLE_TYPE : uint32_t {
enum SymbolTableType : uint32_t {
STT_NOTYPE = 0,
STT_OBJECT = 1,
STT_FUNC = 2,
STT_SECTION = 3
};
enum SYMBOL_TABLE_BIND : uint32_t {
enum SymbolTableBind : uint32_t {
STB_LOCAL = 0,
STB_GLOBAL = 1
};
@@ -140,7 +140,7 @@ enum SYMBOL_TABLE_BIND : uint32_t {
inline constexpr const char elfMagic[4] = {0x7f, 'E', 'L', 'F'};
struct ElfFileHeaderIdentity {
ElfFileHeaderIdentity(ELF_IDENTIFIER_CLASS classBits)
ElfFileHeaderIdentity(ElfIdentifierClass classBits)
: eClass(classBits) {
}
char magic[4] = {elfMagic[0], elfMagic[1], elfMagic[2], elfMagic[3]}; // should match elfMagic
@@ -258,7 +258,7 @@ struct ElfSectionHeader {
static_assert(sizeof(ElfSectionHeader<EI_CLASS_32>) == 0x28, "");
static_assert(sizeof(ElfSectionHeader<EI_CLASS_64>) == 0x40, "");
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
struct ElfFileHeaderTypes;
template <>
@@ -295,7 +295,7 @@ struct ElfFileHeaderTypes<EI_CLASS_64> {
using ShStrNdx = uint16_t;
};
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
struct ElfFileHeader {
ElfFileHeaderIdentity identity = ElfFileHeaderIdentity(numBits); // elf file identity
typename ElfFileHeaderTypes<numBits>::Type type = ET_NONE; // elf file type
@@ -346,7 +346,7 @@ struct ElfSymbolEntryTypes<EI_CLASS_64> {
using Size = uint64_t;
};
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
struct ElfSymbolEntry;
template <>
@@ -506,7 +506,7 @@ constexpr ElfRelocationEntryTypes<EI_CLASS_64>::Info setRelocationType(ElfReloca
}
} // namespace RelocationFuncs
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
struct ElfRel {
using Offset = typename ElfRelocationEntryTypes<numBits>::Offset;
using Info = typename ElfRelocationEntryTypes<numBits>::Info;

View File

@@ -16,7 +16,7 @@ namespace NEO {
namespace Elf {
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
const ElfFileHeader<numBits> *decodeElfFileHeader(const ArrayRef<const uint8_t> binary) {
if (binary.size() < sizeof(ElfFileHeader<numBits>)) {
return nullptr;
@@ -35,7 +35,7 @@ const ElfFileHeader<numBits> *decodeElfFileHeader(const ArrayRef<const uint8_t>
template const ElfFileHeader<EI_CLASS_32> *decodeElfFileHeader<EI_CLASS_32>(const ArrayRef<const uint8_t>);
template const ElfFileHeader<EI_CLASS_64> *decodeElfFileHeader<EI_CLASS_64>(const ArrayRef<const uint8_t>);
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
Elf<numBits> decodeElf(const ArrayRef<const uint8_t> binary, std::string &outErrReason, std::string &outWarning) {
Elf<numBits> ret = {};
ret.elfFileHeader = decodeElfFileHeader<numBits>(binary);
@@ -86,9 +86,9 @@ Elf<numBits> decodeElf(const ArrayRef<const uint8_t> binary, std::string &outErr
return ret;
}
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
bool Elf<numBits>::decodeSymTab(SectionHeaderAndData &sectionHeaderData, std::string &outError) {
if (sectionHeaderData.header->type == SECTION_HEADER_TYPE::SHT_SYMTAB) {
if (sectionHeaderData.header->type == SectionHeaderType::SHT_SYMTAB) {
auto symSize = sizeof(ElfSymbolEntry<numBits>);
if (symSize != sectionHeaderData.header->entsize) {
outError.append("Invalid symbol table entries size - expected : " + std::to_string(symSize) + ", got : " + std::to_string(sectionHeaderData.header->entsize) + "\n");
@@ -106,9 +106,9 @@ bool Elf<numBits>::decodeSymTab(SectionHeaderAndData &sectionHeaderData, std::st
return true;
}
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
bool Elf<numBits>::decodeRelocations(SectionHeaderAndData &sectionHeaderData, std::string &outError) {
if (sectionHeaderData.header->type == SECTION_HEADER_TYPE::SHT_RELA) {
if (sectionHeaderData.header->type == SectionHeaderType::SHT_RELA) {
auto relaSize = sizeof(ElfRela<numBits>);
if (relaSize != sectionHeaderData.header->entsize) {
outError.append("Invalid rela entries size - expected : " + std::to_string(relaSize) + ", got : " + std::to_string(sectionHeaderData.header->entsize) + "\n");
@@ -142,7 +142,7 @@ bool Elf<numBits>::decodeRelocations(SectionHeaderAndData &sectionHeaderData, st
}
}
if (sectionHeaderData.header->type == SECTION_HEADER_TYPE::SHT_REL) {
if (sectionHeaderData.header->type == SectionHeaderType::SHT_REL) {
auto relSize = sizeof(ElfRel<numBits>);
if (relSize != sectionHeaderData.header->entsize) {
outError.append("Invalid rel entries size - expected : " + std::to_string(relSize) + ", got : " + std::to_string(sectionHeaderData.header->entsize) + "\n");
@@ -179,7 +179,7 @@ bool Elf<numBits>::decodeRelocations(SectionHeaderAndData &sectionHeaderData, st
return true;
}
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
bool Elf<numBits>::decodeSections(std::string &outError) {
bool success = true;
for (size_t i = 0; i < sectionHeaders.size(); i++) {
@@ -194,7 +194,7 @@ bool Elf<numBits>::decodeSections(std::string &outError) {
return success;
}
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
bool Elf<numBits>::isDebugDataRelocation(ConstStringRef sectionName) {
if (sectionName.startsWith(NEO::Elf::SpecialSectionNames::debug.data())) {
return true;

View File

@@ -17,12 +17,12 @@ namespace NEO {
namespace Elf {
enum class RELOCATION_X8664_TYPE : uint32_t {
enum class RelocationX8664Type : uint32_t {
relocation64 = 0x1,
relocation32 = 0xa
};
template <ELF_IDENTIFIER_CLASS numBits = EI_CLASS_64>
template <ElfIdentifierClass numBits = EI_CLASS_64>
struct Elf {
struct ProgramHeaderAndData {
const ElfProgramHeader<numBits> *header = nullptr;
@@ -111,17 +111,17 @@ struct Elf {
Relocations debugInfoRelocations;
};
template <ELF_IDENTIFIER_CLASS numBits = EI_CLASS_64>
template <ElfIdentifierClass numBits = EI_CLASS_64>
const ElfFileHeader<numBits> *decodeElfFileHeader(const ArrayRef<const uint8_t> binary);
extern template const ElfFileHeader<EI_CLASS_32> *decodeElfFileHeader<EI_CLASS_32>(const ArrayRef<const uint8_t>);
extern template const ElfFileHeader<EI_CLASS_64> *decodeElfFileHeader<EI_CLASS_64>(const ArrayRef<const uint8_t>);
template <ELF_IDENTIFIER_CLASS numBits = EI_CLASS_64>
template <ElfIdentifierClass numBits = EI_CLASS_64>
Elf<numBits> decodeElf(const ArrayRef<const uint8_t> binary, std::string &outErrReason, std::string &outWarning);
extern template Elf<EI_CLASS_32> decodeElf<EI_CLASS_32>(const ArrayRef<const uint8_t>, std::string &, std::string &);
extern template Elf<EI_CLASS_64> decodeElf<EI_CLASS_64>(const ArrayRef<const uint8_t>, std::string &, std::string &);
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
inline bool isElf(const ArrayRef<const uint8_t> binary) {
return (nullptr != decodeElfFileHeader<numBits>(binary));
}
@@ -130,7 +130,7 @@ inline bool isElf(const ArrayRef<const uint8_t> binary) {
return isElf<EI_CLASS_32>(binary) || isElf<EI_CLASS_64>(binary);
}
inline ELF_IDENTIFIER_CLASS getElfNumBits(const ArrayRef<const uint8_t> binary) {
inline ElfIdentifierClass getElfNumBits(const ArrayRef<const uint8_t> binary) {
if (isElf<EI_CLASS_32>(binary)) {
return EI_CLASS_32;
} else if (isElf<EI_CLASS_64>(binary)) {

View File

@@ -15,7 +15,7 @@ namespace NEO {
namespace Elf {
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
ElfEncoder<numBits>::ElfEncoder(bool addUndefSectionHeader, bool addHeaderSectionNamesSection, typename ElfSectionHeaderTypes<numBits>::AddrAlign defaultDataAlignemnt)
: addUndefSectionHeader(addUndefSectionHeader), addHeaderSectionNamesSection(addHeaderSectionNamesSection), defaultDataAlignment(defaultDataAlignemnt) {
// add special strings
@@ -28,7 +28,7 @@ ElfEncoder<numBits>::ElfEncoder(bool addUndefSectionHeader, bool addHeaderSectio
}
}
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
void ElfEncoder<numBits>::appendSection(const ElfSectionHeader<numBits> &sectionHeader, const ArrayRef<const uint8_t> sectionData) {
sectionHeaders.push_back(sectionHeader);
if ((SHT_NOBITS != sectionHeader.type) && (false == sectionData.empty())) {
@@ -44,7 +44,7 @@ void ElfEncoder<numBits>::appendSection(const ElfSectionHeader<numBits> &section
}
}
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
void ElfEncoder<numBits>::appendSegment(const ElfProgramHeader<numBits> &programHeader, const ArrayRef<const uint8_t> segmentData) {
maxDataAlignmentNeeded = std::max<uint64_t>(maxDataAlignmentNeeded, static_cast<uint64_t>(programHeader.align));
programHeaders.push_back(programHeader);
@@ -61,15 +61,15 @@ void ElfEncoder<numBits>::appendSegment(const ElfProgramHeader<numBits> &program
}
}
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
uint32_t ElfEncoder<numBits>::getSectionHeaderIndex(const ElfSectionHeader<numBits> &sectionHeader) {
UNRECOVERABLE_IF(&sectionHeader < sectionHeaders.begin());
UNRECOVERABLE_IF(&sectionHeader >= sectionHeaders.begin() + sectionHeaders.size());
return static_cast<uint32_t>(&sectionHeader - &*sectionHeaders.begin());
}
template <ELF_IDENTIFIER_CLASS numBits>
ElfSectionHeader<numBits> &ElfEncoder<numBits>::appendSection(SECTION_HEADER_TYPE sectionType, ConstStringRef sectionLabel, const ArrayRef<const uint8_t> sectionData) {
template <ElfIdentifierClass numBits>
ElfSectionHeader<numBits> &ElfEncoder<numBits>::appendSection(SectionHeaderType sectionType, ConstStringRef sectionLabel, const ArrayRef<const uint8_t> sectionData) {
ElfSectionHeader<numBits> section = {};
section.type = static_cast<decltype(section.type)>(sectionType);
section.flags = static_cast<decltype(section.flags)>(SHF_NONE);
@@ -93,8 +93,8 @@ ElfSectionHeader<numBits> &ElfEncoder<numBits>::appendSection(SECTION_HEADER_TYP
return *sectionHeaders.rbegin();
}
template <ELF_IDENTIFIER_CLASS numBits>
ElfProgramHeader<numBits> &ElfEncoder<numBits>::appendSegment(PROGRAM_HEADER_TYPE segmentType, const ArrayRef<const uint8_t> segmentData) {
template <ElfIdentifierClass numBits>
ElfProgramHeader<numBits> &ElfEncoder<numBits>::appendSegment(ProgramHeaderType segmentType, const ArrayRef<const uint8_t> segmentData) {
ElfProgramHeader<numBits> segment = {};
segment.type = static_cast<decltype(segment.type)>(segmentType);
segment.flags = static_cast<decltype(segment.flags)>(PF_NONE);
@@ -104,15 +104,15 @@ ElfProgramHeader<numBits> &ElfEncoder<numBits>::appendSegment(PROGRAM_HEADER_TYP
return *programHeaders.rbegin();
}
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
void ElfEncoder<numBits>::appendProgramHeaderLoad(size_t sectionId, uint64_t vAddr, uint64_t segSize) {
programSectionLookupTable.push_back({programHeaders.size(), sectionId});
auto &programHeader = appendSegment(PROGRAM_HEADER_TYPE::PT_LOAD, {});
auto &programHeader = appendSegment(ProgramHeaderType::PT_LOAD, {});
programHeader.vAddr = static_cast<decltype(programHeader.vAddr)>(vAddr);
programHeader.memSz = static_cast<decltype(programHeader.memSz)>(segSize);
}
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
uint32_t ElfEncoder<numBits>::appendSectionName(ConstStringRef str) {
if (false == addHeaderSectionNamesSection) {
return strSecBuilder.undef();
@@ -120,7 +120,7 @@ uint32_t ElfEncoder<numBits>::appendSectionName(ConstStringRef str) {
return strSecBuilder.appendString(str);
}
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
std::vector<uint8_t> ElfEncoder<numBits>::encode() const {
ElfFileHeader<numBits> elfFileHeader = this->elfFileHeader;
StackVec<ElfProgramHeader<numBits>, 32> programHeaders = this->programHeaders;

View File

@@ -49,7 +49,7 @@ struct StringSectionBuilder {
uint32_t undefStringIdx;
};
template <ELF_IDENTIFIER_CLASS numBits = EI_CLASS_64>
template <ElfIdentifierClass numBits = EI_CLASS_64>
struct ElfEncoder {
ElfEncoder(bool addUndefSectionHeader = true, bool addHeaderSectionNamesSection = true,
typename ElfSectionHeaderTypes<numBits>::AddrAlign defaultDataAlignment = 8U);
@@ -57,19 +57,19 @@ struct ElfEncoder {
void appendSection(const ElfSectionHeader<numBits> &sectionHeader, const ArrayRef<const uint8_t> sectionData);
void appendSegment(const ElfProgramHeader<numBits> &programHeader, const ArrayRef<const uint8_t> segmentData);
ElfSectionHeader<numBits> &appendSection(SECTION_HEADER_TYPE sectionType, ConstStringRef sectionLabel, const ArrayRef<const uint8_t> sectionData);
ElfProgramHeader<numBits> &appendSegment(PROGRAM_HEADER_TYPE segmentType, const ArrayRef<const uint8_t> segmentData);
ElfSectionHeader<numBits> &appendSection(SectionHeaderType sectionType, ConstStringRef sectionLabel, const ArrayRef<const uint8_t> sectionData);
ElfProgramHeader<numBits> &appendSegment(ProgramHeaderType segmentType, const ArrayRef<const uint8_t> segmentData);
uint32_t getSectionHeaderIndex(const ElfSectionHeader<numBits> &sectionHeader);
void appendProgramHeaderLoad(size_t sectionId, uint64_t vAddr, uint64_t segSize);
template <typename SectionHeaderEnumT>
ElfSectionHeader<numBits> &appendSection(SectionHeaderEnumT sectionType, ConstStringRef sectionLabel, const ArrayRef<const uint8_t> sectionData) {
return appendSection(static_cast<SECTION_HEADER_TYPE>(sectionType), sectionLabel, sectionData);
return appendSection(static_cast<SectionHeaderType>(sectionType), sectionLabel, sectionData);
}
template <typename SectionHeaderEnumT>
ElfSectionHeader<numBits> &appendSection(SectionHeaderEnumT sectionType, ConstStringRef sectionLabel, const std::string &sectionData) {
return appendSection(static_cast<SECTION_HEADER_TYPE>(sectionType), sectionLabel,
return appendSection(static_cast<SectionHeaderType>(sectionType), sectionLabel,
ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(sectionData.c_str()), sectionData.size() + 1));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -18,18 +18,18 @@ namespace NEO {
namespace Elf {
enum ELF_TYPE_OPENCL : uint16_t {
enum ElfTypeOpencl : uint16_t {
ET_OPENCL_SOURCE = 0xff01, // format used to pass CL text sections to FE
ET_OPENCL_OBJECTS = 0xff02, // format used to pass LLVM objects / store LLVM binary output
ET_OPENCL_LIBRARY = 0xff03, // format used to store LLVM archive output
ET_OPENCL_EXECUTABLE = 0xff04, // format used to store executable output
ET_OPENCL_DEBUG = 0xff05, // format used to store debug output
};
static_assert(sizeof(ELF_TYPE_OPENCL) == sizeof(ELF_TYPE), "");
static_assert(sizeof(ElfTypeOpencl) == sizeof(ElfType), "");
static_assert(static_cast<uint16_t>(ET_OPENCL_SOURCE) == static_cast<uint16_t>(ET_OPENCL_RESERVED_START), "");
static_assert(static_cast<uint16_t>(ET_OPENCL_DEBUG) == static_cast<uint16_t>(ET_OPENCL_RESERVED_END), "");
enum SHT_OPENCL : uint32_t {
enum SectionHeaderTypeOpencl : uint32_t {
SHT_OPENCL_SOURCE = 0xff000000, // CL source to link into LLVM binary
SHT_OPENCL_HEADER = 0xff000001, // CL header to link into LLVM binary
SHT_OPENCL_LLVM_TEXT = 0xff000002, // LLVM text
@@ -44,7 +44,7 @@ enum SHT_OPENCL : uint32_t {
SHT_OPENCL_SPIRV_SC_IDS = 0xff00000b, // Specialization Constants IDs
SHT_OPENCL_SPIRV_SC_VALUES = 0xff00000c // Specialization Constants values
};
static_assert(sizeof(SHT_OPENCL) == sizeof(SECTION_HEADER_TYPE), "");
static_assert(sizeof(SectionHeaderTypeOpencl) == sizeof(SectionHeaderType), "");
static_assert(static_cast<uint32_t>(SHT_OPENCL_SOURCE) == static_cast<uint32_t>(SHT_OPENCL_RESERVED_START), "");
static_assert(static_cast<uint32_t>(SHT_OPENCL_SPIRV_SC_VALUES) == static_cast<uint32_t>(SHT_OPENCL_RESERVED_END), "");

View File

@@ -99,7 +99,7 @@ void patchWithValue(uintptr_t addr, T value) {
}
}
void DebugZebinCreator::applyRelocation(uintptr_t addr, uint64_t value, RELOC_TYPE_ZEBIN type) {
void DebugZebinCreator::applyRelocation(uintptr_t addr, uint64_t value, RelocTypeZebin type) {
switch (type) {
default:
UNRECOVERABLE_IF(type != R_ZE_SYM_ADDR)
@@ -138,7 +138,7 @@ void DebugZebinCreator::applyRelocations() {
for (const auto *relocations : {&elf.getDebugInfoRelocations(), &elf.getRelocations()}) {
for (const auto &reloc : *relocations) {
auto relocType = static_cast<RELOC_TYPE_ZEBIN>(reloc.relocType);
auto relocType = static_cast<RelocTypeZebin>(reloc.relocType);
if (isRelocTypeSupported(relocType) == false) {
continue;
}
@@ -150,10 +150,10 @@ void DebugZebinCreator::applyRelocations() {
}
}
bool DebugZebinCreator::isRelocTypeSupported(RELOC_TYPE_ZEBIN type) {
return type == RELOC_TYPE_ZEBIN::R_ZE_SYM_ADDR ||
type == RELOC_TYPE_ZEBIN::R_ZE_SYM_ADDR_32 ||
type == RELOC_TYPE_ZEBIN::R_ZE_SYM_ADDR_32_HI;
bool DebugZebinCreator::isRelocTypeSupported(RelocTypeZebin type) {
return type == RelocTypeZebin::R_ZE_SYM_ADDR ||
type == RelocTypeZebin::R_ZE_SYM_ADDR_32 ||
type == RelocTypeZebin::R_ZE_SYM_ADDR_32_HI;
}
const Segments::Segment *DebugZebinCreator::getSegmentByName(ConstStringRef sectionName) {

View File

@@ -48,8 +48,8 @@ class DebugZebinCreator {
inline std::vector<uint8_t> getDebugZebin() { return debugZebin; }
protected:
void applyRelocation(uintptr_t addr, uint64_t value, NEO::Zebin::Elf::RELOC_TYPE_ZEBIN type);
bool isRelocTypeSupported(NEO::Zebin::Elf::RELOC_TYPE_ZEBIN type);
void applyRelocation(uintptr_t addr, uint64_t value, NEO::Zebin::Elf::RelocTypeZebin type);
bool isRelocTypeSupported(NEO::Zebin::Elf::RelocTypeZebin type);
const Segments::Segment *getSegmentByName(ConstStringRef sectionName);
const Segments::Segment *getTextSegmentByName(ConstStringRef textSegmentName);
bool isCpuSegment(ConstStringRef sectionName);

View File

@@ -35,7 +35,7 @@ void setKernelMiscInfoPosition(ConstStringRef metadata, NEO::ProgramInfo &dst) {
template bool isZebin<Elf::EI_CLASS_32>(ArrayRef<const uint8_t> binary);
template bool isZebin<Elf::EI_CLASS_64>(ArrayRef<const uint8_t> binary);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
bool isZebin(ArrayRef<const uint8_t> binary) {
auto fileHeader = Elf::decodeElfFileHeader<numBits>(binary);
return fileHeader != nullptr &&
@@ -43,7 +43,7 @@ bool isZebin(ArrayRef<const uint8_t> binary) {
fileHeader->type == Elf::ET_ZEBIN_EXE);
}
bool validateTargetDevice(const TargetDevice &targetDevice, Elf::ELF_IDENTIFIER_CLASS numBits, PRODUCT_FAMILY productFamily, GFXCORE_FAMILY gfxCore, AOT::PRODUCT_CONFIG productConfig, Elf::ZebinTargetFlags targetMetadata) {
bool validateTargetDevice(const TargetDevice &targetDevice, Elf::ElfIdentifierClass numBits, PRODUCT_FAMILY productFamily, GFXCORE_FAMILY gfxCore, AOT::PRODUCT_CONFIG productConfig, Elf::ZebinTargetFlags targetMetadata) {
if (targetDevice.maxPointerSizeInBytes == 4 && static_cast<uint32_t>(numBits == Elf::EI_CLASS_64)) {
return false;
}
@@ -77,7 +77,7 @@ bool validateTargetDevice(const TargetDevice &targetDevice, Elf::ELF_IDENTIFIER_
template bool validateTargetDevice<Elf::EI_CLASS_32>(const Elf::Elf<Elf::EI_CLASS_32> &elf, const TargetDevice &targetDevice, std::string &outErrReason, std::string &outWarning, GeneratorType &generatorType);
template bool validateTargetDevice<Elf::EI_CLASS_64>(const Elf::Elf<Elf::EI_CLASS_64> &elf, const TargetDevice &targetDevice, std::string &outErrReason, std::string &outWarning, GeneratorType &generatorType);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
bool validateTargetDevice(const Elf::Elf<numBits> &elf, const TargetDevice &targetDevice, std::string &outErrReason, std::string &outWarning, GeneratorType &generatorType) {
GFXCORE_FAMILY gfxCore = IGFX_UNKNOWN_CORE;
PRODUCT_FAMILY productFamily = IGFX_UNKNOWN;
@@ -143,7 +143,7 @@ bool validateTargetDevice(const Elf::Elf<numBits> &elf, const TargetDevice &targ
return validateTargetDevice(targetDevice, numBits, productFamily, gfxCore, productConfig, targetMetadata);
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
DecodeError decodeIntelGTNoteSection(ArrayRef<const uint8_t> intelGTNotesSection, std::vector<Elf::IntelGTNote> &intelGTNotes, std::string &outErrReason, std::string &outWarning) {
uint64_t currentPos = 0;
auto sectionSize = intelGTNotesSection.size();
@@ -189,7 +189,7 @@ DecodeError decodeIntelGTNoteSection(ArrayRef<const uint8_t> intelGTNotesSection
return DecodeError::success;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
DecodeError getIntelGTNotes(const Elf::Elf<numBits> &elf, std::vector<Elf::IntelGTNote> &intelGTNotes, std::string &outErrReason, std::string &outWarning) {
for (size_t i = 0; i < elf.sectionHeaders.size(); i++) {
auto section = elf.sectionHeaders[i];
@@ -200,7 +200,7 @@ DecodeError getIntelGTNotes(const Elf::Elf<numBits> &elf, std::vector<Elf::Intel
return DecodeError::success;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
DecodeError extractZebinSections(NEO::Elf::Elf<numBits> &elf, ZebinSections<numBits> &out, std::string &outErrReason, std::string &outWarning) {
if ((elf.elfFileHeader->shStrNdx >= elf.sectionHeaders.size()) || (NEO::Elf::SHN_UNDEF == elf.elfFileHeader->shStrNdx)) {
outErrReason.append("DeviceBinaryFormat::zebin : Invalid or missing shStrNdx in elf header\n");
@@ -305,7 +305,7 @@ bool validateZebinSectionsCountAtMost(const ContainerT &sectionsContainer, Const
template DecodeError validateZebinSectionsCount<Elf::EI_CLASS_32>(const ZebinSections<Elf::EI_CLASS_32> &sections, std::string &outErrReason, std::string &outWarning);
template DecodeError validateZebinSectionsCount<Elf::EI_CLASS_64>(const ZebinSections<Elf::EI_CLASS_64> &sections, std::string &outErrReason, std::string &outWarning);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
DecodeError validateZebinSectionsCount(const ZebinSections<numBits> &sections, std::string &outErrReason, std::string &outWarning) {
bool valid = validateZebinSectionsCountAtMost(sections.zeInfoSections, Elf::SectionNames::zeInfo, 1U, outErrReason, outWarning);
valid &= validateZebinSectionsCountAtMost(sections.globalDataSections, Elf::SectionNames::dataGlobal, 1U, outErrReason, outWarning);
@@ -319,7 +319,7 @@ DecodeError validateZebinSectionsCount(const ZebinSections<numBits> &sections, s
return valid ? DecodeError::success : DecodeError::invalidBinary;
}
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ConstStringRef extractZeInfoMetadataString(const ArrayRef<const uint8_t> zebin, std::string &outErrReason, std::string &outWarning) {
auto decodedElf = NEO::Elf::decodeElf<numBits>(zebin, outErrReason, outWarning);
for (const auto &sectionHeader : decodedElf.sectionHeaders) {
@@ -339,7 +339,7 @@ ConstStringRef getZeInfoFromZebin(const ArrayRef<const uint8_t> zebin, std::stri
template DecodeError decodeZebin<Elf::EI_CLASS_32>(ProgramInfo &dst, NEO::Elf::Elf<Elf::EI_CLASS_32> &elf, std::string &outErrReason, std::string &outWarning);
template DecodeError decodeZebin<Elf::EI_CLASS_64>(ProgramInfo &dst, NEO::Elf::Elf<Elf::EI_CLASS_64> &elf, std::string &outErrReason, std::string &outWarning);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
DecodeError decodeZebin(ProgramInfo &dst, NEO::Elf::Elf<numBits> &elf, std::string &outErrReason, std::string &outWarning) {
ZebinSections<numBits> zebinSections;
auto extractError = extractZebinSections(elf, zebinSections, outErrReason, outWarning);
@@ -428,7 +428,7 @@ DecodeError decodeZebin(ProgramInfo &dst, NEO::Elf::Elf<numBits> &elf, std::stri
template ArrayRef<const uint8_t> getKernelHeap<Elf::EI_CLASS_32>(ConstStringRef &kernelName, Elf::Elf<Elf::EI_CLASS_32> &elf, const ZebinSections<Elf::EI_CLASS_32> &zebinSections);
template ArrayRef<const uint8_t> getKernelHeap<Elf::EI_CLASS_64>(ConstStringRef &kernelName, Elf::Elf<Elf::EI_CLASS_64> &elf, const ZebinSections<Elf::EI_CLASS_64> &zebinSections);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ArrayRef<const uint8_t> getKernelHeap(ConstStringRef &kernelName, Elf::Elf<numBits> &elf, const ZebinSections<numBits> &zebinSections) {
auto sectionHeaderNamesData = elf.sectionHeaders[elf.elfFileHeader->shStrNdx].data;
ConstStringRef sectionHeaderNamesString(reinterpret_cast<const char *>(sectionHeaderNamesData.begin()), sectionHeaderNamesData.size());
@@ -444,7 +444,7 @@ ArrayRef<const uint8_t> getKernelHeap(ConstStringRef &kernelName, Elf::Elf<numBi
template ArrayRef<const uint8_t> getKernelGtpinInfo<Elf::EI_CLASS_32>(ConstStringRef &kernelName, Elf::Elf<Elf::EI_CLASS_32> &elf, const ZebinSections<Elf::EI_CLASS_32> &zebinSections);
template ArrayRef<const uint8_t> getKernelGtpinInfo<Elf::EI_CLASS_64>(ConstStringRef &kernelName, Elf::Elf<Elf::EI_CLASS_64> &elf, const ZebinSections<Elf::EI_CLASS_64> &zebinSections);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ArrayRef<const uint8_t> getKernelGtpinInfo(ConstStringRef &kernelName, Elf::Elf<numBits> &elf, const ZebinSections<numBits> &zebinSections) {
auto sectionHeaderNamesData = elf.sectionHeaders[elf.elfFileHeader->shStrNdx].data;
ConstStringRef sectionHeaderNamesString(reinterpret_cast<const char *>(sectionHeaderNamesData.begin()), sectionHeaderNamesData.size());

View File

@@ -15,19 +15,19 @@
#include <vector>
namespace AOT {
enum PRODUCT_CONFIG : uint32_t;
enum PRODUCT_CONFIG : uint32_t; // NOLINT(readability-identifier-naming)
}
namespace NEO {
namespace Elf {
template <NEO::Elf::ELF_IDENTIFIER_CLASS numBits>
template <NEO::Elf::ElfIdentifierClass numBits>
struct Elf;
}
struct ProgramInfo;
namespace Zebin {
template <Elf::ELF_IDENTIFIER_CLASS numBits = Elf::EI_CLASS_64>
template <Elf::ElfIdentifierClass numBits = Elf::EI_CLASS_64>
struct ZebinSections {
using SectionHeaderData = typename NEO::Elf::Elf<numBits>::SectionHeaderAndData;
StackVec<SectionHeaderData *, 32> textKernelSections;
@@ -44,33 +44,33 @@ struct ZebinSections {
StackVec<SectionHeaderData *, 1> buildOptionsSection;
};
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
bool isZebin(ArrayRef<const uint8_t> binary);
bool validateTargetDevice(const TargetDevice &targetDevice, Elf::ELF_IDENTIFIER_CLASS numBits, PRODUCT_FAMILY productFamily, GFXCORE_FAMILY gfxCore, AOT::PRODUCT_CONFIG productConfig, Zebin::Elf::ZebinTargetFlags targetMetadata);
bool validateTargetDevice(const TargetDevice &targetDevice, Elf::ElfIdentifierClass numBits, PRODUCT_FAMILY productFamily, GFXCORE_FAMILY gfxCore, AOT::PRODUCT_CONFIG productConfig, Zebin::Elf::ZebinTargetFlags targetMetadata);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
bool validateTargetDevice(const Elf::Elf<numBits> &elf, const TargetDevice &targetDevice, std::string &outErrReason, std::string &outWarning, GeneratorType &generatorType);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
DecodeError decodeIntelGTNoteSection(ArrayRef<const uint8_t> intelGTNotesSection, std::vector<Elf::IntelGTNote> &intelGTNotes, std::string &outErrReason, std::string &outWarning);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
DecodeError getIntelGTNotes(const Elf::Elf<numBits> &elf, std::vector<Elf::IntelGTNote> &intelGTNotes, std::string &outErrReason, std::string &outWarning);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
DecodeError extractZebinSections(Elf::Elf<numBits> &elf, ZebinSections<numBits> &out, std::string &outErrReason, std::string &outWarning);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
DecodeError validateZebinSectionsCount(const ZebinSections<numBits> &sections, std::string &outErrReason, std::string &outWarning);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
DecodeError decodeZebin(ProgramInfo &dst, Elf::Elf<numBits> &elf, std::string &outErrReason, std::string &outWarning);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ArrayRef<const uint8_t> getKernelHeap(ConstStringRef &kernelName, Elf::Elf<numBits> &elf, const ZebinSections<numBits> &zebinSections);
template <Elf::ELF_IDENTIFIER_CLASS numBits>
template <Elf::ElfIdentifierClass numBits>
ArrayRef<const uint8_t> getKernelGtpinInfo(ConstStringRef &kernelName, Elf::Elf<numBits> &elf, const ZebinSections<numBits> &zebinSections);
void setKernelMiscInfoPosition(ConstStringRef metadata, ProgramInfo &dst);

View File

@@ -12,13 +12,13 @@
namespace NEO::Zebin::Elf {
using namespace NEO::Elf;
enum ELF_TYPE_ZEBIN : uint16_t {
enum ElfTypeZebin : uint16_t {
ET_ZEBIN_REL = 0xff11, // A relocatable ZE binary file
ET_ZEBIN_EXE = 0xff12, // An executable ZE binary file
ET_ZEBIN_DYN = 0xff13, // A shared object ZE binary file
};
enum SHT_ZEBIN : uint32_t {
enum SectionHeaderTypeZebin : uint32_t {
SHT_ZEBIN_SPIRV = 0xff000009, // .spv.kernel section, value the same as SHT_OPENCL_SPIRV
SHT_ZEBIN_ZEINFO = 0xff000011, // .ze_info section
SHT_ZEBIN_GTPIN_INFO = 0xff000012, // .gtpin_info section
@@ -26,7 +26,7 @@ enum SHT_ZEBIN : uint32_t {
SHT_ZEBIN_MISC = 0xff000014 // .misc section
};
enum RELOC_TYPE_ZEBIN : uint32_t {
enum RelocTypeZebin : uint32_t {
R_ZE_NONE,
R_ZE_SYM_ADDR,
R_ZE_SYM_ADDR_32,

View File

@@ -18,7 +18,7 @@
#include <vector>
namespace AOT {
enum PRODUCT_CONFIG : uint32_t;
enum PRODUCT_CONFIG : uint32_t; // NOLINT(readability-identifier-naming)
enum RELEASE : uint32_t;
enum FAMILY : uint32_t;
} // namespace AOT

View File

@@ -11,7 +11,7 @@
#include "third_party/opencl_headers/CL/cl_ext.h"
namespace NEO {
enum GFX3DSTATE_SURFACEFORMAT : unsigned short {
enum SurfaceFormat : unsigned short {
GFX3DSTATE_SURFACEFORMAT_R32G32B32A32_FLOAT = 0x000,
GFX3DSTATE_SURFACEFORMAT_R32G32B32A32_SINT = 0x001,
GFX3DSTATE_SURFACEFORMAT_R32G32B32A32_UINT = 0x002,
@@ -196,7 +196,7 @@ enum class ImagePlane {
struct SurfaceFormatInfo {
GMM_RESOURCE_FORMAT gmmSurfaceFormat;
GFX3DSTATE_SURFACEFORMAT genxSurfaceFormat;
SurfaceFormat genxSurfaceFormat;
uint32_t gmmTileWalk;
uint32_t numChannels;
uint32_t perChannelSizeInBytes;

View File

@@ -41,7 +41,7 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
DrmCommandStreamReceiver(ExecutionEnvironment &executionEnvironment,
uint32_t rootDeviceIndex,
const DeviceBitfield deviceBitfield,
gemCloseWorkerMode mode = gemCloseWorkerMode::gemCloseWorkerActive);
GemCloseWorkerMode mode = GemCloseWorkerMode::gemCloseWorkerActive);
~DrmCommandStreamReceiver() override;
SubmissionStatus flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override;
@@ -54,12 +54,12 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
DrmMemoryManager *getMemoryManager() const;
GmmPageTableMngr *createPageTableManager() override;
gemCloseWorkerMode peekGemCloseWorkerOperationMode() const {
GemCloseWorkerMode peekGemCloseWorkerOperationMode() const {
return this->gemCloseWorkerOperationMode;
}
void initializeDefaultsForInternalEngine() override {
gemCloseWorkerOperationMode = gemCloseWorkerMode::gemCloseWorkerInactive;
gemCloseWorkerOperationMode = GemCloseWorkerMode::gemCloseWorkerInactive;
}
SubmissionStatus printBOsForSubmit(ResidencyContainer &allocationsForResidency, GraphicsAllocation &cmdBufferAllocation);
@@ -77,7 +77,7 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
std::vector<BufferObject *> residency;
std::vector<ExecObject> execObjectsStorage;
Drm *drm;
gemCloseWorkerMode gemCloseWorkerOperationMode;
GemCloseWorkerMode gemCloseWorkerOperationMode;
volatile uint32_t reserved = 0;
int32_t kmdWaitTimeout = -1;

View File

@@ -33,7 +33,7 @@ template <typename GfxFamily>
DrmCommandStreamReceiver<GfxFamily>::DrmCommandStreamReceiver(ExecutionEnvironment &executionEnvironment,
uint32_t rootDeviceIndex,
const DeviceBitfield deviceBitfield,
gemCloseWorkerMode mode)
GemCloseWorkerMode mode)
: BaseClass(executionEnvironment, rootDeviceIndex, deviceBitfield), gemCloseWorkerOperationMode(mode) {
auto rootDeviceEnvironment = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex].get();
@@ -43,11 +43,11 @@ DrmCommandStreamReceiver<GfxFamily>::DrmCommandStreamReceiver(ExecutionEnvironme
execObjectsStorage.reserve(512);
if (this->drm->isVmBindAvailable()) {
gemCloseWorkerOperationMode = gemCloseWorkerMode::gemCloseWorkerInactive;
gemCloseWorkerOperationMode = GemCloseWorkerMode::gemCloseWorkerInactive;
}
if (debugManager.flags.EnableGemCloseWorker.get() != -1) {
gemCloseWorkerOperationMode = debugManager.flags.EnableGemCloseWorker.get() ? gemCloseWorkerMode::gemCloseWorkerActive : gemCloseWorkerMode::gemCloseWorkerInactive;
gemCloseWorkerOperationMode = debugManager.flags.EnableGemCloseWorker.get() ? GemCloseWorkerMode::gemCloseWorkerActive : GemCloseWorkerMode::gemCloseWorkerInactive;
}
auto hwInfo = rootDeviceEnvironment->getHardwareInfo();
@@ -175,7 +175,7 @@ SubmissionStatus DrmCommandStreamReceiver<GfxFamily>::flush(BatchBuffer &batchBu
auto ret = this->flushInternal(batchBuffer, allocationsForResidency);
if (this->gemCloseWorkerOperationMode == gemCloseWorkerMode::gemCloseWorkerActive) {
if (this->gemCloseWorkerOperationMode == GemCloseWorkerMode::gemCloseWorkerActive) {
bb->reference();
this->getMemoryManager()->peekGemCloseWorker()->push(bb);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -19,7 +19,7 @@ class DrmMemoryManager;
class BufferObject;
class Thread;
enum class gemCloseWorkerMode {
enum class GemCloseWorkerMode {
gemCloseWorkerInactive,
gemCloseWorkerActive
};

View File

@@ -53,7 +53,7 @@ namespace NEO {
using AllocationStatus = MemoryManager::AllocationStatus;
DrmMemoryManager::DrmMemoryManager(gemCloseWorkerMode mode,
DrmMemoryManager::DrmMemoryManager(GemCloseWorkerMode mode,
bool forcePinAllowed,
bool validateHostPtrMemory,
ExecutionEnvironment &executionEnvironment) : MemoryManager(executionEnvironment),
@@ -73,7 +73,7 @@ DrmMemoryManager::DrmMemoryManager(gemCloseWorkerMode mode,
initialize(mode);
}
void DrmMemoryManager::initialize(gemCloseWorkerMode mode) {
void DrmMemoryManager::initialize(GemCloseWorkerMode mode) {
bool disableGemCloseWorker = true;
for (uint32_t rootDeviceIndex = 0; rootDeviceIndex < gfxPartitions.size(); ++rootDeviceIndex) {
@@ -87,14 +87,14 @@ void DrmMemoryManager::initialize(gemCloseWorkerMode mode) {
}
if (disableGemCloseWorker) {
mode = gemCloseWorkerMode::gemCloseWorkerInactive;
mode = GemCloseWorkerMode::gemCloseWorkerInactive;
}
if (debugManager.flags.EnableGemCloseWorker.get() != -1) {
mode = debugManager.flags.EnableGemCloseWorker.get() ? gemCloseWorkerMode::gemCloseWorkerActive : gemCloseWorkerMode::gemCloseWorkerInactive;
mode = debugManager.flags.EnableGemCloseWorker.get() ? GemCloseWorkerMode::gemCloseWorkerActive : GemCloseWorkerMode::gemCloseWorkerInactive;
}
if (mode != gemCloseWorkerMode::gemCloseWorkerInactive) {
if (mode != GemCloseWorkerMode::gemCloseWorkerInactive) {
gemCloseWorker.reset(new DrmGemCloseWorker(*this));
}
@@ -1491,7 +1491,7 @@ std::unique_ptr<MemoryManager> DrmMemoryManager::create(ExecutionEnvironment &ex
validateHostPtr = debugManager.flags.EnableHostPtrValidation.get();
}
return std::make_unique<DrmMemoryManager>(gemCloseWorkerMode::gemCloseWorkerActive,
return std::make_unique<DrmMemoryManager>(GemCloseWorkerMode::gemCloseWorkerActive,
debugManager.flags.EnableForcePin.get(),
validateHostPtr,
executionEnvironment);

View File

@@ -22,17 +22,17 @@ class DrmAllocation;
class OsContextLinux;
enum class AtomicAccessMode : uint32_t;
enum class gemCloseWorkerMode;
enum class GemCloseWorkerMode;
class DrmMemoryManager : public MemoryManager {
public:
DrmMemoryManager(gemCloseWorkerMode mode,
DrmMemoryManager(GemCloseWorkerMode mode,
bool forcePinAllowed,
bool validateHostPtrMemory,
ExecutionEnvironment &executionEnvironment);
~DrmMemoryManager() override;
void initialize(gemCloseWorkerMode mode);
void initialize(GemCloseWorkerMode mode);
void addAllocationToHostPtrManager(GraphicsAllocation *gfxAllocation) override;
void removeAllocationFromHostPtrManager(GraphicsAllocation *gfxAllocation) override;
void freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation) override;

View File

@@ -22,19 +22,19 @@ namespace NEO {
bool DeviceTimeWddm::runEscape(Wddm *wddm, TimeStampDataHeader &escapeInfo) {
if (wddm) {
D3DKMT_ESCAPE escapeCommand = {0};
D3DKMT_ESCAPE escapeCommand = {};
GTDIGetGpuCpuTimestampsIn in = {GTDI_FNC_GET_GPU_CPU_TIMESTAMPS};
uint32_t outSize = sizeof(GTDIGetGpuCpuTimestampsOut);
GetGpuCpuTimestampsIn in{};
uint32_t outSize = sizeof(GetGpuCpuTimestampsOut);
escapeInfo.header.EscapeCode = static_cast<decltype(escapeInfo.header.EscapeCode)>(GFX_ESCAPE_IGPA_INSTRUMENTATION_CONTROL);
escapeInfo.header.Size = outSize;
escapeInfo.data.in = in;
escapeCommand.Flags.Value = 0;
escapeCommand.hAdapter = (D3DKMT_HANDLE)0;
escapeCommand.hContext = (D3DKMT_HANDLE)0;
escapeCommand.hDevice = (D3DKMT_HANDLE)wddm->getDeviceHandle();
escapeCommand.hAdapter = 0;
escapeCommand.hContext = 0;
escapeCommand.hDevice = static_cast<D3DKMT_HANDLE>(wddm->getDeviceHandle());
escapeCommand.pPrivateDriverData = &escapeInfo;
escapeCommand.PrivateDriverDataSize = sizeof(escapeInfo);
escapeCommand.Type = D3DKMT_ESCAPE_DRIVERPRIVATE;

View File

@@ -29,44 +29,23 @@ class DeviceTimeWddm : public DeviceTime {
Wddm *wddm = nullptr;
};
typedef enum GTDI_ESCAPE_FUNCTION_ENUM {
GTDI_FNC_GET_GPU_CPU_TIMESTAMPS = 25
} GTDI_ESCAPE_FUNCTION;
struct GetGpuCpuTimestampsIn {
int function = 25; // GTDI_FNC_GET_GPU_CPU_TIMESTAMPS
};
typedef struct GTDIBaseInStruct {
GTDI_ESCAPE_FUNCTION function;
} GTDIHeaderIn;
typedef GTDIHeaderIn GTDIGetGpuCpuTimestampsIn;
typedef enum GTDI_RETURN_CODE_ENUM {
GTDI_RET_OK = 0,
GTDI_RET_FAILED,
GTDI_RET_NOT_CONNECTED,
GTDI_RET_HW_METRICS_NOT_ENABLED,
GTDI_RET_CONTEXT_ID_MISMATCH,
GTDI_RET_NOT_SUPPORTED,
GTDI_RET_PENDING,
GTDI_RET_INVALID_CONFIGURATION,
GTDI_RET_CONCURRENT_API_ENABLED,
GTDI_RET_NO_INFORMATION, // for GTDI_FNC_GET_ERROR_INFO escape only
// ...
GTDI_RET_MAX = 0xFFFFFFFF
} GTDI_RETURN_CODE;
typedef struct GTDIGetGpuCpuTimestampsOutStruct {
GTDI_RETURN_CODE retCode; // Result of the call
uint64_t gpuPerfTicks; // in GPU_timestamp_ticks
uint64_t cpuPerfTicks; // in CPU_timestamp_ticks
uint64_t gpuPerfFreq; // in GPU_timestamp_ticks/s
uint64_t cpuPerfFreq; // in CPU_timestamp_ticks/s
} GTDIGetGpuCpuTimestampsOut;
struct GetGpuCpuTimestampsOut {
int retCode; // Result of the call
uint64_t gpuPerfTicks; // in GPU_timestamp_ticks
uint64_t cpuPerfTicks; // in CPU_timestamp_ticks
uint64_t gpuPerfFreq; // in GPU_timestamp_ticks/s
uint64_t cpuPerfFreq; // in CPU_timestamp_ticks/s
};
struct TimeStampDataHeader {
GFX_ESCAPE_HEADER_T header;
union {
GTDIGetGpuCpuTimestampsIn in;
GTDIGetGpuCpuTimestampsOut out;
GetGpuCpuTimestampsIn in;
GetGpuCpuTimestampsOut out;
} data;
};

View File

@@ -11,7 +11,7 @@
namespace NEO {
enum HAS_MSG_TYPE {
enum HasMsgType {
HAS_MMIO_REQ_TYPE = 0,
HAS_MMIO_RES_TYPE = 1,
HAS_GTT_REQ_TYPE = 2,
@@ -53,7 +53,7 @@ enum HAS_MSG_TYPE {
struct HasHdr {
union {
uint32_t msgType;
HAS_MSG_TYPE type;
HasMsgType type;
};
uint32_t transID;
uint32_t size;
@@ -77,7 +77,7 @@ struct HasMmioReq {
uint32_t data;
enum {
HAS_MSG_TYPE = HAS_MMIO_REQ_TYPE
HasMsgType = HAS_MMIO_REQ_TYPE
};
};
@@ -86,7 +86,7 @@ struct HasMmioExtReq {
uint32_t sourceid : 8;
uint32_t reserved1 : 24;
enum {
HAS_MSG_TYPE = HAS_MMIO_REQ_TYPE
HasMsgType = HAS_MMIO_REQ_TYPE
};
};
@@ -94,7 +94,7 @@ struct HasMmioRes {
uint32_t data;
enum {
HAS_MSG_TYPE = HAS_MMIO_RES_TYPE
HasMsgType = HAS_MMIO_RES_TYPE
};
};
@@ -106,7 +106,7 @@ struct HasGtt32Req {
uint32_t data;
enum {
HAS_MSG_TYPE = HAS_GTT_REQ_TYPE
HasMsgType = HAS_GTT_REQ_TYPE
};
};
@@ -114,7 +114,7 @@ struct HasGtt32Res {
uint32_t data;
enum {
HAS_MSG_TYPE = HAS_GTT_RES_TYPE
HasMsgType = HAS_GTT_RES_TYPE
};
};
@@ -127,7 +127,7 @@ struct HasGtt64Req {
uint32_t dataH;
enum {
HAS_MSG_TYPE = HAS_GTT_REQ_TYPE
HasMsgType = HAS_GTT_REQ_TYPE
};
};
@@ -136,7 +136,7 @@ struct HasGtt64Res {
uint32_t dataH;
enum {
HAS_MSG_TYPE = HAS_GTT_RES_TYPE
HasMsgType = HAS_GTT_RES_TYPE
};
};
@@ -154,7 +154,7 @@ struct HasWriteDataReq {
uint32_t size;
enum {
HAS_MSG_TYPE = HAS_WRITE_DATA_REQ_TYPE
HasMsgType = HAS_WRITE_DATA_REQ_TYPE
};
};
@@ -170,7 +170,7 @@ struct HasReadDataReq {
uint32_t size;
enum {
HAS_MSG_TYPE = HAS_READ_DATA_REQ_TYPE
HasMsgType = HAS_READ_DATA_REQ_TYPE
};
};
@@ -185,7 +185,7 @@ struct HasReadDataRes {
uint32_t size;
enum {
HAS_MSG_TYPE = HAS_READ_DATA_RES_TYPE
HasMsgType = HAS_READ_DATA_RES_TYPE
};
};
@@ -221,7 +221,7 @@ struct HasControlReq {
uint32_t reservedMask : 3; // [31:29]
enum {
HAS_MSG_TYPE = HAS_CONTROL_REQ_TYPE
HasMsgType = HAS_CONTROL_REQ_TYPE
};
};
@@ -229,7 +229,7 @@ struct HasReportRendEndReq {
uint32_t timeout;
enum {
HAS_MSG_TYPE = HAS_REPORT_REND_END_REQ_TYPE
HasMsgType = HAS_REPORT_REND_END_REQ_TYPE
};
};
@@ -238,7 +238,7 @@ struct HasReportRendEndRes {
uint32_t reserved : 31;
enum {
HAS_MSG_TYPE = HAS_REPORT_REND_END_RES_TYPE
HasMsgType = HAS_REPORT_REND_END_RES_TYPE
};
};
@@ -253,7 +253,7 @@ struct HasPcicfgReq {
uint32_t data;
enum {
HAS_MSG_TYPE = HAS_PCICFG_REQ_TYPE
HasMsgType = HAS_PCICFG_REQ_TYPE
};
};
@@ -267,7 +267,7 @@ struct HasGttParamsReq {
uint32_t size : 24;
enum {
HAS_MSG_TYPE = HAS_GTT_PARAMS_REQ_TYPE
HasMsgType = HAS_GTT_PARAMS_REQ_TYPE
};
};
@@ -276,7 +276,7 @@ struct HasEventObsoleteReq {
uint32_t data;
enum {
HAS_MSG_TYPE = HAS_EVENT_REQ_TYPE
HasMsgType = HAS_EVENT_REQ_TYPE
};
};
@@ -287,7 +287,7 @@ struct HasEventReq {
uint32_t reserved : 30;
enum {
HAS_MSG_TYPE = HAS_EVENT_REQ_TYPE
HasMsgType = HAS_EVENT_REQ_TYPE
};
};
@@ -299,7 +299,7 @@ struct HasInnerVarReq {
uint32_t data;
enum {
HAS_MSG_TYPE = HAS_INNER_VAR_REQ_TYPE
HasMsgType = HAS_INNER_VAR_REQ_TYPE
};
};
@@ -307,7 +307,7 @@ struct HasInnerVarRes {
uint32_t data;
enum {
HAS_MSG_TYPE = HAS_INNER_VAR_RES_TYPE
HasMsgType = HAS_INNER_VAR_RES_TYPE
};
};
@@ -315,7 +315,7 @@ struct HasInnerVarListRes {
uint32_t size;
enum {
HAS_MSG_TYPE = HAS_INNER_VAR_LIST_RES_TYPE
HasMsgType = HAS_INNER_VAR_LIST_RES_TYPE
};
};
@@ -334,7 +334,7 @@ struct HasFunnyIoReq {
uint32_t value;
enum {
HAS_MSG_TYPE = HAS_FUNNY_IO_REQ_TYPE
HasMsgType = HAS_FUNNY_IO_REQ_TYPE
};
};
@@ -342,7 +342,7 @@ struct HasFunnyIoRes {
uint32_t data;
enum {
HAS_MSG_TYPE = HAS_FUNNY_IO_RES_TYPE
HasMsgType = HAS_FUNNY_IO_RES_TYPE
};
};
@@ -355,7 +355,7 @@ struct HasIoReq {
uint32_t value;
enum {
HAS_MSG_TYPE = HAS_IO_REQ_TYPE
HasMsgType = HAS_IO_REQ_TYPE
};
};
@@ -363,7 +363,7 @@ struct HasIoRes {
uint32_t data;
enum {
HAS_MSG_TYPE = HAS_IO_RES_TYPE
HasMsgType = HAS_IO_RES_TYPE
};
};
@@ -371,7 +371,7 @@ struct HasRpcReq {
uint32_t size;
enum {
HAS_MSG_TYPE = HAS_RPC_REQ_TYPE
HasMsgType = HAS_RPC_REQ_TYPE
};
};
@@ -380,7 +380,7 @@ struct HasRpcRes {
uint32_t size;
enum {
HAS_MSG_TYPE = HAS_RPC_RES_TYPE
HasMsgType = HAS_RPC_RES_TYPE
};
};
@@ -393,7 +393,7 @@ struct HasClFlushReq {
uint32_t delay;
enum {
HAS_MSG_TYPE = HAS_CL_FLUSH_REQ_TYPE
HasMsgType = HAS_CL_FLUSH_REQ_TYPE
};
};
@@ -401,7 +401,7 @@ struct HasClFlushRes {
uint32_t data;
enum {
HAS_MSG_TYPE = HAS_CL_FLUSH_RES_TYPE
HasMsgType = HAS_CL_FLUSH_RES_TYPE
};
};
@@ -410,7 +410,7 @@ struct HasSimtimeRes {
uint32_t dataH;
enum {
HAS_MSG_TYPE = HAS_SIMTIME_RES_TYPE
HasMsgType = HAS_SIMTIME_RES_TYPE
};
};
@@ -419,7 +419,7 @@ struct HasGd2Message {
uint32_t data[1];
enum {
HAS_MSG_TYPE = HAS_GD2_MESSAGE_TYPE
HasMsgType = HAS_GD2_MESSAGE_TYPE
};
};
@@ -460,10 +460,9 @@ struct HasMsg {
union HasMsgBody u;
};
enum mem_types : uint32_t {
MEM_TYPE_SYSTEM = 0,
MEM_TYPE_LOCALMEM = 1,
MEM_TYPE_MAX = 4
enum MemType : uint32_t {
system = 0,
local = 1,
};
} // namespace NEO

View File

@@ -18,13 +18,13 @@
using namespace NEO;
enum class enabledIrFormat {
enum class EnabledIrFormat {
none,
enableSpirv,
enableLlvm
spirv,
llvm
};
template <enabledIrFormat irFormat = enabledIrFormat::none>
template <EnabledIrFormat irFormat = EnabledIrFormat::none>
struct MockElfBinaryPatchtokens {
MockElfBinaryPatchtokens(const HardwareInfo &hwInfo) : MockElfBinaryPatchtokens(std::string{}, hwInfo){};
MockElfBinaryPatchtokens(const std::string &buildOptions, const HardwareInfo &inputHwInfo) {
@@ -54,9 +54,9 @@ struct MockElfBinaryPatchtokens {
enc.getElfFileHeader().identity = Elf::ElfFileHeaderIdentity(Elf::EI_CLASS_64);
enc.getElfFileHeader().type = NEO::Elf::ET_OPENCL_EXECUTABLE;
enc.appendSection(Elf::SHT_OPENCL_DEV_BINARY, Elf::SectionNamesOpenCl::deviceBinary, ArrayRef<const uint8_t>::fromAny(mockDevBinaryData, mockDevBinaryDataSize));
if (irFormat == enabledIrFormat::enableSpirv)
if (irFormat == EnabledIrFormat::spirv)
enc.appendSection(Elf::SHT_OPENCL_SPIRV, Elf::SectionNamesOpenCl::spirvObject, ArrayRef<const uint8_t>::fromAny(mockSpirvBinaryData, mockSpirvBinaryDataSize));
else if (irFormat == enabledIrFormat::enableLlvm)
else if (irFormat == EnabledIrFormat::llvm)
enc.appendSection(Elf::SHT_OPENCL_LLVM_BINARY, Elf::SectionNamesOpenCl::llvmObject, ArrayRef<const uint8_t>::fromAny(mockLlvmBinaryData, mockLlvmBinaryDataSize));
if (false == buildOptions.empty())
enc.appendSection(Elf::SHT_OPENCL_OPTIONS, Elf::SectionNamesOpenCl::buildOptions, ArrayRef<const uint8_t>::fromAny(buildOptions.data(), buildOptions.size()));

View File

@@ -29,11 +29,11 @@ NTSTATUS gGetDeviceStatePageFaultReturnValue = STATUS_SUCCESS;
NTSTATUS __stdcall mockD3DKMTEscape(IN CONST D3DKMT_ESCAPE *pData) {
static int perfTicks = 0;
++perfTicks;
((NEO::TimeStampDataHeader *)pData->pPrivateDriverData)->data.out.retCode = NEO::GTDI_RET_OK;
((NEO::TimeStampDataHeader *)pData->pPrivateDriverData)->data.out.gpuPerfTicks = ++perfTicks;
((NEO::TimeStampDataHeader *)pData->pPrivateDriverData)->data.out.cpuPerfTicks = perfTicks;
((NEO::TimeStampDataHeader *)pData->pPrivateDriverData)->data.out.gpuPerfFreq = 1;
((NEO::TimeStampDataHeader *)pData->pPrivateDriverData)->data.out.cpuPerfFreq = 1;
auto &getGpuCpuOut = reinterpret_cast<NEO::TimeStampDataHeader *>(pData->pPrivateDriverData)->data.out;
getGpuCpuOut.gpuPerfTicks = ++perfTicks;
getGpuCpuOut.cpuPerfTicks = perfTicks;
getGpuCpuOut.gpuPerfFreq = 1;
getGpuCpuOut.cpuPerfFreq = 1;
return STATUS_SUCCESS;
}

View File

@@ -46,7 +46,7 @@ class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver<GfxFamily
using CommandStreamReceiverHw<GfxFamily>::blitterDirectSubmission;
using CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiver::lastSentSliceCount;
TestedDrmCommandStreamReceiver(gemCloseWorkerMode mode,
TestedDrmCommandStreamReceiver(GemCloseWorkerMode mode,
ExecutionEnvironment &executionEnvironment,
const DeviceBitfield deviceBitfield)
: DrmCommandStreamReceiver<GfxFamily>(executionEnvironment, 0, deviceBitfield, mode) {
@@ -54,7 +54,7 @@ class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver<GfxFamily
TestedDrmCommandStreamReceiver(ExecutionEnvironment &executionEnvironment,
uint32_t rootDeviceIndex,
const DeviceBitfield deviceBitfield)
: DrmCommandStreamReceiver<GfxFamily>(executionEnvironment, rootDeviceIndex, deviceBitfield, gemCloseWorkerMode::gemCloseWorkerInactive) {
: DrmCommandStreamReceiver<GfxFamily>(executionEnvironment, rootDeviceIndex, deviceBitfield, GemCloseWorkerMode::gemCloseWorkerInactive) {
}
void overrideDispatchPolicy(DispatchMode overrideValue) {
@@ -136,7 +136,7 @@ class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver<GfxFamily
template <typename GfxFamily>
class TestedDrmCommandStreamReceiverWithFailingExec : public TestedDrmCommandStreamReceiver<GfxFamily> {
public:
TestedDrmCommandStreamReceiverWithFailingExec(gemCloseWorkerMode mode,
TestedDrmCommandStreamReceiverWithFailingExec(GemCloseWorkerMode mode,
ExecutionEnvironment &executionEnvironment,
const DeviceBitfield deviceBitfield)
: TestedDrmCommandStreamReceiver<GfxFamily>(mode,

View File

@@ -22,7 +22,7 @@ namespace NEO {
std::atomic<int> closeInputFd(0);
std::atomic<int> closeCalledCount(0);
TestedDrmMemoryManager::TestedDrmMemoryManager(ExecutionEnvironment &executionEnvironment) : MemoryManagerCreate(gemCloseWorkerMode::gemCloseWorkerInactive,
TestedDrmMemoryManager::TestedDrmMemoryManager(ExecutionEnvironment &executionEnvironment) : MemoryManagerCreate(GemCloseWorkerMode::gemCloseWorkerInactive,
false,
false,
executionEnvironment) {
@@ -38,7 +38,7 @@ TestedDrmMemoryManager::TestedDrmMemoryManager(bool enableLocalMemory,
bool allowForcePin,
bool validateHostPtrMemory,
ExecutionEnvironment &executionEnvironment) : MemoryManagerCreate(false, enableLocalMemory,
gemCloseWorkerMode::gemCloseWorkerInactive,
GemCloseWorkerMode::gemCloseWorkerInactive,
allowForcePin,
validateHostPtrMemory,
executionEnvironment) {

View File

@@ -11,7 +11,7 @@
#include <unordered_map>
template <NEO::Elf::ELF_IDENTIFIER_CLASS numBits = NEO::Elf::EI_CLASS_64>
template <NEO::Elf::ElfIdentifierClass numBits = NEO::Elf::EI_CLASS_64>
struct MockElf : public NEO::Elf::Elf<numBits> {
using BaseClass = NEO::Elf::Elf<numBits>;
@@ -67,7 +67,7 @@ struct MockElf : public NEO::Elf::Elf<numBits> {
bool overrideSymbolName = false;
};
template <NEO::Elf::ELF_IDENTIFIER_CLASS numBits = NEO::Elf::EI_CLASS_64>
template <NEO::Elf::ElfIdentifierClass numBits = NEO::Elf::EI_CLASS_64>
struct MockElfEncoder : public NEO::Elf::ElfEncoder<numBits> {
using NEO::Elf::ElfEncoder<numBits>::sectionHeaders;
@@ -82,16 +82,16 @@ struct MockElfEncoder : public NEO::Elf::ElfEncoder<numBits> {
static std::vector<uint8_t> createRelocateableDebugDataElf() {
MockElfEncoder<> elfEncoder;
elfEncoder.getElfFileHeader().type = NEO::Elf::ELF_TYPE::ET_REL;
elfEncoder.getElfFileHeader().machine = NEO::Elf::ELF_MACHINE::EM_NONE;
elfEncoder.getElfFileHeader().type = NEO::Elf::ElfType::ET_REL;
elfEncoder.getElfFileHeader().machine = NEO::Elf::ElfMachine::EM_NONE;
uint8_t dummyData[16];
elfEncoder.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Elf::SpecialSectionNames::text.str(), ArrayRef<const uint8_t>(dummyData, sizeof(dummyData)));
auto textSectionIndex = elfEncoder.getLastSectionHeaderIndex();
NEO::Elf::ElfRela<NEO::Elf::ELF_IDENTIFIER_CLASS::EI_CLASS_64> relocationsWithAddend;
NEO::Elf::ElfRela<NEO::Elf::ElfIdentifierClass::EI_CLASS_64> relocationsWithAddend;
relocationsWithAddend.addend = 0x1a8;
relocationsWithAddend.info = static_cast<decltype(relocationsWithAddend.info)>(textSectionIndex) << 32 | uint32_t(NEO::Elf::RELOCATION_X8664_TYPE::relocation64);
relocationsWithAddend.info = static_cast<decltype(relocationsWithAddend.info)>(textSectionIndex) << 32 | uint32_t(NEO::Elf::RelocationX8664Type::relocation64);
relocationsWithAddend.offset = 8;
elfEncoder.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Elf::SpecialSectionNames::debugInfo, ArrayRef<const uint8_t>(dummyData, sizeof(dummyData)));
@@ -108,7 +108,7 @@ struct MockElfEncoder : public NEO::Elf::ElfEncoder<numBits> {
relaDebugSection->info = debugSectionIndex;
relocationsWithAddend.addend = 0;
relocationsWithAddend.info = static_cast<decltype(relocationsWithAddend.info)>(textSectionIndex) << 32 | uint32_t(NEO::Elf::RELOCATION_X8664_TYPE::relocation64);
relocationsWithAddend.info = static_cast<decltype(relocationsWithAddend.info)>(textSectionIndex) << 32 | uint32_t(NEO::Elf::RelocationX8664Type::relocation64);
relocationsWithAddend.offset = 0;
elfEncoder.appendSection(NEO::Elf::SHT_RELA, NEO::Elf::SpecialSectionNames::relaPrefix.str() + NEO::Elf::SpecialSectionNames::debug.str() + "_line",
@@ -118,9 +118,9 @@ struct MockElfEncoder : public NEO::Elf::ElfEncoder<numBits> {
relaDebugLineSection->info = debugLineSectionIndex;
std::vector<uint8_t> symbolTable;
symbolTable.resize(2 * sizeof(NEO::Elf::ElfSymbolEntry<NEO::Elf::ELF_IDENTIFIER_CLASS::EI_CLASS_64>));
symbolTable.resize(2 * sizeof(NEO::Elf::ElfSymbolEntry<NEO::Elf::ElfIdentifierClass::EI_CLASS_64>));
auto symbols = reinterpret_cast<NEO::Elf::ElfSymbolEntry<NEO::Elf::ELF_IDENTIFIER_CLASS::EI_CLASS_64> *>(symbolTable.data());
auto symbols = reinterpret_cast<NEO::Elf::ElfSymbolEntry<NEO::Elf::ElfIdentifierClass::EI_CLASS_64> *>(symbolTable.data());
symbols[0].name = 0; // undef
symbols[0].info = 0;
symbols[0].shndx = 0;
@@ -128,7 +128,7 @@ struct MockElfEncoder : public NEO::Elf::ElfEncoder<numBits> {
symbols[0].value = 0;
symbols[1].name = elfEncoder.appendSectionName(NEO::ConstStringRef(".text"));
symbols[1].info = NEO::Elf::SYMBOL_TABLE_TYPE::STT_SECTION | NEO::Elf::SYMBOL_TABLE_BIND::STB_LOCAL << 4;
symbols[1].info = NEO::Elf::SymbolTableType::STT_SECTION | NEO::Elf::SymbolTableBind::STB_LOCAL << 4;
symbols[1].shndx = static_cast<decltype(symbols[1].shndx)>(textSectionIndex);
symbols[1].size = 0;
symbols[1].value = 0;

View File

@@ -15,7 +15,7 @@
namespace NEO {
namespace MockGmmParams {
static SurfaceFormatInfo mockSurfaceFormat = {GMM_FORMAT_R8G8B8A8_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT::GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_UNORM, 0, 4, 1, 4};
static SurfaceFormatInfo mockSurfaceFormat = {GMM_FORMAT_R8G8B8A8_UNORM_TYPE, SurfaceFormat::GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_UNORM, 0, 4, 1, 4};
}
class MockGmm : public Gmm {

View File

@@ -14,14 +14,14 @@
#include "shared/test/common/mocks/mock_elf.h"
namespace ZebinTestData {
using ELF_IDENTIFIER_CLASS = NEO::Elf::ELF_IDENTIFIER_CLASS;
using ElfIdentifierClass = NEO::Elf::ElfIdentifierClass;
template struct ValidEmptyProgram<ELF_IDENTIFIER_CLASS::EI_CLASS_32>;
template struct ValidEmptyProgram<ELF_IDENTIFIER_CLASS::EI_CLASS_64>;
template struct ValidEmptyProgram<ElfIdentifierClass::EI_CLASS_32>;
template struct ValidEmptyProgram<ElfIdentifierClass::EI_CLASS_64>;
template ValidEmptyProgram<ELF_IDENTIFIER_CLASS::EI_CLASS_32>::ValidEmptyProgram();
template ValidEmptyProgram<ELF_IDENTIFIER_CLASS::EI_CLASS_64>::ValidEmptyProgram();
template <ELF_IDENTIFIER_CLASS numBits>
template ValidEmptyProgram<ElfIdentifierClass::EI_CLASS_32>::ValidEmptyProgram();
template ValidEmptyProgram<ElfIdentifierClass::EI_CLASS_64>::ValidEmptyProgram();
template <ElfIdentifierClass numBits>
ValidEmptyProgram<numBits>::ValidEmptyProgram() {
NEO::Elf::ElfEncoder<numBits> enc;
enc.getElfFileHeader().type = NEO::Zebin::Elf::ET_ZEBIN_EXE;
@@ -33,14 +33,14 @@ ValidEmptyProgram<numBits>::ValidEmptyProgram() {
recalcPtr();
}
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
void ValidEmptyProgram<numBits>::recalcPtr() {
elfHeader = reinterpret_cast<NEO::Elf::ElfFileHeader<numBits> *>(storage.data());
}
template NEO::Elf::ElfSectionHeader<ELF_IDENTIFIER_CLASS::EI_CLASS_32> &ValidEmptyProgram<ELF_IDENTIFIER_CLASS::EI_CLASS_32>::appendSection(uint32_t sectionType, NEO::ConstStringRef sectionLabel, const ArrayRef<const uint8_t> sectionData);
template NEO::Elf::ElfSectionHeader<ELF_IDENTIFIER_CLASS::EI_CLASS_64> &ValidEmptyProgram<ELF_IDENTIFIER_CLASS::EI_CLASS_64>::appendSection(uint32_t sectionType, NEO::ConstStringRef sectionLabel, const ArrayRef<const uint8_t> sectionData);
template <ELF_IDENTIFIER_CLASS numBits>
template NEO::Elf::ElfSectionHeader<ElfIdentifierClass::EI_CLASS_32> &ValidEmptyProgram<ElfIdentifierClass::EI_CLASS_32>::appendSection(uint32_t sectionType, NEO::ConstStringRef sectionLabel, const ArrayRef<const uint8_t> sectionData);
template NEO::Elf::ElfSectionHeader<ElfIdentifierClass::EI_CLASS_64> &ValidEmptyProgram<ElfIdentifierClass::EI_CLASS_64>::appendSection(uint32_t sectionType, NEO::ConstStringRef sectionLabel, const ArrayRef<const uint8_t> sectionData);
template <ElfIdentifierClass numBits>
NEO::Elf::ElfSectionHeader<numBits> &ValidEmptyProgram<numBits>::appendSection(uint32_t sectionType, NEO::ConstStringRef sectionLabel, const ArrayRef<const uint8_t> sectionData) {
std::string err, warn;
auto decoded = NEO::Elf::decodeElf<numBits>(storage, err, warn);
@@ -78,9 +78,9 @@ NEO::Elf::ElfSectionHeader<numBits> &ValidEmptyProgram<numBits>::appendSection(u
UNREACHABLE();
}
template void ValidEmptyProgram<ELF_IDENTIFIER_CLASS::EI_CLASS_32>::removeSection(uint32_t sectionType, NEO::ConstStringRef sectionLabel);
template void ValidEmptyProgram<ELF_IDENTIFIER_CLASS::EI_CLASS_64>::removeSection(uint32_t sectionType, NEO::ConstStringRef sectionLabel);
template <ELF_IDENTIFIER_CLASS numBits>
template void ValidEmptyProgram<ElfIdentifierClass::EI_CLASS_32>::removeSection(uint32_t sectionType, NEO::ConstStringRef sectionLabel);
template void ValidEmptyProgram<ElfIdentifierClass::EI_CLASS_64>::removeSection(uint32_t sectionType, NEO::ConstStringRef sectionLabel);
template <ElfIdentifierClass numBits>
void ValidEmptyProgram<numBits>::removeSection(uint32_t sectionType, NEO::ConstStringRef sectionLabel) {
std::string err, warn;
auto decoded = NEO::Elf::decodeElf<numBits>(storage, err, warn);
@@ -132,13 +132,13 @@ ZebinWithExternalFunctionsInfo::ZebinWithExternalFunctionsInfo() {
NEO::Elf::ElfSymbolEntry<NEO::Elf::EI_CLASS_64> symbols[2];
symbols[0].name = decltype(symbols[0].name)(elfEncoder.appendSectionName(fun0Name));
symbols[0].info = NEO::Elf::SYMBOL_TABLE_TYPE::STT_FUNC | NEO::Elf::SYMBOL_TABLE_BIND::STB_GLOBAL << 4;
symbols[0].info = NEO::Elf::SymbolTableType::STT_FUNC | NEO::Elf::SymbolTableBind::STB_GLOBAL << 4;
symbols[0].shndx = decltype(symbols[0].shndx)(externalFunctionsIdx);
symbols[0].size = 16;
symbols[0].value = 0;
symbols[1].name = decltype(symbols[1].name)(elfEncoder.appendSectionName(fun1Name));
symbols[1].info = NEO::Elf::SYMBOL_TABLE_TYPE::STT_FUNC | NEO::Elf::SYMBOL_TABLE_BIND::STB_GLOBAL << 4;
symbols[1].info = NEO::Elf::SymbolTableType::STT_FUNC | NEO::Elf::SymbolTableBind::STB_GLOBAL << 4;
symbols[1].shndx = decltype(symbols[1].shndx)(externalFunctionsIdx);
symbols[1].size = 16;
symbols[1].value = 16;
@@ -147,7 +147,7 @@ ZebinWithExternalFunctionsInfo::ZebinWithExternalFunctionsInfo() {
NEO::Elf::ElfRel<NEO::Elf::EI_CLASS_64> extFuncSegReloc = {}; // fun0 calls fun1
extFuncSegReloc.offset = 0x8;
extFuncSegReloc.info = (uint64_t(1) << 32) | NEO::Zebin::Elf::RELOC_TYPE_ZEBIN::R_ZE_SYM_ADDR;
extFuncSegReloc.info = (uint64_t(1) << 32) | NEO::Zebin::Elf::RelocTypeZebin::R_ZE_SYM_ADDR;
auto &extFuncRelSection = elfEncoder.appendSection(NEO::Elf::SHT_REL, NEO::Elf::SpecialSectionNames::relPrefix.str() + NEO::Zebin::Elf::SectionNames::textPrefix.str() + NEO::Zebin::Elf::SectionNames::externalFunctions.str(),
{reinterpret_cast<uint8_t *>(&extFuncSegReloc), sizeof(extFuncSegReloc)});
extFuncRelSection.info = externalFunctionsIdx;
@@ -155,7 +155,7 @@ ZebinWithExternalFunctionsInfo::ZebinWithExternalFunctionsInfo() {
NEO::Elf::ElfRel<NEO::Elf::EI_CLASS_64>
kernelSegReloc = {}; // kernel calls fun0
kernelSegReloc.offset = 0x8;
kernelSegReloc.info = (uint64_t(0) << 32) | NEO::Zebin::Elf::RELOC_TYPE_ZEBIN::R_ZE_SYM_ADDR;
kernelSegReloc.info = (uint64_t(0) << 32) | NEO::Zebin::Elf::RelocTypeZebin::R_ZE_SYM_ADDR;
auto &kernelRelSection = elfEncoder.appendSection(NEO::Elf::SHT_REL, NEO::Elf::SpecialSectionNames::relPrefix.str() + NEO::Zebin::Elf::SectionNames::textPrefix.str() + "kernel",
{reinterpret_cast<uint8_t *>(&kernelSegReloc), sizeof(kernelSegReloc)});
kernelRelSection.info = kernelSectionIdx;
@@ -181,7 +181,7 @@ NEO::Elf::Elf<NEO::Elf::EI_CLASS_64> ZebinWithExternalFunctionsInfo::getElf() {
return elf;
}
ZebinWithL0TestCommonModule::ZebinWithL0TestCommonModule(const NEO::HardwareInfo &hwInfo, std::initializer_list<appendElfAdditionalSection> additionalSections, bool forceRecompilation) {
ZebinWithL0TestCommonModule::ZebinWithL0TestCommonModule(const NEO::HardwareInfo &hwInfo, std::initializer_list<AppendElfAdditionalSection> additionalSections, bool forceRecompilation) {
MockElfEncoder<> elfEncoder;
auto &elfHeader = elfEncoder.getElfFileHeader();
elfHeader.type = NEO::Zebin::Elf::ET_ZEBIN_EXE;
@@ -201,16 +201,16 @@ ZebinWithL0TestCommonModule::ZebinWithL0TestCommonModule(const NEO::HardwareInfo
const uint8_t testAdditionalSectionsData[0x10] = {0u};
for (const auto &s : additionalSections) {
switch (s) {
case appendElfAdditionalSection::spirv:
case AppendElfAdditionalSection::spirv:
elfEncoder.appendSection(NEO::Zebin::Elf::SHT_ZEBIN_SPIRV, NEO::Zebin::Elf::SectionNames::spv, testAdditionalSectionsData);
break;
case appendElfAdditionalSection::global:
case AppendElfAdditionalSection::global:
elfEncoder.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Zebin::Elf::SectionNames::dataGlobal, testAdditionalSectionsData);
break;
case appendElfAdditionalSection::constant:
case AppendElfAdditionalSection::constant:
elfEncoder.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Zebin::Elf::SectionNames::dataConst, testAdditionalSectionsData);
break;
case appendElfAdditionalSection::constantString:
case AppendElfAdditionalSection::constantString:
elfEncoder.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Zebin::Elf::SectionNames::dataConstString.str(), testAdditionalSectionsData);
break;
default:
@@ -225,10 +225,10 @@ void ZebinWithL0TestCommonModule::recalcPtr() {
elfHeader = reinterpret_cast<NEO::Elf::ElfFileHeader<NEO::Elf::EI_CLASS_64> *>(storage.data());
}
template ZebinCopyBufferSimdModule<ELF_IDENTIFIER_CLASS::EI_CLASS_32>::ZebinCopyBufferSimdModule(const NEO::HardwareInfo &hwInfo, uint8_t simdSize);
template ZebinCopyBufferSimdModule<ELF_IDENTIFIER_CLASS::EI_CLASS_64>::ZebinCopyBufferSimdModule(const NEO::HardwareInfo &hwInfo, uint8_t simdSize);
template ZebinCopyBufferSimdModule<ElfIdentifierClass::EI_CLASS_32>::ZebinCopyBufferSimdModule(const NEO::HardwareInfo &hwInfo, uint8_t simdSize);
template ZebinCopyBufferSimdModule<ElfIdentifierClass::EI_CLASS_64>::ZebinCopyBufferSimdModule(const NEO::HardwareInfo &hwInfo, uint8_t simdSize);
template <ELF_IDENTIFIER_CLASS numBits>
template <ElfIdentifierClass numBits>
ZebinCopyBufferSimdModule<numBits>::ZebinCopyBufferSimdModule(const NEO::HardwareInfo &hwInfo, uint8_t simdSize) {
zeInfoSize = static_cast<size_t>(snprintf(nullptr, 0, zeInfoCopyBufferSimdPlaceholder.c_str(), simdSize, simdSize, getLocalIdSize(hwInfo, simdSize)) + 1);
zeInfoCopyBuffer.resize(zeInfoSize);

View File

@@ -27,7 +27,7 @@ inline std::string versionToString(NEO::Zebin::ZeInfo::Types::Version version) {
namespace ZebinTestData {
enum class appendElfAdditionalSection {
enum class AppendElfAdditionalSection {
none,
spirv,
global,
@@ -35,7 +35,7 @@ enum class appendElfAdditionalSection {
constantString
};
template <NEO::Elf::ELF_IDENTIFIER_CLASS numBits = NEO::Elf::EI_CLASS_64>
template <NEO::Elf::ElfIdentifierClass numBits = NEO::Elf::EI_CLASS_64>
struct ValidEmptyProgram {
static constexpr char kernelName[19] = "valid_empty_kernel";
@@ -84,8 +84,8 @@ functions:
};
struct ZebinWithL0TestCommonModule {
ZebinWithL0TestCommonModule(const NEO::HardwareInfo &hwInfo) : ZebinWithL0TestCommonModule(hwInfo, std::initializer_list<appendElfAdditionalSection>{}) {}
ZebinWithL0TestCommonModule(const NEO::HardwareInfo &hwInfo, std::initializer_list<appendElfAdditionalSection> additionalSections, bool forceRecompilation = false);
ZebinWithL0TestCommonModule(const NEO::HardwareInfo &hwInfo) : ZebinWithL0TestCommonModule(hwInfo, std::initializer_list<AppendElfAdditionalSection>{}) {}
ZebinWithL0TestCommonModule(const NEO::HardwareInfo &hwInfo, std::initializer_list<AppendElfAdditionalSection> additionalSections, bool forceRecompilation = false);
void recalcPtr();
@@ -263,7 +263,7 @@ kernels:
-)===";
};
template <NEO::Elf::ELF_IDENTIFIER_CLASS numBits>
template <NEO::Elf::ElfIdentifierClass numBits>
struct ZebinCopyBufferSimdModule {
ZebinCopyBufferSimdModule(const NEO::HardwareInfo &hwInfo, uint8_t simdSize);
inline size_t getLocalIdSize(const NEO::HardwareInfo &hwInfo, uint8_t simdSize) {

View File

@@ -57,12 +57,12 @@ class DrmCommandStreamTest : public ::testing::Test {
PreemptionHelper::getDefaultPreemptionMode(*hwInfo)));
osContext->ensureContextInitialized();
csr = new MockDrmCsr<GfxFamily>(executionEnvironment, 0, 1, gemCloseWorkerMode::gemCloseWorkerActive);
csr = new MockDrmCsr<GfxFamily>(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerActive);
ASSERT_NE(nullptr, csr);
csr->setupContext(*osContext);
mock->ioctlCallsCount = 0u;
memoryManager = new DrmMemoryManager(gemCloseWorkerMode::gemCloseWorkerActive,
memoryManager = new DrmMemoryManager(GemCloseWorkerMode::gemCloseWorkerActive,
debugManager.flags.EnableForcePin.get(),
true,
executionEnvironment);
@@ -130,7 +130,7 @@ class DrmCommandStreamEnhancedTemplate : public ::testing::Test {
csr = new TestedDrmCommandStreamReceiver<GfxFamily>(*executionEnvironment, rootDeviceIndex, 1);
ASSERT_NE(nullptr, csr);
mm = new DrmMemoryManager(gemCloseWorkerMode::gemCloseWorkerInactive,
mm = new DrmMemoryManager(GemCloseWorkerMode::gemCloseWorkerInactive,
debugManager.flags.EnableForcePin.get(),
true,
*executionEnvironment);
@@ -211,7 +211,7 @@ class DrmCommandStreamEnhancedWithFailingExecTemplate : public ::testing::Test {
csr = new TestedDrmCommandStreamReceiverWithFailingExec<GfxFamily>(*executionEnvironment, rootDeviceIndex, 1);
ASSERT_NE(nullptr, csr);
mm = new DrmMemoryManager(gemCloseWorkerMode::gemCloseWorkerInactive,
mm = new DrmMemoryManager(GemCloseWorkerMode::gemCloseWorkerInactive,
debugManager.flags.EnableForcePin.get(),
true,
*executionEnvironment);

View File

@@ -67,10 +67,10 @@ TEST(AubHelper, WhenMaskPTEntryBitsIsCalledThenLocalMemoryBitIsMasked) {
TEST(AubHelper, WhenGetMemTypeIsCalledWithAGivenAddressSpaceThenCorrectMemTypeIsReturned) {
uint32_t addressSpace = AubHelper::getMemType(AubMemDump::AddressSpaceValues::TraceLocal);
EXPECT_EQ(mem_types::MEM_TYPE_LOCALMEM, addressSpace);
EXPECT_EQ(MemType::local, addressSpace);
addressSpace = AubHelper::getMemType(AubMemDump::AddressSpaceValues::TraceNonlocal);
EXPECT_EQ(mem_types::MEM_TYPE_SYSTEM, addressSpace);
EXPECT_EQ(MemType::system, addressSpace);
}
TEST(AubHelper, WhenHBMSizePerTileInGigabytesIsSetThenGetMemBankSizeReturnsCorrectValue) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -23,17 +23,17 @@ TEST(TbxStreamTests, givenTbxStreamWhenWriteMemoryIsCalledThenMemTypeIsSetCorrec
uint32_t addressSpace = AubMemDump::AddressSpaceValues::TraceLocal;
mockTbxStream->writeMemory(0, nullptr, 0, addressSpace, 0);
EXPECT_EQ(mem_types::MEM_TYPE_LOCALMEM, mockTbxSocket->typeCapturedFromWriteMemory);
EXPECT_EQ(MemType::local, mockTbxSocket->typeCapturedFromWriteMemory);
addressSpace = AubMemDump::AddressSpaceValues::TraceNonlocal;
mockTbxStream->writeMemory(0, nullptr, 0, addressSpace, 0);
EXPECT_EQ(mem_types::MEM_TYPE_SYSTEM, mockTbxSocket->typeCapturedFromWriteMemory);
EXPECT_EQ(MemType::system, mockTbxSocket->typeCapturedFromWriteMemory);
addressSpace = AubMemDump::AddressSpaceValues::TraceLocal;
mockTbxStream->writePTE(0, 0, addressSpace);
EXPECT_EQ(mem_types::MEM_TYPE_LOCALMEM, mockTbxSocket->typeCapturedFromWriteMemory);
EXPECT_EQ(MemType::local, mockTbxSocket->typeCapturedFromWriteMemory);
addressSpace = AubMemDump::AddressSpaceValues::TraceNonlocal;
mockTbxStream->writePTE(0, 0, addressSpace);
EXPECT_EQ(mem_types::MEM_TYPE_SYSTEM, mockTbxSocket->typeCapturedFromWriteMemory);
EXPECT_EQ(MemType::system, mockTbxSocket->typeCapturedFromWriteMemory);
}

View File

@@ -1826,7 +1826,7 @@ TEST_F(LinkerTests, GivenDebugDataWhenApplyingDebugDataRelocationsThenRelocation
NEO::Elf::Elf<NEO::Elf::EI_CLASS_64>::RelocationInfo reloc0 = {};
reloc0.offset = 64;
reloc0.relocType = static_cast<uint32_t>(Elf::RELOCATION_X8664_TYPE::relocation64);
reloc0.relocType = static_cast<uint32_t>(Elf::RelocationX8664Type::relocation64);
reloc0.symbolName = ".debug_abbrev";
reloc0.symbolSectionIndex = 3;
reloc0.symbolTableIndex = 0;
@@ -1837,7 +1837,7 @@ TEST_F(LinkerTests, GivenDebugDataWhenApplyingDebugDataRelocationsThenRelocation
NEO::Elf::Elf<NEO::Elf::EI_CLASS_64>::RelocationInfo reloc1 = {};
reloc1.offset = 32;
reloc1.relocType = static_cast<uint32_t>(Elf::RELOCATION_X8664_TYPE::relocation32);
reloc1.relocType = static_cast<uint32_t>(Elf::RelocationX8664Type::relocation32);
reloc1.symbolName = ".debug_line";
reloc1.symbolSectionIndex = 4;
reloc1.symbolTableIndex = 0;
@@ -1848,7 +1848,7 @@ TEST_F(LinkerTests, GivenDebugDataWhenApplyingDebugDataRelocationsThenRelocation
NEO::Elf::Elf<NEO::Elf::EI_CLASS_64>::RelocationInfo reloc2 = {};
reloc2.offset = 32;
reloc2.relocType = static_cast<uint32_t>(Elf::RELOCATION_X8664_TYPE::relocation64);
reloc2.relocType = static_cast<uint32_t>(Elf::RelocationX8664Type::relocation64);
reloc2.symbolName = ".text";
reloc2.symbolSectionIndex = 0;
reloc2.symbolTableIndex = 0;
@@ -1859,7 +1859,7 @@ TEST_F(LinkerTests, GivenDebugDataWhenApplyingDebugDataRelocationsThenRelocation
NEO::Elf::Elf<NEO::Elf::EI_CLASS_64>::RelocationInfo reloc3 = {};
reloc3.offset = 0;
reloc3.relocType = static_cast<uint32_t>(Elf::RELOCATION_X8664_TYPE::relocation64);
reloc3.relocType = static_cast<uint32_t>(Elf::RelocationX8664Type::relocation64);
reloc3.symbolName = ".data";
reloc3.symbolSectionIndex = 1;
reloc3.symbolTableIndex = 0;

View File

@@ -356,7 +356,7 @@ TEST(UnpackSingleDeviceBinaryZebin, WhenRequestedThenValidateRevision) {
TEST(UnpackSingleDeviceBinaryZebin, WhenMachineIsIntelGTAndIntelGTNoteSectionIsValidThenReturnSelf) {
ZebinTestData::ValidEmptyProgram zebin;
zebin.elfHeader->type = NEO::Elf::ET_REL;
zebin.elfHeader->machine = NEO::Elf::ELF_MACHINE::EM_INTELGT;
zebin.elfHeader->machine = NEO::Elf::ElfMachine::EM_INTELGT;
NEO::TargetDevice targetDevice;
targetDevice.maxPointerSizeInBytes = 8;

View File

@@ -410,8 +410,8 @@ kernels:
uint8_t kernelIsa[8]{0U};
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(validZeInfo.data(), validZeInfo.size()));
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(validZeInfo.data(), validZeInfo.size()));
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Zebin::Elf::SectionNames::textPrefix.str() + "kernel_bindless", {kernelIsa, sizeof(kernelIsa)});
zebin.elfHeader->machine = NEO::defaultHwInfo->platform.eProductFamily;

View File

@@ -18,7 +18,7 @@
using namespace NEO::Elf;
using ELF_CLASS = NEO::Elf::ELF_IDENTIFIER_CLASS;
using ELF_CLASS = NEO::Elf::ElfIdentifierClass;
class TestElf {
public:
@@ -29,19 +29,19 @@ class TestElf {
std::vector<uint8_t> createRelocateableElfWithDebugData() {
MockElfEncoder<> elfEncoder;
elfEncoder.getElfFileHeader().type = ELF_TYPE::ET_REL;
elfEncoder.getElfFileHeader().machine = ELF_MACHINE::EM_NONE;
elfEncoder.getElfFileHeader().type = ElfType::ET_REL;
elfEncoder.getElfFileHeader().machine = ElfMachine::EM_NONE;
elfEncoder.appendSection(SHT_PROGBITS, SpecialSectionNames::text.str(), ArrayRef<const uint8_t>(dummyData, sizeof(dummyData)));
auto textSectionIndex = elfEncoder.getLastSectionHeaderIndex();
ElfRela<ELF_CLASS::EI_CLASS_64> relocationsWithAddend[2];
relocationsWithAddend[0].addend = relaAddend;
relocationsWithAddend[0].info = relaSymbolIndexes[0] << 32 | uint32_t(RELOCATION_X8664_TYPE::relocation64);
relocationsWithAddend[0].info = relaSymbolIndexes[0] << 32 | uint32_t(RelocationX8664Type::relocation64);
relocationsWithAddend[0].offset = relaOffsets[0];
relocationsWithAddend[1].addend = relaAddend;
relocationsWithAddend[1].info = relaSymbolIndexes[1] << 32 | uint32_t(RELOCATION_X8664_TYPE::relocation32);
relocationsWithAddend[1].info = relaSymbolIndexes[1] << 32 | uint32_t(RelocationX8664Type::relocation32);
relocationsWithAddend[1].offset = relaOffsets[1];
elfEncoder.appendSection(SHT_PROGBITS, SpecialSectionNames::debug, ArrayRef<const uint8_t>(dummyData, sizeof(dummyData)));
@@ -55,10 +55,10 @@ class TestElf {
relaDebugSection->info = debugSectionIndex;
ElfRel<ELF_CLASS::EI_CLASS_64> relocations[2];
relocations[0].info = relSymbolIndex << 32 | uint64_t(RELOCATION_X8664_TYPE::relocation64);
relocations[0].info = relSymbolIndex << 32 | uint64_t(RelocationX8664Type::relocation64);
relocations[0].offset = relOffsets[0];
relocations[1].info = relSymbolIndex << 32 | uint64_t(RELOCATION_X8664_TYPE::relocation64);
relocations[1].info = relSymbolIndex << 32 | uint64_t(RelocationX8664Type::relocation64);
relocations[1].offset = relOffsets[1];
elfEncoder.appendSection(SHT_PROGBITS, SpecialSectionNames::line, std::string{"dummy_line_data______________________"});
@@ -91,21 +91,21 @@ class TestElf {
symbols[0].value = 0;
symbols[1].name = elfEncoder.appendSectionName(NEO::ConstStringRef("local_function_symbol_1"));
symbols[1].info = SYMBOL_TABLE_TYPE::STT_FUNC | SYMBOL_TABLE_BIND::STB_LOCAL << 4;
symbols[1].info = SymbolTableType::STT_FUNC | SymbolTableBind::STB_LOCAL << 4;
symbols[1].shndx = textSectionIndex;
symbols[1].size = 8;
symbols[1].value = 0;
symbols[1].other = 0;
symbols[2].name = elfEncoder.appendSectionName(NEO::ConstStringRef("section_symbol_2"));
symbols[2].info = SYMBOL_TABLE_TYPE::STT_SECTION | SYMBOL_TABLE_BIND::STB_LOCAL << 4;
symbols[2].info = SymbolTableType::STT_SECTION | SymbolTableBind::STB_LOCAL << 4;
symbols[2].shndx = textSectionIndex;
symbols[2].size = 0;
symbols[2].value = 0;
symbols[2].other = 0;
symbols[3].name = elfEncoder.appendSectionName(NEO::ConstStringRef("global_object_symbol_0"));
symbols[3].info = SYMBOL_TABLE_TYPE::STT_OBJECT | SYMBOL_TABLE_BIND::STB_GLOBAL << 4;
symbols[3].info = SymbolTableType::STT_OBJECT | SymbolTableBind::STB_GLOBAL << 4;
symbols[3].shndx = dataSectionIndex;
symbols[3].size = 4;
symbols[3].value = 7; // offset to "data" string in data section
@@ -474,7 +474,7 @@ TEST(ElfDecoder, WhenElfContainsInvalidSymbolSectionHeaderThenDecodingFailsAndEr
header.shNum = 1;
storage.insert(storage.end(), reinterpret_cast<const uint8_t *>(&header), reinterpret_cast<const uint8_t *>(&header + 1));
ElfSectionHeader<EI_CLASS_64> sectionHeader0;
sectionHeader0.type = SECTION_HEADER_TYPE::SHT_SYMTAB;
sectionHeader0.type = SectionHeaderType::SHT_SYMTAB;
sectionHeader0.size = sizeof(sectionHeader0);
sectionHeader0.offset = header.shOff;
sectionHeader0.entsize = sizeof(ElfSymbolEntry<EI_CLASS_64>) + 4; // invalid entSize
@@ -504,7 +504,7 @@ TEST(ElfDecoder, WhenElfContainsInvalidRelocationSectionHeaderThenDecodingFailsA
sectionHeader0.size = sizeof(sectionHeader0);
sectionHeader0.offset = header.shOff;
SECTION_HEADER_TYPE types[] = {SECTION_HEADER_TYPE::SHT_REL, SECTION_HEADER_TYPE::SHT_RELA};
SectionHeaderType types[] = {SectionHeaderType::SHT_REL, SectionHeaderType::SHT_RELA};
size_t entSizes[] = {sizeof(ElfRel<EI_CLASS_64>) + 4, sizeof(ElfRela<EI_CLASS_64>) + 4};
std::string errors[] = {"Invalid rel entries size - expected : ",
"Invalid rela entries size - expected : "};
@@ -536,19 +536,19 @@ TEST(ElfDecoder, GivenElf64WhenExtractingDataFromElfRelocationThenCorrectRelocTy
elf.elfFileHeader = &header64;
ElfRela<EI_CLASS_64> rela;
rela.info = decltype(ElfRela<EI_CLASS_64>::info)(RELOCATION_X8664_TYPE::relocation64) | decltype(ElfRela<EI_CLASS_64>::info)(5) << 32;
rela.info = decltype(ElfRela<EI_CLASS_64>::info)(RelocationX8664Type::relocation64) | decltype(ElfRela<EI_CLASS_64>::info)(5) << 32;
auto type = elf.extractRelocType(rela);
auto symbolIndex = elf.extractSymbolIndex(rela);
EXPECT_EQ(uint32_t(RELOCATION_X8664_TYPE::relocation64), type);
EXPECT_EQ(uint32_t(RelocationX8664Type::relocation64), type);
EXPECT_EQ(5, symbolIndex);
ElfRel<EI_CLASS_64> rel;
rel.info = decltype(ElfRela<EI_CLASS_64>::info)(RELOCATION_X8664_TYPE::relocation32) | decltype(ElfRela<EI_CLASS_64>::info)(6) << 32;
rel.info = decltype(ElfRela<EI_CLASS_64>::info)(RelocationX8664Type::relocation32) | decltype(ElfRela<EI_CLASS_64>::info)(6) << 32;
type = elf.extractRelocType(rel);
symbolIndex = elf.extractSymbolIndex(rel);
EXPECT_EQ(uint32_t(RELOCATION_X8664_TYPE::relocation32), type);
EXPECT_EQ(uint32_t(RelocationX8664Type::relocation32), type);
EXPECT_EQ(6, symbolIndex);
}
@@ -558,19 +558,19 @@ TEST(ElfDecoder, GivenElf32WhenExtractingDataFromElfRelocationThenCorrectRelocTy
elf.elfFileHeader = &header64;
ElfRela<EI_CLASS_32> rela;
rela.info = decltype(ElfRela<EI_CLASS_32>::info)(RELOCATION_X8664_TYPE::relocation32) | decltype(ElfRela<EI_CLASS_32>::info)(5) << 8;
rela.info = decltype(ElfRela<EI_CLASS_32>::info)(RelocationX8664Type::relocation32) | decltype(ElfRela<EI_CLASS_32>::info)(5) << 8;
auto type = elf.extractRelocType(rela);
auto symbolIndex = elf.extractSymbolIndex(rela);
EXPECT_EQ(uint32_t(RELOCATION_X8664_TYPE::relocation32), type);
EXPECT_EQ(uint32_t(RelocationX8664Type::relocation32), type);
EXPECT_EQ(5, symbolIndex);
ElfRel<EI_CLASS_32> rel;
rel.info = decltype(ElfRel<EI_CLASS_32>::info)(RELOCATION_X8664_TYPE::relocation32) | decltype(ElfRel<EI_CLASS_32>::info)(6) << 8;
rel.info = decltype(ElfRel<EI_CLASS_32>::info)(RelocationX8664Type::relocation32) | decltype(ElfRel<EI_CLASS_32>::info)(6) << 8;
type = elf.extractRelocType(rel);
symbolIndex = elf.extractSymbolIndex(rel);
EXPECT_EQ(uint32_t(RELOCATION_X8664_TYPE::relocation32), type);
EXPECT_EQ(uint32_t(RelocationX8664Type::relocation32), type);
EXPECT_EQ(6, symbolIndex);
}
@@ -580,12 +580,12 @@ TEST(ElfDecoder, GivenElfWhenExtractingDataFromElfSymbolThenCorrectTypeAndBindIs
elf.elfFileHeader = &header64;
ElfSymbolEntry<EI_CLASS_64> symbolEntry;
symbolEntry.info = SYMBOL_TABLE_TYPE::STT_OBJECT | SYMBOL_TABLE_BIND::STB_GLOBAL << 4;
symbolEntry.info = SymbolTableType::STT_OBJECT | SymbolTableBind::STB_GLOBAL << 4;
auto type = elf.extractSymbolType(symbolEntry);
auto symbolBind = elf.extractSymbolBind(symbolEntry);
EXPECT_EQ(SYMBOL_TABLE_TYPE::STT_OBJECT, type);
EXPECT_EQ(SYMBOL_TABLE_BIND::STB_GLOBAL, symbolBind);
EXPECT_EQ(SymbolTableType::STT_OBJECT, type);
EXPECT_EQ(SymbolTableBind::STB_GLOBAL, symbolBind);
}
TEST(ElfDecoder, GivenElfWithStringTableSectionWhenGettingSectionNameThenCorrectNameIsReturned) {
@@ -731,7 +731,7 @@ TEST(ElfDecoder, GivenElfWithStringTableSectionWhenGettingSymbolNameThenCorrectN
TEST(ElfDecoder, WhenGettingSymbolAddressThenCorectValueIsReturned) {
MockElf<EI_CLASS_64> elf;
ElfSymbolEntry<EI_CLASS_64> symbol;
symbol.info = SYMBOL_TABLE_TYPE::STT_OBJECT;
symbol.info = SymbolTableType::STT_OBJECT;
symbol.name = 0;
symbol.shndx = 1;
symbol.size = 8;
@@ -767,7 +767,7 @@ TEST(ElfDecoder, GivenElfWithRelocationsWhenDecodedThenCorrectRelocationsAndSymo
EXPECT_EQ(testElf.relaAddend, debugRelocations[0].addend);
EXPECT_EQ(testElf.relaOffsets[0], debugRelocations[0].offset);
EXPECT_EQ(uint32_t(RELOCATION_X8664_TYPE::relocation64), debugRelocations[0].relocType);
EXPECT_EQ(uint32_t(RelocationX8664Type::relocation64), debugRelocations[0].relocType);
EXPECT_STREQ("global_object_symbol_0", debugRelocations[0].symbolName.c_str());
EXPECT_EQ(7, debugRelocations[0].symbolSectionIndex);
EXPECT_EQ(3, debugRelocations[0].symbolTableIndex);
@@ -775,7 +775,7 @@ TEST(ElfDecoder, GivenElfWithRelocationsWhenDecodedThenCorrectRelocationsAndSymo
EXPECT_EQ(testElf.relaAddend, debugRelocations[1].addend);
EXPECT_EQ(testElf.relaOffsets[1], debugRelocations[1].offset);
EXPECT_EQ(uint32_t(RELOCATION_X8664_TYPE::relocation32), debugRelocations[1].relocType);
EXPECT_EQ(uint32_t(RelocationX8664Type::relocation32), debugRelocations[1].relocType);
EXPECT_STREQ("local_function_symbol_1", debugRelocations[1].symbolName.c_str());
EXPECT_EQ(1, debugRelocations[1].symbolSectionIndex);
EXPECT_EQ(1, debugRelocations[1].symbolTableIndex);
@@ -783,7 +783,7 @@ TEST(ElfDecoder, GivenElfWithRelocationsWhenDecodedThenCorrectRelocationsAndSymo
EXPECT_EQ(0u, debugRelocations[2].addend);
EXPECT_EQ(testElf.relOffsets[1], debugRelocations[2].offset);
EXPECT_EQ(uint32_t(RELOCATION_X8664_TYPE::relocation64), debugRelocations[2].relocType);
EXPECT_EQ(uint32_t(RelocationX8664Type::relocation64), debugRelocations[2].relocType);
EXPECT_STREQ("section_symbol_2", debugRelocations[2].symbolName.c_str());
EXPECT_EQ(1, debugRelocations[2].symbolSectionIndex);
EXPECT_EQ(2, debugRelocations[2].symbolTableIndex);
@@ -791,7 +791,7 @@ TEST(ElfDecoder, GivenElfWithRelocationsWhenDecodedThenCorrectRelocationsAndSymo
EXPECT_EQ(0u, relocations[0].addend);
EXPECT_EQ(testElf.relOffsets[0], relocations[0].offset);
EXPECT_EQ(uint32_t(RELOCATION_X8664_TYPE::relocation64), relocations[0].relocType);
EXPECT_EQ(uint32_t(RelocationX8664Type::relocation64), relocations[0].relocType);
EXPECT_STREQ("section_symbol_2", relocations[0].symbolName.c_str());
EXPECT_EQ(1, relocations[0].symbolSectionIndex);
EXPECT_EQ(2, relocations[0].symbolTableIndex);
@@ -800,15 +800,15 @@ TEST(ElfDecoder, GivenElfWithRelocationsWhenDecodedThenCorrectRelocationsAndSymo
auto symbolTable = elf64.getSymbols();
ASSERT_EQ(4u, symbolTable.size());
EXPECT_EQ(SYMBOL_TABLE_TYPE::STT_NOTYPE, elf64.extractSymbolType(symbolTable[0]));
EXPECT_EQ(SYMBOL_TABLE_BIND::STB_LOCAL, elf64.extractSymbolBind(symbolTable[0]));
EXPECT_EQ(SymbolTableType::STT_NOTYPE, elf64.extractSymbolType(symbolTable[0]));
EXPECT_EQ(SymbolTableBind::STB_LOCAL, elf64.extractSymbolBind(symbolTable[0]));
EXPECT_EQ(SYMBOL_TABLE_TYPE::STT_FUNC, elf64.extractSymbolType(symbolTable[1]));
EXPECT_EQ(SYMBOL_TABLE_BIND::STB_LOCAL, elf64.extractSymbolBind(symbolTable[1]));
EXPECT_EQ(SymbolTableType::STT_FUNC, elf64.extractSymbolType(symbolTable[1]));
EXPECT_EQ(SymbolTableBind::STB_LOCAL, elf64.extractSymbolBind(symbolTable[1]));
EXPECT_EQ(SYMBOL_TABLE_TYPE::STT_SECTION, elf64.extractSymbolType(symbolTable[2]));
EXPECT_EQ(SYMBOL_TABLE_BIND::STB_LOCAL, elf64.extractSymbolBind(symbolTable[2]));
EXPECT_EQ(SymbolTableType::STT_SECTION, elf64.extractSymbolType(symbolTable[2]));
EXPECT_EQ(SymbolTableBind::STB_LOCAL, elf64.extractSymbolBind(symbolTable[2]));
EXPECT_EQ(SYMBOL_TABLE_TYPE::STT_OBJECT, elf64.extractSymbolType(symbolTable[3]));
EXPECT_EQ(SYMBOL_TABLE_BIND::STB_GLOBAL, elf64.extractSymbolBind(symbolTable[3]));
EXPECT_EQ(SymbolTableType::STT_OBJECT, elf64.extractSymbolType(symbolTable[3]));
EXPECT_EQ(SymbolTableBind::STB_GLOBAL, elf64.extractSymbolBind(symbolTable[3]));
}

View File

@@ -41,42 +41,42 @@ TEST(DebugZebinTest, givenValidZebinThenDebugZebinIsGenerated) {
auto zeInfoSectionIndex = elfEncoder.getLastSectionHeaderIndex();
elfEncoder.appendSection(SHT_ZEBIN_SPIRV, SectionNames::spv, std::string{});
using SymbolEntry = ElfSymbolEntry<ELF_IDENTIFIER_CLASS::EI_CLASS_64>;
using Relocation = ElfRela<ELF_IDENTIFIER_CLASS::EI_CLASS_64>;
using SymbolEntry = ElfSymbolEntry<ElfIdentifierClass::EI_CLASS_64>;
using Relocation = ElfRela<ElfIdentifierClass::EI_CLASS_64>;
SymbolEntry symbols[7]{};
symbols[0].name = elfEncoder.appendSectionName("kernel");
symbols[0].info = SYMBOL_TABLE_TYPE::STT_SECTION | SYMBOL_TABLE_BIND::STB_LOCAL << 4;
symbols[0].info = SymbolTableType::STT_SECTION | SymbolTableBind::STB_LOCAL << 4;
symbols[0].shndx = static_cast<decltype(SymbolEntry::shndx)>(kernelSectionIndex);
symbols[0].value = 0U;
symbols[1].name = elfEncoder.appendSectionName("constData");
symbols[1].info = SYMBOL_TABLE_TYPE::STT_SECTION | SYMBOL_TABLE_BIND::STB_LOCAL << 4;
symbols[1].info = SymbolTableType::STT_SECTION | SymbolTableBind::STB_LOCAL << 4;
symbols[1].shndx = static_cast<decltype(SymbolEntry::shndx)>(constDataSectionIndex);
symbols[1].value = 0U;
symbols[2].name = elfEncoder.appendSectionName("varData");
symbols[2].info = SYMBOL_TABLE_TYPE::STT_SECTION | SYMBOL_TABLE_BIND::STB_LOCAL << 4;
symbols[2].info = SymbolTableType::STT_SECTION | SymbolTableBind::STB_LOCAL << 4;
symbols[2].shndx = static_cast<decltype(SymbolEntry::shndx)>(varDataSectionIndex);
symbols[2].value = 0U;
symbols[3].name = elfEncoder.appendSectionName("debugInfo");
symbols[3].info = SYMBOL_TABLE_TYPE::STT_SECTION | SYMBOL_TABLE_BIND::STB_LOCAL << 4;
symbols[3].info = SymbolTableType::STT_SECTION | SymbolTableBind::STB_LOCAL << 4;
symbols[3].shndx = static_cast<decltype(SymbolEntry::shndx)>(debugAbbrevSectionIndex);
symbols[3].value = 0x1U;
symbols[4].name = elfEncoder.appendSectionName("zeInfo");
symbols[4].info = SYMBOL_TABLE_TYPE::STT_SECTION | SYMBOL_TABLE_BIND::STB_LOCAL << 4;
symbols[4].info = SymbolTableType::STT_SECTION | SymbolTableBind::STB_LOCAL << 4;
symbols[4].shndx = static_cast<decltype(SymbolEntry::shndx)>(zeInfoSectionIndex);
symbols[4].value = 0U;
symbols[5].name = elfEncoder.appendSectionName(SectionNames::textPrefix.str() + "kernel");
symbols[5].info = SYMBOL_TABLE_TYPE::STT_SECTION | SYMBOL_TABLE_BIND::STB_LOCAL << 4;
symbols[5].info = SymbolTableType::STT_SECTION | SymbolTableBind::STB_LOCAL << 4;
symbols[5].shndx = static_cast<decltype(SymbolEntry::shndx)>(debugInfoSectionIndex);
symbols[5].value = 0U;
symbols[6].name = elfEncoder.appendSectionName("kernel_payload_offset");
symbols[6].info = SYMBOL_TABLE_TYPE::STT_SECTION | SYMBOL_TABLE_BIND::STB_LOCAL << 4;
symbols[6].info = SymbolTableType::STT_SECTION | SymbolTableBind::STB_LOCAL << 4;
symbols[6].shndx = static_cast<decltype(SymbolEntry::shndx)>(kernelSectionIndex);
symbols[6].value = 0x10U;
@@ -261,12 +261,12 @@ TEST(DebugZebinTest, givenSymTabShndxUndefinedThenDoNotApplyRelocations) {
elfEncoder.appendSection(SHT_PROGBITS, SectionNames::textPrefix.str() + "kernel", ArrayRef<const uint8_t>(kernelISA, sizeof(kernelISA)));
auto kernelSectionIndex = elfEncoder.getLastSectionHeaderIndex();
using SymbolEntry = ElfSymbolEntry<ELF_IDENTIFIER_CLASS::EI_CLASS_64>;
using Relocation = ElfRela<ELF_IDENTIFIER_CLASS::EI_CLASS_64>;
using SymbolEntry = ElfSymbolEntry<ElfIdentifierClass::EI_CLASS_64>;
using Relocation = ElfRela<ElfIdentifierClass::EI_CLASS_64>;
SymbolEntry symbol{};
symbol.name = elfEncoder.appendSectionName("kernel");
symbol.info = SYMBOL_TABLE_TYPE::STT_SECTION | SYMBOL_TABLE_BIND::STB_LOCAL << 4;
symbol.info = SymbolTableType::STT_SECTION | SymbolTableBind::STB_LOCAL << 4;
symbol.shndx = static_cast<decltype(SymbolEntry::shndx)>(kernelSectionIndex);
symbol.value = 0xAU;

View File

@@ -405,7 +405,7 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoSectionIsEmptyThenEmitsWarning) {
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
NEO::ProgramInfo programInfo;
NEO::SingleDeviceBinary singleBinary;
@@ -3007,9 +3007,9 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenYamlParserForZeInfoFailsThenDecodingFail
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
auto brokenZeInfo = NEO::ConstStringRef("unterminated_string : \"");
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(brokenZeInfo.data(), brokenZeInfo.size()));
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(brokenZeInfo.data(), brokenZeInfo.size()));
NEO::ProgramInfo programInfo;
NEO::SingleDeviceBinary singleBinary;
@@ -3033,9 +3033,9 @@ TEST(DecodeSingleDeviceBinaryZebin, GivenEmptyInZeInfoThenEmitsWarning) {
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
auto brokenZeInfo = NEO::ConstStringRef("#no data\n");
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(brokenZeInfo.data(), brokenZeInfo.size()));
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(brokenZeInfo.data(), brokenZeInfo.size()));
NEO::ProgramInfo programInfo;
NEO::SingleDeviceBinary singleBinary;
@@ -3052,9 +3052,9 @@ TEST(DecodeSingleDeviceBinaryZebin, GivenUnknownEntryInZeInfoGlobalScopeThenEmit
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
auto brokenZeInfo = std::string("some_entry : a\nkernels : \n - name : valid_empty_kernel\n execution_env : \n simd_size : 32\n grf_count : 128\nversion:\'") + versionToString(NEO::Zebin::ZeInfo::zeInfoDecoderVersion) + "\'\n";
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(brokenZeInfo.data(), brokenZeInfo.size()));
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(brokenZeInfo.data(), brokenZeInfo.size()));
NEO::ProgramInfo programInfo;
NEO::SingleDeviceBinary singleBinary;
@@ -3071,9 +3071,9 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoDoesNotContainKernelsSectionThenEm
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
auto brokenZeInfo = std::string("version:\'") + versionToString(Zebin::ZeInfo::zeInfoDecoderVersion) + "\'\na:b\n";
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(brokenZeInfo.data(), brokenZeInfo.size()));
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(brokenZeInfo.data(), brokenZeInfo.size()));
NEO::ProgramInfo programInfo;
NEO::SingleDeviceBinary singleBinary;
@@ -3090,9 +3090,9 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoContainsMultipleKernelSectionsThen
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
auto brokenZeInfo = std::string("version:\'") + versionToString(Zebin::ZeInfo::zeInfoDecoderVersion) + "\'\nkernels : \n - name : valid_empty_kernel\n execution_env : \n simd_size : 32\n grf_count : 128\n" + "\nkernels : \n - name : valid_empty_kernel\n execution_env : \n simd_size : 32\n grf_count : 128\n...\n";
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(brokenZeInfo.data(), brokenZeInfo.size()));
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(brokenZeInfo.data(), brokenZeInfo.size()));
NEO::ProgramInfo programInfo;
NEO::SingleDeviceBinary singleBinary;
@@ -3109,9 +3109,9 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoContainsMultipleVersionSectionsThe
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
auto brokenZeInfo = std::string("version:\'") + versionToString(Zebin::ZeInfo::zeInfoDecoderVersion) + "\'\nversion:\'5.4\'\nkernels:\n";
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(brokenZeInfo.data(), brokenZeInfo.size()));
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(brokenZeInfo.data(), brokenZeInfo.size()));
NEO::ProgramInfo programInfo;
NEO::SingleDeviceBinary singleBinary;
@@ -3128,9 +3128,9 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoDoesNotContainVersionSectionsThenE
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
auto zeInfo = ConstStringRef("kernels:\n");
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeInfo.data(), zeInfo.size()));
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeInfo.data(), zeInfo.size()));
auto version = NEO::Zebin::ZeInfo::zeInfoDecoderVersion;
auto expectedWarning = "DeviceBinaryFormat::zebin::.ze_info : No version info provided (i.e. no version entry in global scope of DeviceBinaryFormat::zebin::.ze_info) - will use decoder's default : '" +
@@ -3151,9 +3151,9 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoVersionIsInvalidThenFails) {
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
auto zeInfo = ConstStringRef("version:\'1a\'\nkernels:\n");
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeInfo.data(), zeInfo.size()));
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeInfo.data(), zeInfo.size()));
NEO::ProgramInfo programInfo;
NEO::SingleDeviceBinary singleBinary;
@@ -3170,12 +3170,12 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoMinorVersionIsNewerThenEmitsWarnin
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
auto version = NEO::Zebin::ZeInfo::zeInfoDecoderVersion;
std::string expectedWarning = "DeviceBinaryFormat::zebin::.ze_info : Minor version : " + std::to_string(version.minor + 1) + " is newer than available in decoder : " + std::to_string(version.minor) + " - some features may be skipped\n";
version.minor += 1;
auto zeInfo = std::string("version:\'") + versionToString(version) + "\'\nkernels:\n";
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeInfo.data(), zeInfo.size()));
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeInfo.data(), zeInfo.size()));
NEO::ProgramInfo programInfo;
NEO::SingleDeviceBinary singleBinary;
@@ -3193,11 +3193,11 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoMajorVersionIsMismatchedThenFails)
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
{
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
auto version = NEO::Zebin::ZeInfo::zeInfoDecoderVersion;
version.major += 1;
auto zeInfo = std::string("version:\'") + versionToString(version) + "\'\nkernels:\n";
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeInfo.data(), zeInfo.size()));
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeInfo.data(), zeInfo.size()));
NEO::ProgramInfo programInfo;
NEO::SingleDeviceBinary singleBinary;
@@ -3212,11 +3212,11 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoMajorVersionIsMismatchedThenFails)
{
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
auto version = NEO::Zebin::ZeInfo::zeInfoDecoderVersion;
version.major -= 1;
auto zeInfo = std::string("version:\'") + versionToString(version) + "\'\nkernels:\n";
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeInfo.data(), zeInfo.size()));
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeInfo.data(), zeInfo.size()));
NEO::ProgramInfo programInfo;
NEO::SingleDeviceBinary singleBinary;
@@ -3238,9 +3238,9 @@ kernels:
-
)===";
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(brokenZeInfo.data(), brokenZeInfo.size()));
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(brokenZeInfo.data(), brokenZeInfo.size()));
NEO::ProgramInfo programInfo;
NEO::SingleDeviceBinary singleBinary;
@@ -3268,8 +3268,8 @@ kernels:
uint8_t kernelIsa[8]{0U};
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeinfo.data(), zeinfo.size()));
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeinfo.data(), zeinfo.size()));
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Zebin::Elf::SectionNames::textPrefix.str() + "some_kernel", {kernelIsa, sizeof(kernelIsa)});
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Zebin::Elf::SectionNames::textPrefix.str() + "some_other_kernel", {kernelIsa, sizeof(kernelIsa)});
@@ -3312,8 +3312,8 @@ functions:
uint8_t kernelIsa[8]{0U};
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeinfo.data(), zeinfo.size()));
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeinfo.data(), zeinfo.size()));
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Zebin::Elf::SectionNames::textPrefix.str() + "some_kernel", {kernelIsa, sizeof(kernelIsa)});
NEO::ProgramInfo programInfo;
@@ -3351,8 +3351,8 @@ functions:
)===";
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(validZeInfo.data(), validZeInfo.size()));
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(validZeInfo.data(), validZeInfo.size()));
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Zebin::Elf::SectionNames::textPrefix.str() + "some_kernel", {});
NEO::ProgramInfo programInfo;
@@ -3388,8 +3388,8 @@ functions:
)===";
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(validZeInfo.data(), validZeInfo.size()));
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(validZeInfo.data(), validZeInfo.size()));
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Zebin::Elf::SectionNames::textPrefix.str() + "some_kernel", {});
NEO::ProgramInfo programInfo;
@@ -3428,8 +3428,8 @@ kernels_misc_info:
)===";
uint8_t kernelIsa[8]{0U};
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeinfo.data(), zeinfo.size()));
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeinfo.data(), zeinfo.size()));
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Zebin::Elf::SectionNames::textPrefix.str() + "some_kernel", {kernelIsa, sizeof(kernelIsa)});
NEO::ProgramInfo programInfo;
@@ -4091,8 +4091,8 @@ kernels:
NEO::ProgramInfo programInfo;
std::string errors, warnings;
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeinfo.data(), zeinfo.size()));
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeinfo.data(), zeinfo.size()));
auto elf = NEO::Elf::decodeElf(zebin.storage, errors, warnings);
ASSERT_NE(nullptr, elf.elfFileHeader) << errors << " " << warnings;
@@ -5523,7 +5523,7 @@ class IntelGTNotesFixture : public ::testing::Test {
protected:
void SetUp() override {
zebin.elfHeader->type = NEO::Elf::ET_REL;
zebin.elfHeader->machine = NEO::Elf::ELF_MACHINE::EM_INTELGT;
zebin.elfHeader->machine = NEO::Elf::ElfMachine::EM_INTELGT;
}
void appendSingleIntelGTSectionData(const NEO::Elf::ElfNoteSection &elfNoteSection, uint8_t *const intelGTSectionData, const uint8_t *descData, const char *ownerName, size_t spaceAvailable, size_t &offset) {
@@ -5882,7 +5882,7 @@ TEST(ValidateTargetDevice32BitZebin, Given32BitZebinAndValidIntelGTNotesWhenVali
ZebinTestData::ValidEmptyProgram<NEO::Elf::EI_CLASS_32> zebin;
zebin.elfHeader->type = NEO::Elf::ET_REL;
zebin.elfHeader->machine = NEO::Elf::ELF_MACHINE::EM_INTELGT;
zebin.elfHeader->machine = NEO::Elf::ElfMachine::EM_INTELGT;
Zebin::Elf::ZebinTargetFlags targetMetadata;
targetMetadata.validateRevisionId = true;
@@ -5911,7 +5911,7 @@ TEST(ValidateTargetDeviceGeneratorZebin, GivenZebinAndValidIntelGTNotesWithGener
ZebinTestData::ValidEmptyProgram<NEO::Elf::EI_CLASS_32> zebin;
zebin.elfHeader->type = NEO::Elf::ET_REL;
zebin.elfHeader->machine = NEO::Elf::ELF_MACHINE::EM_INTELGT;
zebin.elfHeader->machine = NEO::Elf::ElfMachine::EM_INTELGT;
Zebin::Elf::ZebinTargetFlags targetMetadata;
targetMetadata.validateRevisionId = true;
@@ -6261,8 +6261,8 @@ TEST(PopulateGlobalDeviceHostNameMapping, givenValidZebinWithGlobalHostAccessTab
uint8_t kernelIsa[8]{0U};
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeinfo.data(), zeinfo.size()));
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeinfo.data(), zeinfo.size()));
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Zebin::Elf::SectionNames::textPrefix.str() + "some_kernel", {kernelIsa, sizeof(kernelIsa)});
NEO::ProgramInfo programInfo;
@@ -6303,8 +6303,8 @@ TEST(PopulateGlobalDeviceHostNameMapping, givenZebinWithGlobalHostAccessTableSec
)==="};
for (auto &zeInfo : invalidZeInfos) {
ZebinTestData::ValidEmptyProgram zebin;
zebin.removeSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeInfo.data(), zeInfo.size()));
zebin.removeSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo);
zebin.appendSection(NEO::Zebin::Elf::SectionHeaderTypeZebin::SHT_ZEBIN_ZEINFO, NEO::Zebin::Elf::SectionNames::zeInfo, ArrayRef<const uint8_t>::fromAny(zeInfo.data(), zeInfo.size()));
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Zebin::Elf::SectionNames::textPrefix.str() + "some_kernel", {});
NEO::ProgramInfo programInfo;

View File

@@ -44,7 +44,7 @@ struct DrmDirectSubmissionTest : public DrmMemoryManagerBasic {
DrmMemoryManagerBasic::SetUp();
executionEnvironment.incRefInternal();
executionEnvironment.memoryManager = std::make_unique<DrmMemoryManager>(gemCloseWorkerMode::gemCloseWorkerInactive,
executionEnvironment.memoryManager = std::make_unique<DrmMemoryManager>(GemCloseWorkerMode::gemCloseWorkerInactive,
debugManager.flags.EnableForcePin.get(),
true,
executionEnvironment);

View File

@@ -29,7 +29,7 @@ HWTEST_F(ImageSurfaceStateTests, givenImageInfoWhenSetImageSurfaceStateThenPrope
imageInfo.imgDesc.numSamples = 9u;
imageInfo.imgDesc.imageType = ImageType::image2DArray;
SurfaceFormatInfo surfaceFormatInfo;
surfaceFormatInfo.genxSurfaceFormat = GFX3DSTATE_SURFACEFORMAT::GFX3DSTATE_SURFACEFORMAT_A32_FLOAT;
surfaceFormatInfo.genxSurfaceFormat = SurfaceFormat::GFX3DSTATE_SURFACEFORMAT_A32_FLOAT;
imageInfo.surfaceFormat = &surfaceFormatInfo;
SurfaceOffsets surfaceOffsets;
surfaceOffsets.offset = 0u;
@@ -126,7 +126,7 @@ HWTEST_F(ImageSurfaceStateTests, givenImage2DWhen2dImageWAIsEnabledThenArrayFlag
SurfaceOffsets surfaceOffsets = {0, 0, 0, 0};
const uint32_t cubeFaceIndex = __GMM_NO_CUBE_MAP;
SurfaceFormatInfo surfaceFormatInfo;
surfaceFormatInfo.genxSurfaceFormat = GFX3DSTATE_SURFACEFORMAT::GFX3DSTATE_SURFACEFORMAT_A32_FLOAT;
surfaceFormatInfo.genxSurfaceFormat = SurfaceFormat::GFX3DSTATE_SURFACEFORMAT_A32_FLOAT;
imageInfo.surfaceFormat = &surfaceFormatInfo;
const uint64_t gpuAddress = 0x000001a78a8a8000;
@@ -150,7 +150,7 @@ HWTEST_F(ImageSurfaceStateTests, givenImage2DWhen2dImageWAIsDisabledThenArrayFla
SurfaceOffsets surfaceOffsets = {0, 0, 0, 0};
const uint32_t cubeFaceIndex = __GMM_NO_CUBE_MAP;
SurfaceFormatInfo surfaceFormatInfo;
surfaceFormatInfo.genxSurfaceFormat = GFX3DSTATE_SURFACEFORMAT::GFX3DSTATE_SURFACEFORMAT_A32_FLOAT;
surfaceFormatInfo.genxSurfaceFormat = SurfaceFormat::GFX3DSTATE_SURFACEFORMAT_A32_FLOAT;
imageInfo.surfaceFormat = &surfaceFormatInfo;
const uint64_t gpuAddress = 0x000001a78a8a8000;
@@ -174,7 +174,7 @@ HWTEST_F(ImageSurfaceStateTests, givenImage2DArrayOfSize1When2dImageWAIsEnabledT
SurfaceOffsets surfaceOffsets = {0, 0, 0, 0};
const uint32_t cubeFaceIndex = __GMM_NO_CUBE_MAP;
SurfaceFormatInfo surfaceFormatInfo;
surfaceFormatInfo.genxSurfaceFormat = GFX3DSTATE_SURFACEFORMAT::GFX3DSTATE_SURFACEFORMAT_A32_FLOAT;
surfaceFormatInfo.genxSurfaceFormat = SurfaceFormat::GFX3DSTATE_SURFACEFORMAT_A32_FLOAT;
imageInfo.surfaceFormat = &surfaceFormatInfo;
const uint64_t gpuAddress = 0x000001a78a8a8000;
@@ -198,7 +198,7 @@ HWTEST_F(ImageSurfaceStateTests, givenImage2DArrayOfSize1When2dImageWAIsDisabled
SurfaceOffsets surfaceOffsets = {0, 0, 0, 0};
const uint32_t cubeFaceIndex = __GMM_NO_CUBE_MAP;
SurfaceFormatInfo surfaceFormatInfo;
surfaceFormatInfo.genxSurfaceFormat = GFX3DSTATE_SURFACEFORMAT::GFX3DSTATE_SURFACEFORMAT_A32_FLOAT;
surfaceFormatInfo.genxSurfaceFormat = SurfaceFormat::GFX3DSTATE_SURFACEFORMAT_A32_FLOAT;
imageInfo.surfaceFormat = &surfaceFormatInfo;
const uint64_t gpuAddress = 0x000001a78a8a8000;
@@ -222,7 +222,7 @@ HWTEST_F(ImageSurfaceStateTests, givenImage1DWhen2dImageWAIsEnabledThenArrayFlag
SurfaceOffsets surfaceOffsets = {0, 0, 0, 0};
const uint32_t cubeFaceIndex = __GMM_NO_CUBE_MAP;
SurfaceFormatInfo surfaceFormatInfo;
surfaceFormatInfo.genxSurfaceFormat = GFX3DSTATE_SURFACEFORMAT::GFX3DSTATE_SURFACEFORMAT_A32_FLOAT;
surfaceFormatInfo.genxSurfaceFormat = SurfaceFormat::GFX3DSTATE_SURFACEFORMAT_A32_FLOAT;
imageInfo.surfaceFormat = &surfaceFormatInfo;
const uint64_t gpuAddress = 0x000001a78a8a8000;

View File

@@ -50,13 +50,13 @@ HWTEST_F(DeviceCommandStreamLeaksTest, WhenCreatingDeviceCsrThenValidPointerIsRe
HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultDrmCsrWhenItIsCreatedThenGemCloseWorkerInactiveModeIsSelected) {
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(false, *executionEnvironment, 0, 1));
auto drmCsr = (DrmCommandStreamReceiver<FamilyType> *)ptr.get();
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), gemCloseWorkerMode::gemCloseWorkerActive);
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerActive);
}
HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultDrmCsrWithAubDumWhenItIsCreatedThenGemCloseWorkerInactiveModeIsSelected) {
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(true, *executionEnvironment, 0, 1));
auto drmCsrWithAubDump = (CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<FamilyType>> *)ptr.get();
EXPECT_EQ(drmCsrWithAubDump->peekGemCloseWorkerOperationMode(), gemCloseWorkerMode::gemCloseWorkerActive);
EXPECT_EQ(drmCsrWithAubDump->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerActive);
auto aubCSR = static_cast<CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<FamilyType>> *>(ptr.get())->aubCSR.get();
EXPECT_NE(nullptr, aubCSR);
}
@@ -77,7 +77,7 @@ HWTEST_F(DeviceCommandStreamLeaksTest, givenDisabledGemCloseWorkerWhenCsrIsCreat
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(false, *executionEnvironment, 0, 1));
auto drmCsr = (DrmCommandStreamReceiver<FamilyType> *)ptr.get();
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), gemCloseWorkerMode::gemCloseWorkerInactive);
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerInactive);
}
HWTEST_F(DeviceCommandStreamLeaksTest, givenEnabledGemCloseWorkerWhenCsrIsCreatedThenGemCloseWorkerActiveModeIsSelected) {
@@ -87,14 +87,14 @@ HWTEST_F(DeviceCommandStreamLeaksTest, givenEnabledGemCloseWorkerWhenCsrIsCreate
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(false, *executionEnvironment, 0, 1));
auto drmCsr = (DrmCommandStreamReceiver<FamilyType> *)ptr.get();
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), gemCloseWorkerMode::gemCloseWorkerActive);
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerActive);
}
HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultGemCloseWorkerWhenCsrIsCreatedThenGemCloseWorkerActiveModeIsSelected) {
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(false, *executionEnvironment, 0, 1));
auto drmCsr = (DrmCommandStreamReceiver<FamilyType> *)ptr.get();
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), gemCloseWorkerMode::gemCloseWorkerActive);
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerActive);
}
using DeviceCommandStreamSetInternalUsageTests = DeviceCommandStreamLeaksTest;
@@ -102,8 +102,8 @@ using DeviceCommandStreamSetInternalUsageTests = DeviceCommandStreamLeaksTest;
HWTEST_F(DeviceCommandStreamSetInternalUsageTests, givenValidDrmCsrThenGemCloseWorkerOperationModeIsSetToInactiveWhenInternalUsageIsSet) {
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(false, *executionEnvironment, 0, 1));
auto drmCsr = (DrmCommandStreamReceiver<FamilyType> *)ptr.get();
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), gemCloseWorkerMode::gemCloseWorkerActive);
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerActive);
drmCsr->initializeDefaultsForInternalEngine();
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), gemCloseWorkerMode::gemCloseWorkerInactive);
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerInactive);
}

View File

@@ -49,7 +49,7 @@ HWTEST_F(DrmCommandStreamMMTest, GivenForcePinThenMemoryManagerCreatesPinBb) {
executionEnvironment.rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, 0u, false);
executionEnvironment.rootDeviceEnvironments[0]->initGmm();
DrmCommandStreamReceiver<FamilyType> csr(executionEnvironment, 0, 1, gemCloseWorkerMode::gemCloseWorkerInactive);
DrmCommandStreamReceiver<FamilyType> csr(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
auto memoryManager = new TestedDrmMemoryManager(false, true, false, executionEnvironment);
executionEnvironment.memoryManager.reset(memoryManager);
@@ -69,7 +69,7 @@ HWTEST_F(DrmCommandStreamMMTest, givenForcePinDisabledWhenMemoryManagerIsCreated
executionEnvironment.rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
executionEnvironment.rootDeviceEnvironments[0]->initGmm();
DrmCommandStreamReceiver<FamilyType> csr(executionEnvironment, 0, 1, gemCloseWorkerMode::gemCloseWorkerInactive);
DrmCommandStreamReceiver<FamilyType> csr(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
auto memoryManager = new TestedDrmMemoryManager(false, true, false, executionEnvironment);
executionEnvironment.memoryManager.reset(memoryManager);

View File

@@ -26,7 +26,7 @@ using namespace NEO;
HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenL0ApiConfigWhenCreatingDrmCsrThenEnableImmediateDispatch) {
VariableBackup<ApiSpecificConfig::ApiType> backup(&apiTypeForUlts, ApiSpecificConfig::L0);
MockDrmCsr<FamilyType> csr(executionEnvironment, 0, 1, gemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr<FamilyType> csr(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
EXPECT_EQ(DispatchMode::immediateDispatch, csr.dispatchMode);
}
@@ -42,7 +42,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenEnabledDirectSubmissionWhenGetting
debugManager.flags.EnableDrmCompletionFence.set(1);
debugManager.flags.EnableDirectSubmission.set(1);
debugManager.flags.DirectSubmissionDisableMonitorFence.set(0);
MockDrmCsr<FamilyType> csr(executionEnvironment, 0, 1, gemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr<FamilyType> csr(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
csr.setupContext(*osContext);
EXPECT_EQ(nullptr, csr.completionFenceValuePointer);
@@ -102,7 +102,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenExecBufferErrorWhenFlushInternalTh
}
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenDefaultDrmCSRWhenItIsCreatedThenGemCloseWorkerModeIsInactive) {
EXPECT_EQ(gemCloseWorkerMode::gemCloseWorkerInactive, static_cast<const DrmCommandStreamReceiver<FamilyType> *>(csr)->peekGemCloseWorkerOperationMode());
EXPECT_EQ(GemCloseWorkerMode::gemCloseWorkerInactive, static_cast<const DrmCommandStreamReceiver<FamilyType> *>(csr)->peekGemCloseWorkerOperationMode());
}
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenCommandStreamWhenItIsFlushedWithGemCloseWorkerInDefaultModeThenWorkerDecreasesTheRefCount) {
@@ -264,10 +264,10 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenDebugFlagSetWhenFlushingTh
}
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenDrmCsrCreatedWithInactiveGemCloseWorkerPolicyThenThreadIsNotCreated) {
TestedDrmCommandStreamReceiver<FamilyType> testedCsr(gemCloseWorkerMode::gemCloseWorkerInactive,
TestedDrmCommandStreamReceiver<FamilyType> testedCsr(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
EXPECT_EQ(gemCloseWorkerMode::gemCloseWorkerInactive, testedCsr.peekGemCloseWorkerOperationMode());
EXPECT_EQ(GemCloseWorkerMode::gemCloseWorkerInactive, testedCsr.peekGemCloseWorkerOperationMode());
}
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenDrmAllocationWhenGetBufferObjectToModifyIsCalledForAGivenHandleIdThenTheCorrespondingBufferObjectGetsModified) {
@@ -968,7 +968,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(gemCloseWorkerMode::gemCloseWorkerInactive,
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
EXPECT_TRUE(testedCsr->useUserFenceWait);
@@ -999,7 +999,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(gemCloseWorkerMode::gemCloseWorkerInactive,
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
EXPECT_FALSE(testedCsr->useUserFenceWait);
@@ -1033,7 +1033,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = false;
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(gemCloseWorkerMode::gemCloseWorkerInactive,
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
EXPECT_TRUE(testedCsr->useUserFenceWait);
@@ -1063,7 +1063,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenWaitUserFenceFlagNotSetWhe
debugManager.flags.EnableUserFenceForCompletionWait.set(0);
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(gemCloseWorkerMode::gemCloseWorkerInactive,
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
EXPECT_FALSE(testedCsr->useUserFenceWait);
@@ -1086,7 +1086,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenGemWaitUsedWhenKmdTimeoutU
debugManager.flags.EnableUserFenceForCompletionWait.set(0);
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(gemCloseWorkerMode::gemCloseWorkerInactive,
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
EXPECT_FALSE(testedCsr->useUserFenceWait);
@@ -1113,7 +1113,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(gemCloseWorkerMode::gemCloseWorkerInactive,
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
EXPECT_TRUE(testedCsr->useUserFenceWait);
@@ -1154,7 +1154,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = false;
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(gemCloseWorkerMode::gemCloseWorkerInactive,
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
EXPECT_TRUE(testedCsr->useUserFenceWait);
@@ -1183,7 +1183,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(gemCloseWorkerMode::gemCloseWorkerInactive,
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
EXPECT_FALSE(testedCsr->useUserFenceWait);
@@ -1214,7 +1214,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(gemCloseWorkerMode::gemCloseWorkerInactive,
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
EXPECT_TRUE(testedCsr->useUserFenceWait);
@@ -1245,7 +1245,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
std::unique_ptr<TestedDrmCommandStreamReceiver<FamilyType>> testedCsr =
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(gemCloseWorkerMode::gemCloseWorkerInactive,
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
@@ -1262,7 +1262,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
std::unique_ptr<TestedDrmCommandStreamReceiver<FamilyType>> testedCsr =
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(gemCloseWorkerMode::gemCloseWorkerInactive,
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
@@ -1279,7 +1279,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
std::unique_ptr<TestedDrmCommandStreamReceiver<FamilyType>> testedCsr =
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(gemCloseWorkerMode::gemCloseWorkerInactive,
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
@@ -1297,7 +1297,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
std::unique_ptr<TestedDrmCommandStreamReceiver<FamilyType>> testedCsr =
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(gemCloseWorkerMode::gemCloseWorkerInactive,
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
@@ -1315,7 +1315,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
std::unique_ptr<TestedDrmCommandStreamReceiver<FamilyType>> testedCsr =
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(gemCloseWorkerMode::gemCloseWorkerInactive,
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
@@ -1390,7 +1390,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenMergeWithResidencyContaine
EncodeNoop<FamilyType>::alignToCacheLine(cs);
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1, gemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
mockCsr.setupContext(*osContext.get());
auto res = mockCsr.flush(batchBuffer, mockCsr.getResidencyAllocations());
EXPECT_GT(operationHandler->mergeWithResidencyContainerCalled, 0u);
@@ -1421,7 +1421,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenMergeWithResidencyContaine
EncodeNoop<FamilyType>::alignToCacheLine(cs);
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1, gemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
mockCsr.setupContext(*osContext.get());
auto res = mockCsr.flush(batchBuffer, mockCsr.getResidencyAllocations());
EXPECT_GT(operationHandler->mergeWithResidencyContainerCalled, 0u);
@@ -1455,7 +1455,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenNoAllocsInMemoryOperationH
EncodeNoop<FamilyType>::alignToCacheLine(cs);
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1, gemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
mockCsr.setupContext(*osContext.get());
mockCsr.flush(batchBuffer, mockCsr.getResidencyAllocations());
@@ -1489,7 +1489,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenAllocsInMemoryOperationHan
EncodeNoop<FamilyType>::alignToCacheLine(cs);
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1, gemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
mockCsr.setupContext(*osContext.get());
mockCsr.flush(batchBuffer, mockCsr.getResidencyAllocations());

View File

@@ -1003,7 +1003,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenDrmCommandStreamReceiverWhenCreate
executionEnvironment.rootDeviceEnvironments[1]->initGmm();
executionEnvironment.rootDeviceEnvironments[1]->osInterface = std::make_unique<OSInterface>();
executionEnvironment.rootDeviceEnvironments[1]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(new DrmMockCustom(*executionEnvironment.rootDeviceEnvironments[0])));
auto csr = std::make_unique<MockDrmCsr<FamilyType>>(executionEnvironment, 1, 1, gemCloseWorkerMode::gemCloseWorkerActive);
auto csr = std::make_unique<MockDrmCsr<FamilyType>>(executionEnvironment, 1, 1, GemCloseWorkerMode::gemCloseWorkerActive);
auto pageTableManager = csr->createPageTableManager();
EXPECT_EQ(csr->pageTableManager.get(), pageTableManager);
}
@@ -1013,11 +1013,11 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenLocalMemoryEnabledWhenCreatingDrmC
DebugManagerStateRestore restore;
debugManager.flags.EnableLocalMemory.set(1);
MockDrmCsr<FamilyType> csr1(executionEnvironment, 0, 1, gemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr<FamilyType> csr1(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
EXPECT_EQ(DispatchMode::batchedDispatch, csr1.dispatchMode);
debugManager.flags.CsrDispatchMode.set(static_cast<int32_t>(DispatchMode::immediateDispatch));
MockDrmCsr<FamilyType> csr2(executionEnvironment, 0, 1, gemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr<FamilyType> csr2(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
EXPECT_EQ(DispatchMode::immediateDispatch, csr2.dispatchMode);
}
@@ -1025,11 +1025,11 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenLocalMemoryEnabledWhenCreatingDrmC
DebugManagerStateRestore restore;
debugManager.flags.EnableLocalMemory.set(0);
MockDrmCsr<FamilyType> csr1(executionEnvironment, 0, 1, gemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr<FamilyType> csr1(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
EXPECT_EQ(DispatchMode::immediateDispatch, csr1.dispatchMode);
debugManager.flags.CsrDispatchMode.set(static_cast<int32_t>(DispatchMode::batchedDispatch));
MockDrmCsr<FamilyType> csr2(executionEnvironment, 0, 1, gemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr<FamilyType> csr2(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
EXPECT_EQ(DispatchMode::batchedDispatch, csr2.dispatchMode);
}
}

View File

@@ -293,7 +293,7 @@ class DrmCommandStreamForceTileTest : public ::testing::Test {
}
MockDrmCommandStreamReceiver<GfxFamily>(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex,
DeviceBitfield deviceBitfield,
gemCloseWorkerMode mode, uint32_t inputHandleId)
GemCloseWorkerMode mode, uint32_t inputHandleId)
: DrmCommandStreamReceiver<GfxFamily>(executionEnvironment, rootDeviceIndex, deviceBitfield, mode), expectedHandleId(inputHandleId) {
}
@@ -326,12 +326,12 @@ class DrmCommandStreamForceTileTest : public ::testing::Test {
csr = new MockDrmCommandStreamReceiver<GfxFamily>(executionEnvironment,
rootDeviceIndex,
3,
gemCloseWorkerMode::gemCloseWorkerActive,
GemCloseWorkerMode::gemCloseWorkerActive,
expectedHandleId);
ASSERT_NE(nullptr, csr);
csr->setupContext(*osContext);
memoryManager = new DrmMemoryManager(gemCloseWorkerMode::gemCloseWorkerActive,
memoryManager = new DrmMemoryManager(GemCloseWorkerMode::gemCloseWorkerActive,
debugManager.flags.EnableForcePin.get(),
true,
executionEnvironment);
@@ -434,7 +434,7 @@ struct DrmImplicitScalingCommandStreamTest : ::testing::Test {
PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo), DeviceBitfield(0b11)));
osContext->ensureContextInitialized();
memoryManager = new DrmMemoryManager(gemCloseWorkerMode::gemCloseWorkerActive, debugManager.flags.EnableForcePin.get(), true, *executionEnvironment);
memoryManager = new DrmMemoryManager(GemCloseWorkerMode::gemCloseWorkerActive, debugManager.flags.EnableForcePin.get(), true, *executionEnvironment);
executionEnvironment->memoryManager.reset(memoryManager);
}
@@ -447,7 +447,7 @@ struct DrmImplicitScalingCommandStreamTest : ::testing::Test {
template <typename FamilyType>
std::unique_ptr<DrmCommandStreamReceiver<FamilyType>> createCsr() {
auto csr = std::make_unique<DrmCommandStreamReceiver<FamilyType>>(*executionEnvironment, 0, 0b11, gemCloseWorkerMode::gemCloseWorkerActive);
auto csr = std::make_unique<DrmCommandStreamReceiver<FamilyType>>(*executionEnvironment, 0, 0b11, GemCloseWorkerMode::gemCloseWorkerActive);
csr->setupContext(*osContext);
return csr;
}
@@ -532,7 +532,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, whenForceExecu
PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo)));
osContext->ensureContextInitialized();
auto csr = std::make_unique<MockCsr>(*executionEnvironment, 0, osContext->getDeviceBitfield(),
gemCloseWorkerMode::gemCloseWorkerActive);
GemCloseWorkerMode::gemCloseWorkerActive);
csr->setupContext(*osContext);
auto tileInstancedBo0 = new BufferObject(0u, drm, 3, 40, 0, 1);
@@ -575,7 +575,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, whenForceExecu
uint32_t execCalled = 0;
};
auto csr = std::make_unique<MockCsr>(*executionEnvironment, 0, osContext->getDeviceBitfield(),
gemCloseWorkerMode::gemCloseWorkerActive);
GemCloseWorkerMode::gemCloseWorkerActive);
csr->setupContext(*osContext);
auto tileInstancedBo0 = new BufferObject(0u, drm, 3, 40, 0, 1);
@@ -623,7 +623,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, givenDisabledI
uint32_t processResidencyCalled = 0;
};
auto csr = std::make_unique<MockCsr>(*executionEnvironment, 0, osContext->getDeviceBitfield(),
gemCloseWorkerMode::gemCloseWorkerActive);
GemCloseWorkerMode::gemCloseWorkerActive);
csr->setupContext(*osContext);
const auto size = 1024u;
@@ -657,7 +657,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, givenMultiTile
uint32_t execCalled = 0;
};
auto csr = std::make_unique<MockCsr>(*executionEnvironment, 0, osContext->getDeviceBitfield(),
gemCloseWorkerMode::gemCloseWorkerActive);
GemCloseWorkerMode::gemCloseWorkerActive);
csr->setupContext(*osContext);
const auto size = 1024u;

View File

@@ -45,7 +45,7 @@ struct DrmCommandStreamMultiTileMemExecFixture {
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mock));
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*mock, 0, false);
memoryManager = new DrmMemoryManager(gemCloseWorkerMode::gemCloseWorkerInactive,
memoryManager = new DrmMemoryManager(GemCloseWorkerMode::gemCloseWorkerInactive,
debugManager.flags.EnableForcePin.get(),
true,
*executionEnvironment);

View File

@@ -69,7 +69,7 @@ class DrmGemCloseWorkerFixture {
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(drmMock));
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drmMock, 0u, false);
this->mm = new DrmMemoryManager(gemCloseWorkerMode::gemCloseWorkerInactive,
this->mm = new DrmMemoryManager(GemCloseWorkerMode::gemCloseWorkerInactive,
false,
false,
executionEnvironment);

View File

@@ -2191,7 +2191,7 @@ using DrmMemoryManagerCopyMemoryToAllocationPrelimTest = DrmMemoryManagerLocalMe
struct DrmMemoryManagerToTestCopyMemoryToAllocation : public DrmMemoryManager {
using DrmMemoryManager::allocateGraphicsMemoryInDevicePool;
DrmMemoryManagerToTestCopyMemoryToAllocation(ExecutionEnvironment &executionEnvironment, bool localMemoryEnabled, size_t lockableLocalMemorySize)
: DrmMemoryManager(gemCloseWorkerMode::gemCloseWorkerInactive, false, false, executionEnvironment) {
: DrmMemoryManager(GemCloseWorkerMode::gemCloseWorkerInactive, false, false, executionEnvironment) {
std::fill(this->localMemorySupported.begin(), this->localMemorySupported.end(), localMemoryEnabled);
lockedLocalMemorySize = lockableLocalMemorySize;
}

View File

@@ -710,7 +710,7 @@ using DrmMemoryManagerCopyMemoryToAllocationTest = DrmMemoryManagerLocalMemoryTe
struct DrmMemoryManagerToTestCopyMemoryToAllocation : public DrmMemoryManager {
using DrmMemoryManager::allocateGraphicsMemoryInDevicePool;
DrmMemoryManagerToTestCopyMemoryToAllocation(ExecutionEnvironment &executionEnvironment, bool localMemoryEnabled, size_t lockableLocalMemorySize)
: DrmMemoryManager(gemCloseWorkerMode::gemCloseWorkerInactive, false, false, executionEnvironment) {
: DrmMemoryManager(GemCloseWorkerMode::gemCloseWorkerInactive, false, false, executionEnvironment) {
std::fill(this->localMemorySupported.begin(), this->localMemorySupported.end(), localMemoryEnabled);
lockedLocalMemorySize = lockableLocalMemorySize;
}

View File

@@ -590,7 +590,7 @@ TEST_F(DrmMemoryManagerTest, givenDefaultDrmMemoryManagerWhenItIsCreatedAndGfxPa
auto failedInitGfxPartition = std::make_unique<FailedInitGfxPartition>();
memoryManager->gfxPartitions[0].reset(failedInitGfxPartition.release());
memoryManager->initialize(gemCloseWorkerMode::gemCloseWorkerInactive);
memoryManager->initialize(GemCloseWorkerMode::gemCloseWorkerInactive);
EXPECT_FALSE(memoryManager->isInitialized());
auto mockGfxPartitionBasic = std::make_unique<MockGfxPartitionBasic>();
@@ -1047,12 +1047,12 @@ TEST_F(DrmMemoryManagerTest, GivenNullptrWhenUnreferenceIsCalledThenCallSucceeds
}
TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenDrmMemoryManagerCreatedWithGemCloseWorkerModeInactiveThenGemCloseWorkerIsNotCreated) {
DrmMemoryManager drmMemoryManger(gemCloseWorkerMode::gemCloseWorkerInactive, false, false, *executionEnvironment);
DrmMemoryManager drmMemoryManger(GemCloseWorkerMode::gemCloseWorkerInactive, false, false, *executionEnvironment);
EXPECT_EQ(nullptr, drmMemoryManger.peekGemCloseWorker());
}
TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenDrmMemoryManagerCreatedWithGemCloseWorkerActiveThenGemCloseWorkerIsCreated) {
DrmMemoryManager drmMemoryManger(gemCloseWorkerMode::gemCloseWorkerActive, false, false, *executionEnvironment);
DrmMemoryManager drmMemoryManger(GemCloseWorkerMode::gemCloseWorkerActive, false, false, *executionEnvironment);
EXPECT_NE(nullptr, drmMemoryManger.peekGemCloseWorker());
}
@@ -2440,7 +2440,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenUnlockResourceIsCalledOnAl
struct DrmMemoryManagerToTestUnlockResource : public DrmMemoryManager {
using DrmMemoryManager::unlockResourceImpl;
DrmMemoryManagerToTestUnlockResource(ExecutionEnvironment &executionEnvironment, bool localMemoryEnabled, size_t lockableLocalMemorySize)
: DrmMemoryManager(gemCloseWorkerMode::gemCloseWorkerInactive, false, false, executionEnvironment) {
: DrmMemoryManager(GemCloseWorkerMode::gemCloseWorkerInactive, false, false, executionEnvironment) {
}
void unlockBufferObject(BufferObject *bo) override {
unlockResourceInLocalMemoryImplParam.bo = bo;
@@ -2776,7 +2776,7 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenDefaultDrmMemoryManage
}
TEST_F(DrmMemoryManagerBasic, givenDefaultMemoryManagerWhenItIsCreatedThenAsyncDeleterEnabledIsTrue) {
DrmMemoryManager memoryManager(gemCloseWorkerMode::gemCloseWorkerInactive, false, true, executionEnvironment);
DrmMemoryManager memoryManager(GemCloseWorkerMode::gemCloseWorkerInactive, false, true, executionEnvironment);
EXPECT_FALSE(memoryManager.isAsyncDeleterEnabled());
EXPECT_EQ(nullptr, memoryManager.getDeferredDeleter());
memoryManager.commonCleanup();
@@ -2801,7 +2801,7 @@ TEST_F(DrmMemoryManagerBasic, givenEnabledGemCloseWorkerWhenMemoryManagerIsCreat
}
TEST_F(DrmMemoryManagerBasic, givenDefaultGemCloseWorkerWhenMemoryManagerIsCreatedThenGemCloseWorker) {
MemoryManagerCreate<DrmMemoryManager> memoryManager(false, false, gemCloseWorkerMode::gemCloseWorkerActive, false, false, executionEnvironment);
MemoryManagerCreate<DrmMemoryManager> memoryManager(false, false, GemCloseWorkerMode::gemCloseWorkerActive, false, false, executionEnvironment);
EXPECT_NE(memoryManager.peekGemCloseWorker(), nullptr);
}
@@ -2809,7 +2809,7 @@ TEST_F(DrmMemoryManagerBasic, givenDefaultGemCloseWorkerWhenMemoryManagerIsCreat
TEST_F(DrmMemoryManagerBasic, givenEnabledAsyncDeleterFlagWhenMemoryManagerIsCreatedThenAsyncDeleterEnabledIsFalseAndDeleterIsNullptr) {
DebugManagerStateRestore dbgStateRestore;
debugManager.flags.EnableDeferredDeleter.set(true);
DrmMemoryManager memoryManager(gemCloseWorkerMode::gemCloseWorkerInactive, false, true, executionEnvironment);
DrmMemoryManager memoryManager(GemCloseWorkerMode::gemCloseWorkerInactive, false, true, executionEnvironment);
EXPECT_FALSE(memoryManager.isAsyncDeleterEnabled());
EXPECT_EQ(nullptr, memoryManager.getDeferredDeleter());
memoryManager.commonCleanup();
@@ -2818,14 +2818,14 @@ TEST_F(DrmMemoryManagerBasic, givenEnabledAsyncDeleterFlagWhenMemoryManagerIsCre
TEST_F(DrmMemoryManagerBasic, givenDisabledAsyncDeleterFlagWhenMemoryManagerIsCreatedThenAsyncDeleterEnabledIsFalseAndDeleterIsNullptr) {
DebugManagerStateRestore dbgStateRestore;
debugManager.flags.EnableDeferredDeleter.set(false);
DrmMemoryManager memoryManager(gemCloseWorkerMode::gemCloseWorkerInactive, false, true, executionEnvironment);
DrmMemoryManager memoryManager(GemCloseWorkerMode::gemCloseWorkerInactive, false, true, executionEnvironment);
EXPECT_FALSE(memoryManager.isAsyncDeleterEnabled());
EXPECT_EQ(nullptr, memoryManager.getDeferredDeleter());
memoryManager.commonCleanup();
}
TEST_F(DrmMemoryManagerBasic, givenWorkerToCloseWhenCommonCleanupIsCalledThenClosingIsBlocking) {
MockDrmMemoryManager memoryManager(gemCloseWorkerMode::gemCloseWorkerInactive, false, true, executionEnvironment);
MockDrmMemoryManager memoryManager(GemCloseWorkerMode::gemCloseWorkerInactive, false, true, executionEnvironment);
memoryManager.gemCloseWorker.reset(new MockDrmGemCloseWorker(memoryManager));
auto pWorker = static_cast<MockDrmGemCloseWorker *>(memoryManager.gemCloseWorker.get());
@@ -6735,7 +6735,7 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenDebugVar
struct DrmMemoryManagerToTestCopyMemoryToAllocationBanks : public DrmMemoryManager {
DrmMemoryManagerToTestCopyMemoryToAllocationBanks(ExecutionEnvironment &executionEnvironment, size_t lockableLocalMemorySize)
: DrmMemoryManager(gemCloseWorkerMode::gemCloseWorkerInactive, false, false, executionEnvironment) {
: DrmMemoryManager(GemCloseWorkerMode::gemCloseWorkerInactive, false, false, executionEnvironment) {
lockedLocalMemorySize = lockableLocalMemorySize;
}
void *lockBufferObject(BufferObject *bo) override {

View File

@@ -12892,329 +12892,3 @@ struct Demarshaller<TOK_S_GMM_RESOURCE_INFO_WIN_STRUCT> {
return true;
}
};
template <>
struct Demarshaller<TOK_S_GFX_ESCAPE_HEADER> {
template <typename GFX_ESCAPE_HEADERT>
static bool demarshall(GFX_ESCAPE_HEADERT &dst, const TokenHeader *srcTokensBeg, const TokenHeader *srcTokensEnd) {
const TokenHeader *tok = srcTokensBeg;
while (tok < srcTokensEnd) {
if (false == tok->flags.flag4IsVariableLength) {
switch (tok->id) {
default:
if (tok->flags.flag3IsMandatory) {
return false;
}
break;
case TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__SIZE: {
dst.Size = readTokValue<decltype(dst.Size)>(*tok);
} break;
case TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__CHECK_SUM: {
dst.CheckSum = readTokValue<decltype(dst.CheckSum)>(*tok);
} break;
case TOK_FE_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__ESCAPE_CODE: {
dst.EscapeCode = readTokValue<decltype(dst.EscapeCode)>(*tok);
} break;
case TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__UL_RESERVED: {
dst.ulReserved = readTokValue<decltype(dst.ulReserved)>(*tok);
} break;
case TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__UL_RESERVED1: {
dst.ulReserved1 = readTokValue<decltype(dst.ulReserved1)>(*tok);
} break;
case TOK_FBW_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__US_ESCAPE_VERSION: {
dst.usEscapeVersion = readTokValue<decltype(dst.usEscapeVersion)>(*tok);
} break;
case TOK_FBW_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__US_FILE_VERSION: {
dst.usFileVersion = readTokValue<decltype(dst.usFileVersion)>(*tok);
} break;
case TOK_FE_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__UL_MAJOR_ESCAPE_CODE: {
dst.ulMajorEscapeCode = readTokValue<decltype(dst.ulMajorEscapeCode)>(*tok);
} break;
case TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__UI_MINOR_ESCAPE_CODE: {
dst.uiMinorEscapeCode = readTokValue<decltype(dst.uiMinorEscapeCode)>(*tok);
} break;
};
tok = tok + 1 + tok->valueDwordCount;
} else {
auto varLen = reinterpret_cast<const TokenVariableLength *>(tok);
switch (tok->id) {
default:
if (tok->flags.flag3IsMandatory) {
return false;
}
break;
case TOK_S_GFX_ESCAPE_HEADER:
if (false == demarshall(dst, varLen->getValue<TokenHeader>(), varLen->getValue<TokenHeader>() + varLen->valueLengthInBytes / sizeof(TokenHeader))) {
return false;
}
break;
};
tok = tok + sizeof(TokenVariableLength) / sizeof(uint32_t) + varLen->valuePaddedSizeInDwords;
}
}
WCH_ASSERT(tok == srcTokensEnd);
return true;
}
};
template <>
struct Demarshaller<TOK_S_GTDIBASE_IN_STRUCT> {
template <typename GTDIBaseInStructT>
static bool demarshall(GTDIBaseInStructT &dst, const TokenHeader *srcTokensBeg, const TokenHeader *srcTokensEnd) {
const TokenHeader *tok = srcTokensBeg;
while (tok < srcTokensEnd) {
if (false == tok->flags.flag4IsVariableLength) {
switch (tok->id) {
default:
if (tok->flags.flag3IsMandatory) {
return false;
}
break;
case TOK_FE_GTDIBASE_IN_STRUCT__FUNCTION: {
dst.Function = readTokValue<decltype(dst.Function)>(*tok);
} break;
};
tok = tok + 1 + tok->valueDwordCount;
} else {
auto varLen = reinterpret_cast<const TokenVariableLength *>(tok);
switch (tok->id) {
default:
if (tok->flags.flag3IsMandatory) {
return false;
}
break;
case TOK_S_GTDIBASE_IN_STRUCT:
if (false == demarshall(dst, varLen->getValue<TokenHeader>(), varLen->getValue<TokenHeader>() + varLen->valueLengthInBytes / sizeof(TokenHeader))) {
return false;
}
break;
};
tok = tok + sizeof(TokenVariableLength) / sizeof(uint32_t) + varLen->valuePaddedSizeInDwords;
}
}
WCH_ASSERT(tok == srcTokensEnd);
return true;
}
};
template <>
struct Demarshaller<TOK_S_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT> {
template <typename GTDIGetGpuCpuTimestampsOutStructT>
static bool demarshall(GTDIGetGpuCpuTimestampsOutStructT &dst, const TokenHeader *srcTokensBeg, const TokenHeader *srcTokensEnd) {
const TokenHeader *tok = srcTokensBeg;
while (tok < srcTokensEnd) {
if (false == tok->flags.flag4IsVariableLength) {
switch (tok->id) {
default:
if (tok->flags.flag3IsMandatory) {
return false;
}
break;
case TOK_FE_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT__RET_CODE: {
dst.RetCode = readTokValue<decltype(dst.RetCode)>(*tok);
} break;
case TOK_FBQ_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT__GPU_PERF_TICKS: {
dst.gpuPerfTicks = readTokValue<decltype(dst.gpuPerfTicks)>(*tok);
} break;
case TOK_FBQ_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT__CPU_PERF_TICKS: {
dst.cpuPerfTicks = readTokValue<decltype(dst.cpuPerfTicks)>(*tok);
} break;
case TOK_FBQ_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT__GPU_PERF_FREQ: {
dst.gpuPerfFreq = readTokValue<decltype(dst.gpuPerfFreq)>(*tok);
} break;
case TOK_FBQ_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT__CPU_PERF_FREQ: {
dst.cpuPerfFreq = readTokValue<decltype(dst.cpuPerfFreq)>(*tok);
} break;
};
tok = tok + 1 + tok->valueDwordCount;
} else {
auto varLen = reinterpret_cast<const TokenVariableLength *>(tok);
switch (tok->id) {
default:
if (tok->flags.flag3IsMandatory) {
return false;
}
break;
case TOK_S_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT:
if (false == demarshall(dst, varLen->getValue<TokenHeader>(), varLen->getValue<TokenHeader>() + varLen->valueLengthInBytes / sizeof(TokenHeader))) {
return false;
}
break;
};
tok = tok + sizeof(TokenVariableLength) / sizeof(uint32_t) + varLen->valuePaddedSizeInDwords;
}
}
WCH_ASSERT(tok == srcTokensEnd);
return true;
}
};
template <>
struct Demarshaller<TOK_S_TIME_STAMP_DATA_HEADER> {
template <typename TimeStampDataHeaderT>
static bool demarshall(TimeStampDataHeaderT &dst, const TokenHeader *srcTokensBeg, const TokenHeader *srcTokensEnd) {
const TokenHeader *tok = srcTokensBeg;
while (tok < srcTokensEnd) {
if (false == tok->flags.flag4IsVariableLength) {
if (tok->flags.flag3IsMandatory) {
return false;
}
tok = tok + 1 + tok->valueDwordCount;
} else {
auto varLen = reinterpret_cast<const TokenVariableLength *>(tok);
switch (tok->id) {
default:
if (tok->flags.flag3IsMandatory) {
return false;
}
break;
case TOK_S_TIME_STAMP_DATA_HEADER:
if (false == demarshall(dst, varLen->getValue<TokenHeader>(), varLen->getValue<TokenHeader>() + varLen->valueLengthInBytes / sizeof(TokenHeader))) {
return false;
}
break;
case TOK_FS_TIME_STAMP_DATA_HEADER__M_HEADER: {
const TokenHeader *tokMHeader = varLen->getValue<TokenHeader>();
const TokenHeader *tokMHeaderEnd = varLen->getValue<TokenHeader>() + varLen->valueLengthInBytes / sizeof(TokenHeader);
while (tokMHeader < tokMHeaderEnd) {
if (false == tokMHeader->flags.flag4IsVariableLength) {
switch (tokMHeader->id) {
default:
if (tokMHeader->flags.flag3IsMandatory) {
return false;
}
break;
case TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__SIZE: {
dst.m_Header.Size = readTokValue<decltype(dst.m_Header.Size)>(*tokMHeader);
} break;
case TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__CHECK_SUM: {
dst.m_Header.CheckSum = readTokValue<decltype(dst.m_Header.CheckSum)>(*tokMHeader);
} break;
case TOK_FE_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__ESCAPE_CODE: {
dst.m_Header.EscapeCode = readTokValue<decltype(dst.m_Header.EscapeCode)>(*tokMHeader);
} break;
case TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__UL_RESERVED: {
dst.m_Header.ulReserved = readTokValue<decltype(dst.m_Header.ulReserved)>(*tokMHeader);
} break;
case TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__UL_RESERVED1: {
dst.m_Header.ulReserved1 = readTokValue<decltype(dst.m_Header.ulReserved1)>(*tokMHeader);
} break;
case TOK_FBW_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__US_ESCAPE_VERSION: {
dst.m_Header.usEscapeVersion = readTokValue<decltype(dst.m_Header.usEscapeVersion)>(*tokMHeader);
} break;
case TOK_FBW_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__US_FILE_VERSION: {
dst.m_Header.usFileVersion = readTokValue<decltype(dst.m_Header.usFileVersion)>(*tokMHeader);
} break;
case TOK_FE_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__UL_MAJOR_ESCAPE_CODE: {
dst.m_Header.ulMajorEscapeCode = readTokValue<decltype(dst.m_Header.ulMajorEscapeCode)>(*tokMHeader);
} break;
case TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__UI_MINOR_ESCAPE_CODE: {
dst.m_Header.uiMinorEscapeCode = readTokValue<decltype(dst.m_Header.uiMinorEscapeCode)>(*tokMHeader);
} break;
};
tokMHeader = tokMHeader + 1 + tokMHeader->valueDwordCount;
} else {
auto varLen = reinterpret_cast<const TokenVariableLength *>(tokMHeader);
if (tokMHeader->flags.flag3IsMandatory) {
return false;
}
tokMHeader = tokMHeader + sizeof(TokenVariableLength) / sizeof(uint32_t) + varLen->valuePaddedSizeInDwords;
}
}
WCH_ASSERT(tokMHeader == tokMHeaderEnd);
} break;
case TOK_FS_TIME_STAMP_DATA_HEADER__M_DATA: {
const TokenHeader *tokMData = varLen->getValue<TokenHeader>();
const TokenHeader *tokMDataEnd = varLen->getValue<TokenHeader>() + varLen->valueLengthInBytes / sizeof(TokenHeader);
while (tokMData < tokMDataEnd) {
if (false == tokMData->flags.flag4IsVariableLength) {
if (tokMData->flags.flag3IsMandatory) {
return false;
}
tokMData = tokMData + 1 + tokMData->valueDwordCount;
} else {
auto varLen = reinterpret_cast<const TokenVariableLength *>(tokMData);
switch (tokMData->id) {
default:
if (tokMData->flags.flag3IsMandatory) {
return false;
}
break;
case TOK_FXS_TIME_STAMP_DATA_HEADER__ANONYMOUS2466__M_IN: {
const TokenHeader *tokMIn = varLen->getValue<TokenHeader>();
const TokenHeader *tokMInEnd = varLen->getValue<TokenHeader>() + varLen->valueLengthInBytes / sizeof(TokenHeader);
while (tokMIn < tokMInEnd) {
if (false == tokMIn->flags.flag4IsVariableLength) {
switch (tokMIn->id) {
default:
if (tokMIn->flags.flag3IsMandatory) {
return false;
}
break;
case TOK_FE_GTDIBASE_IN_STRUCT__FUNCTION: {
dst.m_Data.m_In.Function = readTokValue<decltype(dst.m_Data.m_In.Function)>(*tokMIn);
} break;
};
tokMIn = tokMIn + 1 + tokMIn->valueDwordCount;
} else {
auto varLen = reinterpret_cast<const TokenVariableLength *>(tokMIn);
if (tokMIn->flags.flag3IsMandatory) {
return false;
}
tokMIn = tokMIn + sizeof(TokenVariableLength) / sizeof(uint32_t) + varLen->valuePaddedSizeInDwords;
}
}
WCH_ASSERT(tokMIn == tokMInEnd);
} break;
case TOK_FS_TIME_STAMP_DATA_HEADER__ANONYMOUS2466__M_OUT: {
const TokenHeader *tokMOut = varLen->getValue<TokenHeader>();
const TokenHeader *tokMOutEnd = varLen->getValue<TokenHeader>() + varLen->valueLengthInBytes / sizeof(TokenHeader);
while (tokMOut < tokMOutEnd) {
if (false == tokMOut->flags.flag4IsVariableLength) {
switch (tokMOut->id) {
default:
if (tokMOut->flags.flag3IsMandatory) {
return false;
}
break;
case TOK_FE_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT__RET_CODE: {
dst.m_Data.m_Out.RetCode = readTokValue<decltype(dst.m_Data.m_Out.RetCode)>(*tokMOut);
} break;
case TOK_FBQ_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT__GPU_PERF_TICKS: {
dst.m_Data.m_Out.gpuPerfTicks = readTokValue<decltype(dst.m_Data.m_Out.gpuPerfTicks)>(*tokMOut);
} break;
case TOK_FBQ_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT__CPU_PERF_TICKS: {
dst.m_Data.m_Out.cpuPerfTicks = readTokValue<decltype(dst.m_Data.m_Out.cpuPerfTicks)>(*tokMOut);
} break;
case TOK_FBQ_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT__GPU_PERF_FREQ: {
dst.m_Data.m_Out.gpuPerfFreq = readTokValue<decltype(dst.m_Data.m_Out.gpuPerfFreq)>(*tokMOut);
} break;
case TOK_FBQ_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT__CPU_PERF_FREQ: {
dst.m_Data.m_Out.cpuPerfFreq = readTokValue<decltype(dst.m_Data.m_Out.cpuPerfFreq)>(*tokMOut);
} break;
};
tokMOut = tokMOut + 1 + tokMOut->valueDwordCount;
} else {
auto varLen = reinterpret_cast<const TokenVariableLength *>(tokMOut);
if (tokMOut->flags.flag3IsMandatory) {
return false;
}
tokMOut = tokMOut + sizeof(TokenVariableLength) / sizeof(uint32_t) + varLen->valuePaddedSizeInDwords;
}
}
WCH_ASSERT(tokMOut == tokMOutEnd);
} break;
};
tokMData = tokMData + sizeof(TokenVariableLength) / sizeof(uint32_t) + varLen->valuePaddedSizeInDwords;
}
}
WCH_ASSERT(tokMData == tokMDataEnd);
} break;
};
tok = tok + sizeof(TokenVariableLength) / sizeof(uint32_t) + varLen->valuePaddedSizeInDwords;
}
}
WCH_ASSERT(tok == srcTokensEnd);
return true;
}
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -3992,89 +3992,3 @@ struct Marshaller<TOK_S_GMM_RESOURCE_INFO_WIN_STRUCT> {
return ret;
}
};
template <typename GFX_ESCAPE_HEADERT>
inline void marshall(TOKSTR_GFX_ESCAPE_HEADER &dst, const GFX_ESCAPE_HEADERT &src) {
dst = {};
dst.Size.setValue(src.Size);
dst.CheckSum.setValue(src.CheckSum);
dst.EscapeCode.setValue(src.EscapeCode);
dst.ulReserved.setValue(src.ulReserved);
dst.ulReserved1.setValue(src.ulReserved1);
dst.usEscapeVersion.setValue(src.usEscapeVersion);
dst.usFileVersion.setValue(src.usFileVersion);
dst.ulMajorEscapeCode.setValue(src.ulMajorEscapeCode);
dst.uiMinorEscapeCode.setValue(src.uiMinorEscapeCode);
}
template <>
struct Marshaller<TOK_S_GFX_ESCAPE_HEADER> {
template <typename GFX_ESCAPE_HEADERT>
static TOKSTR_GFX_ESCAPE_HEADER marshall(const GFX_ESCAPE_HEADERT &src) {
TOKSTR_GFX_ESCAPE_HEADER ret = {};
::marshall(ret, src);
return ret;
}
};
template <typename GTDIBaseInStructT>
inline void marshall(TOKSTR_GTDIBaseInStruct &dst, const GTDIBaseInStructT &src) {
dst = {};
dst.Function.setValue(src.Function);
}
template <>
struct Marshaller<TOK_S_GTDIBASE_IN_STRUCT> {
template <typename GTDIBaseInStructT>
static TOKSTR_GTDIBaseInStruct marshall(const GTDIBaseInStructT &src) {
TOKSTR_GTDIBaseInStruct ret = {};
::marshall(ret, src);
return ret;
}
};
template <typename GTDIGetGpuCpuTimestampsOutStructT>
inline void marshall(TOKSTR_GTDIGetGpuCpuTimestampsOutStruct &dst, const GTDIGetGpuCpuTimestampsOutStructT &src) {
dst = {};
dst.RetCode.setValue(src.RetCode);
dst.gpuPerfTicks.setValue(src.gpuPerfTicks);
dst.cpuPerfTicks.setValue(src.cpuPerfTicks);
dst.gpuPerfFreq.setValue(src.gpuPerfFreq);
dst.cpuPerfFreq.setValue(src.cpuPerfFreq);
}
template <>
struct Marshaller<TOK_S_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT> {
template <typename GTDIGetGpuCpuTimestampsOutStructT>
static TOKSTR_GTDIGetGpuCpuTimestampsOutStruct marshall(const GTDIGetGpuCpuTimestampsOutStructT &src) {
TOKSTR_GTDIGetGpuCpuTimestampsOutStruct ret = {};
::marshall(ret, src);
return ret;
}
};
template <typename TimeStampDataHeaderT>
inline void marshall(TOKSTR_TimeStampDataHeader &dst, const TimeStampDataHeaderT &src) {
dst = {};
dst.m_Header.Size.setValue(src.m_Header.Size);
dst.m_Header.CheckSum.setValue(src.m_Header.CheckSum);
dst.m_Header.EscapeCode.setValue(src.m_Header.EscapeCode);
dst.m_Header.ulReserved.setValue(src.m_Header.ulReserved);
dst.m_Header.ulReserved1.setValue(src.m_Header.ulReserved1);
dst.m_Header.usEscapeVersion.setValue(src.m_Header.usEscapeVersion);
dst.m_Header.usFileVersion.setValue(src.m_Header.usFileVersion);
dst.m_Header.ulMajorEscapeCode.setValue(src.m_Header.ulMajorEscapeCode);
dst.m_Header.uiMinorEscapeCode.setValue(src.m_Header.uiMinorEscapeCode);
dst.m_Data.m_In.Function.setValue(src.m_Data.m_In.Function);
dst.m_Data.m_Out.RetCode.setValue(src.m_Data.m_Out.RetCode);
dst.m_Data.m_Out.gpuPerfTicks.setValue(src.m_Data.m_Out.gpuPerfTicks);
dst.m_Data.m_Out.cpuPerfTicks.setValue(src.m_Data.m_Out.cpuPerfTicks);
dst.m_Data.m_Out.gpuPerfFreq.setValue(src.m_Data.m_Out.gpuPerfFreq);
dst.m_Data.m_Out.cpuPerfFreq.setValue(src.m_Data.m_Out.cpuPerfFreq);
}
template <>
struct Marshaller<TOK_S_TIME_STAMP_DATA_HEADER> {
template <typename TimeStampDataHeaderT>
static TOKSTR_TimeStampDataHeader marshall(const TimeStampDataHeaderT &src) {
TOKSTR_TimeStampDataHeader ret = {};
::marshall(ret, src);
return ret;
}
};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -1606,144 +1606,3 @@ struct TOKSTR_GmmResourceInfoWinStruct {
};
static_assert(std::is_standard_layout_v<TOKSTR_GmmResourceInfoWinStruct>, "");
static_assert(sizeof(TOKSTR_GmmResourceInfoWinStruct) % sizeof(uint32_t) == 0, "");
struct TOKSTR_GFX_ESCAPE_HEADER {
TokenVariableLength base;
TOKSTR_GFX_ESCAPE_HEADER(uint16_t tokenId, uint32_t elementId = 0)
: base(tokenId, elementId, offsetof(TOKSTR_GFX_ESCAPE_HEADER, uiMinorEscapeCode) + sizeof(uiMinorEscapeCode) - offsetof(TOKSTR_GFX_ESCAPE_HEADER, Size), (sizeof(*this) - sizeof(base)) / sizeof(uint32_t)) {}
TOKSTR_GFX_ESCAPE_HEADER()
: base(TOK_S_GFX_ESCAPE_HEADER, 0, sizeof(*this) - sizeof(base)) {}
struct TOKSTR_ANONYMOUS4410 {
TokenVariableLength base;
TOKSTR_ANONYMOUS4410(uint16_t tokenId, uint32_t elementId = 0)
: base(tokenId, elementId, offsetof(TOKSTR_ANONYMOUS4410, uiMinorEscapeCode) + sizeof(uiMinorEscapeCode) - offsetof(TOKSTR_ANONYMOUS4410, Size), (sizeof(*this) - sizeof(base)) / sizeof(uint32_t)) {}
TOKSTR_ANONYMOUS4410()
: base(TOK_S_GFX_ESCAPE_HEADER__ANONYMOUS4410, 0, sizeof(*this) - sizeof(base)) {}
struct TOKSTR_ANONYMOUS4430 {
TokenVariableLength base;
TOKSTR_ANONYMOUS4430(uint16_t tokenId, uint32_t elementId = 0)
: base(tokenId, elementId, offsetof(TOKSTR_ANONYMOUS4430, ulReserved) + sizeof(ulReserved) - offsetof(TOKSTR_ANONYMOUS4430, Size), (sizeof(*this) - sizeof(base)) / sizeof(uint32_t)) {}
TOKSTR_ANONYMOUS4430()
: base(TOK_S_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430, 0, sizeof(*this) - sizeof(base)) {}
TokenDword Size = {TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__SIZE};
TokenDword CheckSum = {TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__CHECK_SUM};
TokenDword EscapeCode = {TOK_FE_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__ESCAPE_CODE};
TokenDword ulReserved = {TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__UL_RESERVED};
};
static_assert(std::is_standard_layout_v<TOKSTR_ANONYMOUS4430>, "");
static_assert(sizeof(TOKSTR_ANONYMOUS4430) % sizeof(uint32_t) == 0, "");
struct TOKSTR_ANONYMOUS4963 {
TokenVariableLength base;
TOKSTR_ANONYMOUS4963(uint16_t tokenId, uint32_t elementId = 0)
: base(tokenId, elementId, offsetof(TOKSTR_ANONYMOUS4963, uiMinorEscapeCode) + sizeof(uiMinorEscapeCode) - offsetof(TOKSTR_ANONYMOUS4963, ulReserved1), (sizeof(*this) - sizeof(base)) / sizeof(uint32_t)) {}
TOKSTR_ANONYMOUS4963()
: base(TOK_S_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963, 0, sizeof(*this) - sizeof(base)) {}
TokenDword ulReserved1 = {TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__UL_RESERVED1};
TokenDword usEscapeVersion = {TOK_FBW_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__US_ESCAPE_VERSION};
TokenDword usFileVersion = {TOK_FBW_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__US_FILE_VERSION};
TokenDword ulMajorEscapeCode = {TOK_FE_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__UL_MAJOR_ESCAPE_CODE};
TokenDword uiMinorEscapeCode = {TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__UI_MINOR_ESCAPE_CODE};
};
static_assert(std::is_standard_layout_v<TOKSTR_ANONYMOUS4963>, "");
static_assert(sizeof(TOKSTR_ANONYMOUS4963) % sizeof(uint32_t) == 0, "");
TokenDword Size = {TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__SIZE}; // Indirect field from anonymous struct
TokenDword CheckSum = {TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__CHECK_SUM}; // Indirect field from anonymous struct
TokenDword EscapeCode = {TOK_FE_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__ESCAPE_CODE}; // Indirect field from anonymous struct
TokenDword ulReserved = {TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__UL_RESERVED}; // Indirect field from anonymous struct
TokenDword ulReserved1 = {TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__UL_RESERVED1}; // Indirect field from anonymous struct
TokenDword usEscapeVersion = {TOK_FBW_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__US_ESCAPE_VERSION}; // Indirect field from anonymous struct
TokenDword usFileVersion = {TOK_FBW_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__US_FILE_VERSION}; // Indirect field from anonymous struct
TokenDword ulMajorEscapeCode = {TOK_FE_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__UL_MAJOR_ESCAPE_CODE}; // Indirect field from anonymous struct
TokenDword uiMinorEscapeCode = {TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__UI_MINOR_ESCAPE_CODE}; // Indirect field from anonymous struct
};
static_assert(std::is_standard_layout_v<TOKSTR_ANONYMOUS4410>, "");
static_assert(sizeof(TOKSTR_ANONYMOUS4410) % sizeof(uint32_t) == 0, "");
TokenDword Size = {TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__SIZE}; // Indirect field from anonymous struct
TokenDword CheckSum = {TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__CHECK_SUM}; // Indirect field from anonymous struct
TokenDword EscapeCode = {TOK_FE_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__ESCAPE_CODE}; // Indirect field from anonymous struct
TokenDword ulReserved = {TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4430__UL_RESERVED}; // Indirect field from anonymous struct
TokenDword ulReserved1 = {TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__UL_RESERVED1}; // Indirect field from anonymous struct
TokenDword usEscapeVersion = {TOK_FBW_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__US_ESCAPE_VERSION}; // Indirect field from anonymous struct
TokenDword usFileVersion = {TOK_FBW_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__US_FILE_VERSION}; // Indirect field from anonymous struct
TokenDword ulMajorEscapeCode = {TOK_FE_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__UL_MAJOR_ESCAPE_CODE}; // Indirect field from anonymous struct
TokenDword uiMinorEscapeCode = {TOK_FBD_GFX_ESCAPE_HEADER__ANONYMOUS4410__ANONYMOUS4963__UI_MINOR_ESCAPE_CODE}; // Indirect field from anonymous struct
};
static_assert(std::is_standard_layout_v<TOKSTR_GFX_ESCAPE_HEADER>, "");
static_assert(sizeof(TOKSTR_GFX_ESCAPE_HEADER) % sizeof(uint32_t) == 0, "");
struct TOKSTR_GTDIBaseInStruct {
TokenVariableLength base;
TOKSTR_GTDIBaseInStruct(uint16_t tokenId, uint32_t elementId = 0)
: base(tokenId, elementId, offsetof(TOKSTR_GTDIBaseInStruct, Function) + sizeof(Function) - offsetof(TOKSTR_GTDIBaseInStruct, Function), (sizeof(*this) - sizeof(base)) / sizeof(uint32_t)) {}
TOKSTR_GTDIBaseInStruct()
: base(TOK_S_GTDIBASE_IN_STRUCT, 0, sizeof(*this) - sizeof(base)) {}
TokenDword Function = {TOK_FE_GTDIBASE_IN_STRUCT__FUNCTION};
};
static_assert(std::is_standard_layout_v<TOKSTR_GTDIBaseInStruct>, "");
static_assert(sizeof(TOKSTR_GTDIBaseInStruct) % sizeof(uint32_t) == 0, "");
struct TOKSTR_GTDIGetGpuCpuTimestampsOutStruct {
TokenVariableLength base;
TOKSTR_GTDIGetGpuCpuTimestampsOutStruct(uint16_t tokenId, uint32_t elementId = 0)
: base(tokenId, elementId, offsetof(TOKSTR_GTDIGetGpuCpuTimestampsOutStruct, cpuPerfFreq) + sizeof(cpuPerfFreq) - offsetof(TOKSTR_GTDIGetGpuCpuTimestampsOutStruct, RetCode), (sizeof(*this) - sizeof(base)) / sizeof(uint32_t)) {}
TOKSTR_GTDIGetGpuCpuTimestampsOutStruct()
: base(TOK_S_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT, 0, sizeof(*this) - sizeof(base)) {}
TokenDword RetCode = {TOK_FE_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT__RET_CODE};
TokenQword gpuPerfTicks = {TOK_FBQ_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT__GPU_PERF_TICKS};
TokenQword cpuPerfTicks = {TOK_FBQ_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT__CPU_PERF_TICKS};
TokenQword gpuPerfFreq = {TOK_FBQ_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT__GPU_PERF_FREQ};
TokenQword cpuPerfFreq = {TOK_FBQ_GTDIGET_GPU_CPU_TIMESTAMPS_OUT_STRUCT__CPU_PERF_FREQ};
};
static_assert(std::is_standard_layout_v<TOKSTR_GTDIGetGpuCpuTimestampsOutStruct>, "");
static_assert(sizeof(TOKSTR_GTDIGetGpuCpuTimestampsOutStruct) % sizeof(uint32_t) == 0, "");
struct TOKSTR_TimeStampDataHeader {
TokenVariableLength base;
TOKSTR_TimeStampDataHeader(uint16_t tokenId, uint32_t elementId = 0)
: base(tokenId, elementId, offsetof(TOKSTR_TimeStampDataHeader, m_Data) + sizeof(m_Data) - offsetof(TOKSTR_TimeStampDataHeader, m_Header), (sizeof(*this) - sizeof(base)) / sizeof(uint32_t)) {}
TOKSTR_TimeStampDataHeader()
: base(TOK_S_TIME_STAMP_DATA_HEADER, 0, sizeof(*this) - sizeof(base)) {}
struct TOKSTR_ANONYMOUS2466 {
TokenVariableLength base;
TOKSTR_ANONYMOUS2466(uint16_t tokenId, uint32_t elementId = 0)
: base(tokenId, elementId, offsetof(TOKSTR_ANONYMOUS2466, m_Out) + sizeof(m_Out) - offsetof(TOKSTR_ANONYMOUS2466, m_In), (sizeof(*this) - sizeof(base)) / sizeof(uint32_t)) {}
TOKSTR_ANONYMOUS2466()
: base(TOK_S_TIME_STAMP_DATA_HEADER__ANONYMOUS2466, 0, sizeof(*this) - sizeof(base)) {}
TOKSTR_GTDIBaseInStruct m_In = {TOK_FXS_TIME_STAMP_DATA_HEADER__ANONYMOUS2466__M_IN};
TOKSTR_GTDIGetGpuCpuTimestampsOutStruct m_Out = {TOK_FS_TIME_STAMP_DATA_HEADER__ANONYMOUS2466__M_OUT};
};
static_assert(std::is_standard_layout_v<TOKSTR_ANONYMOUS2466>, "");
static_assert(sizeof(TOKSTR_ANONYMOUS2466) % sizeof(uint32_t) == 0, "");
TOKSTR_GFX_ESCAPE_HEADER m_Header = {TOK_FS_TIME_STAMP_DATA_HEADER__M_HEADER};
TOKSTR_ANONYMOUS2466 m_Data = {TOK_FS_TIME_STAMP_DATA_HEADER__M_DATA};
};
static_assert(std::is_standard_layout_v<TOKSTR_TimeStampDataHeader>, "");
static_assert(sizeof(TOKSTR_TimeStampDataHeader) % sizeof(uint32_t) == 0, "");