Skip to content

Commit 0242d52

Browse files
petechouigcbot
authored andcommitted
Reland ZEBIN: Add NT_INTELGT_ZEBIN_VERSION for whole ELF versioning.
The description of the new ELF note NT_INTELGT_ZEBIN_VERSION represents the ZEBIN ELF file version that reflects the attribute and section changes. The content is stored in a nul-terminated string and the format is "<Major number>.<Minor number>". For example, it's "1.16\0" with this change. Currently the version information is in both .ze_info and the new ELF note in order not to break any existing tools. After switching to the ELF note, we can decide if we want to remove the version in .ze_info or keep the redundant info in both places. Also separate version information as a version.md from zeinfo md file because now it should reflect all ELF section and zeinfo attribute changes.
1 parent c7e12b3 commit 0242d52

File tree

6 files changed

+72
-28
lines changed

6 files changed

+72
-28
lines changed

IGC/ZEBinWriter/zebin/source/ZEELF.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,16 @@ enum R_TYPE_ZEBIN
4646

4747
// ELF note type for INTELGT
4848
enum {
49+
// The description is the Product family stored in a 4-byte ELF word
4950
NT_INTELGT_PRODUCT_FAMILY = 1,
51+
// The description is the GFXCORE family stored in a 4-byte ELF word
5052
NT_INTELGT_GFXCORE_FAMILY = 2,
53+
// The description is the TargetMetadata structure defined below
5154
NT_INTELGT_TARGET_METADATA = 3,
55+
// The description represents the ZEBIN ELF file version that reflects the
56+
// attribute and section changes. The content is stored in a nul-terminated
57+
// string and the format is "<Major number>.<Minor number>".
58+
NT_INTELGT_ZEBIN_VERSION = 4,
5259
};
5360

5461
struct TargetMetadata {

IGC/ZEBinWriter/zebin/source/ZEELFObjectBuilder.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,16 @@ std::pair<uint64_t, uint64_t> ELFWriter::writeCompatibilityNote() {
591591
padToRequiredAlign();
592592
};
593593

594+
auto writeOneStrNote = [&](StringRef owner, StringRef desc, uint32_t type) {
595+
m_W.write<uint32_t>(owner.size() + 1);
596+
m_W.write<uint32_t>(desc.size() + 1);
597+
m_W.write<uint32_t>(type);
598+
m_W.OS << owner << '\0';
599+
padToRequiredAlign();
600+
m_W.OS << desc << '\0';
601+
padToRequiredAlign();
602+
};
603+
594604
// Align the section offset to the required alignment first.
595605
// TODO: Handle the section alignment in a more generic place..
596606
padToRequiredAlign();
@@ -609,6 +619,11 @@ std::pair<uint64_t, uint64_t> ELFWriter::writeCompatibilityNote() {
609619
writeOneNote("IntelGT",
610620
m_ObjBuilder.m_metadata.packed,
611621
NT_INTELGT_TARGET_METADATA);
622+
623+
// write NT_INTELGT_ZEBIN_VERSION
624+
writeOneStrNote("IntelGT",
625+
PreDefinedAttrGetter::getVersionNumber(),
626+
NT_INTELGT_ZEBIN_VERSION);
612627
return std::make_pair(start_off, m_W.OS.tell() - start_off);
613628
}
614629

IGC/ZEBinWriter/zebin/source/autogen/ZEInfo.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ struct zeInfoContainer
179179
HostAccessesTy global_host_access_table;
180180
};
181181
struct PreDefinedAttrGetter{
182-
static zeinfo_str_t getVersionNumber() { return "1.15"; }
182+
static zeinfo_str_t getVersionNumber() { return "1.16"; }
183183

184184
enum class ArgThreadSchedulingMode {
185185
age_based,

IGC/ZEBinWriter/zebin/spec/elf.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ SPDX-License-Identifier: MIT
77
============================= end_copyright_notice ==========================-->
88

99
# ELF Layout
10+
The version information of ZEBIN can be found in version.md. ELF changes should
11+
be documented properly in version.md.
1012

1113
| Contents | Description | Section Type |
1214
| ------ | ------ | ------ |
@@ -102,9 +104,16 @@ recognize both the owner name (INTELGT) and the type of an ELF note entry to
102104
interpret its description.
103105
~~~
104106
enum {
105-
NT_INTELGT_PRODUCT_FAMILY = 1, // the description is the Product family stored in a 4-byte ELF word
106-
NT_INTELGT_GFXCORE_FAMILY = 2, // the description is the GFXCORE family stored in a 4-byte ELF word
107-
NT_INTELGT_TARGET_METADATA = 3, // the description is the TargetMetadata structure defined below
107+
// The description is the Product family stored in a 4-byte ELF word
108+
NT_INTELGT_PRODUCT_FAMILY = 1,
109+
// The description is the GFXCORE family stored in a 4-byte ELF word
110+
NT_INTELGT_GFXCORE_FAMILY = 2,
111+
// The description is the TargetMetadata structure defined below
112+
NT_INTELGT_TARGET_METADATA = 3,
113+
// The description represents the ZEBIN ELF file version that reflects the
114+
// attribute and section changes. The content is stored in a nul-terminated
115+
// string and the format is "<Major number>.<Minor number>".
116+
NT_INTELGT_ZEBIN_VERSION = 4,
108117
};
109118
~~~
110119

IGC/ZEBinWriter/zebin/spec/version.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!---======================= begin_copyright_notice ============================
2+
3+
Copyright (C) 2022 Intel Corporation
4+
5+
SPDX-License-Identifier: MIT
6+
7+
============================= end_copyright_notice ==========================-->
8+
9+
# ZEBIN Version
10+
Version 1.16
11+
12+
## Versioning
13+
Format: \<_Major number_\>.\<_Minor number_\>
14+
- Major number: Increase when non-backward-compatible features are added. For example, rename attributes or remove attributes.
15+
- Minor number: Increase when backward-compatible features are added. For example, add new attributes.
16+
17+
## Change Note
18+
- **Version 1.16**: Add NT_INTELGT_ZEBIN_VERSION note to represent the ZEBIN ELF file version.
19+
- **Version 1.15**: Add image_type, image_transformable, and sampler_type attributes to payload argument. Add new image and sampler argument types.
20+
- **Version 1.14**: Add slm_alignment to payload argument.
21+
- **Version 1.13**: Add functions with the name and execution env.
22+
- **Version 1.12**: Add global_host_access_table to container.
23+
- **Version 1.11**: Add require_disable_eufusion attribute.
24+
- **Version 1.10**: Add thread_scheduling_mode to execution_env.
25+
- **Version 1.9**: Add source_offset to payload argument.
26+
- **Version 1.8**: Add inline_data_payload_size to execution_env.
27+
- **Version 1.7**: Add debug_env to kernel.
28+
- **Version 1.6**: Remove actual_kernel_start_offset from execution environment.
29+
- **Version 1.5**: Add payload_argument type work_dimensions.
30+
- **Version 1.4**: Add sampler_index to payload arguments.
31+
- **Version 1.3**: Add printf_buffer to argument_type.
32+
- **Version 1.2**: Add buffer_offset to argument_type.
33+
- **Version 1.1**: Add experimental_properties to kernel.
34+
- **Version 1.0**: Add version number. Add slot to per_thread_memory_buffers. Rename shared_local_memory to slm in memory_addressing_mode.

IGC/ZEBinWriter/zebin/spec/zeinfo.md

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ SPDX-License-Identifier: MIT
66
77
============================= end_copyright_notice ==========================-->
88

9-
# ZE Info
10-
Version 1.15
9+
## Version
10+
The version information of ZEBIN can be found in version.md. ZEINFO changes
11+
should be documented properly in version.md.
1112

1213
## Grammar
1314

@@ -353,25 +354,3 @@ This section defines mapping between device and host name of a global variable.
353354
| host_name | str | User-specified global variable name derived from HostAccesINTEL decoration. Used to access global variable from host API calls. |
354355
<!--- HostAccess HostAccesses --->
355356

356-
## Versioning
357-
Format: \<_Major number_\>.\<_Minor number_\>
358-
- Major number: Increase when non-backward-compatible features are added. For example, rename attributes or remove attributes.
359-
- Minor number: Increase when backward-compatible features are added. For example, add new attributes.
360-
361-
## Change Note
362-
- **Version 1.15**: Add image_type, image_transformable, and sampler_type attributes to payload argument. Add new image and sampler argument types.
363-
- **Version 1.14**: Add slm_alignment to payload argument.
364-
- **Version 1.13**: Add functions with the name and execution env.
365-
- **Version 1.12**: Add global_host_access_table to container.
366-
- **Version 1.11**: Add require_disable_eufusion attribute.
367-
- **Version 1.10**: Add thread_scheduling_mode to execution_env.
368-
- **Version 1.9**: Add source_offset to payload argument.
369-
- **Version 1.8**: Add inline_data_payload_size to execution_env.
370-
- **Version 1.7**: Add debug_env to kernel.
371-
- **Version 1.6**: Remove actual_kernel_start_offset from execution environment.
372-
- **Version 1.5**: Add payload_argument type work_dimensions.
373-
- **Version 1.4**: Add sampler_index to payload arguments.
374-
- **Version 1.3**: Add printf_buffer to argument_type.
375-
- **Version 1.2**: Add buffer_offset to argument_type.
376-
- **Version 1.1**: Add experimental_properties to kernel.
377-
- **Version 1.0**: Add version number. Add slot to per_thread_memory_buffers. Rename shared_local_memory to slm in memory_addressing_mode.

0 commit comments

Comments
 (0)