Skip to content

Commit 65ed42a

Browse files
fda0igcbot
authored andcommitted
Add NT_INTELGT_PRODUCT_CONFIG to IntelGTNotes
Expand .note.intelgt.compat section of zebin files with a new NT_INTELGT_PRODUCT_CONFIG note so it can be used for program validation instead of NT_INTELGT_PRODUCT_FAMILY, NT_INTELGT_GFXCORE_FAMILY and NT_INTELGT_TARGET_METADATA.
1 parent 2ae6715 commit 65ed42a

File tree

7 files changed

+48
-1
lines changed

7 files changed

+48
-1
lines changed

IGC/AdaptorOCL/OCL/sp/spp_g8.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ bool CGen8OpenCLProgram::GetZEBinary(
458458
(const uint8_t*)buildOptions, buildOptionsSize);
459459
zebuilder.setProductFamily(m_Platform.eProductFamily);
460460
zebuilder.setGfxCoreFamily(m_Platform.eRenderCoreFamily);
461+
zebuilder.setGmdID(m_Platform.sRenderBlockID);
461462

462463
//
463464
// Creating ZE binary requires linking individual ELF files,

IGC/AdaptorOCL/OCL/sp/zebin_builder.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ void ZEBinaryBuilder::setGfxCoreFamily(GFXCORE_FAMILY value)
6464
mBuilder.setGfxCoreFamily(value);
6565
}
6666

67+
void ZEBinaryBuilder::setGmdID(GFX_GMD_ID value)
68+
{
69+
mBuilder.setGmdID(value);
70+
}
71+
6772
void ZEBinaryBuilder::createKernel(
6873
const char* rawIsaBinary,
6974
unsigned int rawIsaBinarySize,

IGC/AdaptorOCL/OCL/sp/zebin_builder.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ class ZEBinaryBuilder : DisallowCopy
5050
// Set the GfxCoreFamily as the specified value.
5151
void setGfxCoreFamily(GFXCORE_FAMILY value);
5252

53+
// Set the GmdId as the specified value.
54+
void setGmdID(GFX_GMD_ID value);
55+
5356
// Pair of name for the section (1st elem) and VISA asm text (2nd elem).
5457
using NamedVISAAsm = std::pair<std::string, std::string>;
5558

IGC/ZEBinWriter/zebin/source/ZEELF.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ enum {
5959
// attribute and section changes. The content is stored in a nul-terminated
6060
// string and the format is "<Major number>.<Minor number>".
6161
NT_INTELGT_ZEBIN_VERSION = 4,
62+
// The description is stored in a 4-byte ELF word and is used instead
63+
// of NT_INTELGT_PRODUCT_FAMILY, NT_INTELGT_GFXCORE_FAMILY and
64+
// NT_INTELGT_TARGET_METADATA because it contains all required info to
65+
// validate program for a target device
66+
NT_INTELGT_PRODUCT_CONFIG = 5,
6267
};
6368

6469
struct TargetMetadata {

IGC/ZEBinWriter/zebin/source/ZEELFObjectBuilder.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,12 @@ std::pair<uint64_t, uint64_t> ELFWriter::writeCompatibilityNote() {
630630
writeOneStrNote("IntelGT",
631631
PreDefinedAttrGetter::getVersionNumber(),
632632
NT_INTELGT_ZEBIN_VERSION);
633+
634+
// write NT_INTELGT_PRODUCT_CONFIG
635+
writeOneNote("IntelGT",
636+
m_ObjBuilder.m_gmdID.Value,
637+
NT_INTELGT_PRODUCT_CONFIG);
638+
633639
return std::make_pair(start_off, m_W.OS.tell() - start_off);
634640
}
635641

IGC/ZEBinWriter/zebin/source/ZEELFObjectBuilder.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ class ZEELFObjectBuilder {
6565
void setTargetMetadata(TargetMetadata metadata) { m_metadata = metadata; }
6666
TargetMetadata getTargetMetadata() const { return m_metadata; }
6767

68+
void setGmdID(GFX_GMD_ID gmdID) { m_gmdID = gmdID; }
69+
GFX_GMD_ID setGmdID() const { return m_gmdID; }
70+
6871
// add a text section contains gen binary
6972
// - name: section name. This is usually the kernel or function name of
7073
// this text section. Do not includes leading .text in given
@@ -375,6 +378,7 @@ class ZEELFObjectBuilder {
375378
PRODUCT_FAMILY m_productFamily = IGFX_UNKNOWN;
376379
GFXCORE_FAMILY m_gfxCoreFamily = IGFX_UNKNOWN_CORE;
377380
TargetMetadata m_metadata;
381+
GFX_GMD_ID m_gmdID;
378382

379383
StandardSectionListTy m_textSections;
380384
StandardSectionListTy m_dataAndbssSections; // data and bss sections

IGC/ZEBinWriter/zebin/spec/elf.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ information, depending on section type.
9898
## ELF note type for INTELGT
9999

100100
**n_type**
101-
Currently there are 3 note types defined for INTELGT and the notes are placed
101+
Currently there are 5 note types defined for INTELGT and the notes are placed
102102
in the .note.intelgt.compat section. The consumer of the ZE binary file should
103103
recognize both the owner name (INTELGT) and the type of an ELF note entry to
104104
interpret its description.
@@ -114,6 +114,11 @@ enum {
114114
// attribute and section changes. The content is stored in a nul-terminated
115115
// string and the format is "<Major number>.<Minor number>".
116116
NT_INTELGT_ZEBIN_VERSION = 4,
117+
// The description is stored in a 4-byte ELF word and is used instead
118+
// of NT_INTELGT_PRODUCT_FAMILY, NT_INTELGT_GFXCORE_FAMILY and
119+
// NT_INTELGT_TARGET_METADATA because it contains all required info to
120+
// validate program for a target device
121+
NT_INTELGT_PRODUCT_CONFIG = 5,
117122
};
118123
~~~
119124

@@ -158,6 +163,24 @@ struct TargetMetadata {
158163
};
159164
~~~
160165

166+
**The description of NT_INTELGT_PRODUCT_CONFIG note**
167+
~~~
168+
typedef struct GFX_GMD_ID_DEF
169+
{
170+
union
171+
{
172+
struct
173+
{
174+
unsigned int RevisionID : 6;
175+
unsigned int Reserved : 8;
176+
unsigned int GMDRelease : 8;
177+
unsigned int GMDArch : 10;
178+
}GmdID;
179+
unsigned int Value;
180+
};
181+
}GFX_GMD_ID;
182+
~~~
183+
161184
## Gen Relocation Type
162185
Relocation type for **ELF32_R_TYPE** or **ELF64_R_TYPE**
163186
~~~

0 commit comments

Comments
 (0)