This chapter describes Intel(R) Processor Graphics Assembler (IGA) library - a part of Intel(R) Processor Graphics Compiler. The IGA is designed to decode and disassemble GEN binaries, including getting instruction properties, like opcode, instruction size, arguments, execution size, etc.
Supported OS:
- Linux
- Windows
Supported HW:
- Intel(R) Processor Graphics GEN9+
Needed Headers:
- Intel(R) Processor Graphics Assembler (IGA) library headers
Needed Libraries:
- Intel(R) Processor Graphics Assembler (IGA) library, can be installed as part of Intel(R) Graphics Compute Runtime for oneAPI Level Zero and OpenCL(TM) Driver
An example below demonstrates how to split raw GEN binary into separate instructions and disassemble them using KernelView
interface of IGA:
#include <kv.hpp>
std::vector< std::pair<uint32_t, std::string> > Disassemble(
const std::vector<uint8_t>& binary) {
std::vector< std::pair<uint32_t, std::string> > instruction_list;
KernelView kv(IGA_GEN9, binary.data(), binary.size(),
iga::SWSB_ENCODE_MODE::SingleDistPipe);
assert(kv.decodeSucceeded());
char text[MAX_STR_SIZE] = { 0 };
int32_t offset = 0, size = 0;
while (true) {
size = kv.getInstSize(offset);
if (size == 0) {
break;
}
size_t lenght = kv.getInstSyntax(offset, text, MAX_STR_SIZE);
assert(lenght > 0);
instruction_list.push_back(std::make_pair(offset, text));
offset += size;
}
return instruction_list;
}
- refer to the paper Introduction to GEN Assembly to learn more on Intel(R) Processor Graphics instruction set
- look into Intel(R) Processor Graphics Assembler (IGA) library headers to learn more on GEN binary decoding/disassembling interfaces