Skip to content

Commit 0316e40

Browse files
petechouigcbot
authored andcommitted
ZEBIN: Add slm_alignment to .ze_info payload argument.
Provide the alignment of slm local pointer for runtime to set the alignment requirement accordingly.
1 parent dd18534 commit 0316e40

File tree

6 files changed

+20
-6
lines changed

6 files changed

+20
-6
lines changed

IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,8 @@ namespace IGC
698698
kernelArg->getAssociatedArgNo(),
699699
zebin::PreDefinedAttrGetter::ArgAddrMode::slm,
700700
zebin::PreDefinedAttrGetter::ArgAddrSpace::local,
701-
zebin::PreDefinedAttrGetter::ArgAccessType::readwrite);
701+
zebin::PreDefinedAttrGetter::ArgAccessType::readwrite,
702+
kernelArg->getAlignment());
702703
break;
703704
// by value arguments
704705
case KernelArg::ArgType::CONSTANT_REG:

IGC/ZEBinWriter/zebin/source/ZEELFObjectBuilder.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,8 @@ zeInfoPayloadArgument& ZEInfoBuilder::addPayloadArgumentByPointer(
965965
int32_t arg_index,
966966
PreDefinedAttrGetter::ArgAddrMode addrmode,
967967
PreDefinedAttrGetter::ArgAddrSpace addrspace,
968-
PreDefinedAttrGetter::ArgAccessType access_type)
968+
PreDefinedAttrGetter::ArgAccessType access_type,
969+
int32_t alignment)
969970
{
970971
arg_list.emplace_back();
971972
zeInfoPayloadArgument& arg = arg_list.back();
@@ -976,6 +977,13 @@ zeInfoPayloadArgument& ZEInfoBuilder::addPayloadArgumentByPointer(
976977
arg.addrmode = PreDefinedAttrGetter::get(addrmode);
977978
arg.addrspace = PreDefinedAttrGetter::get(addrspace);
978979
arg.access_type = PreDefinedAttrGetter::get(access_type);
980+
981+
if (addrmode == PreDefinedAttrGetter::ArgAddrMode::slm &&
982+
addrspace == PreDefinedAttrGetter::ArgAddrSpace::local) {
983+
arg.slm_alignment = alignment;
984+
} else {
985+
IGC_ASSERT_MESSAGE(alignment == 0, "Only expect a nonzero alignment for slm ptr now");
986+
}
979987
return arg;
980988
}
981989

IGC/ZEBinWriter/zebin/source/ZEELFObjectBuilder.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,8 @@ class ZEInfoBuilder {
411411
int32_t arg_index,
412412
PreDefinedAttrGetter::ArgAddrMode addrmode,
413413
PreDefinedAttrGetter::ArgAddrSpace addrspace,
414-
PreDefinedAttrGetter::ArgAccessType access_type);
414+
PreDefinedAttrGetter::ArgAccessType access_type,
415+
int32_t alignment = 0);
415416

416417
// addPayloadArgumentByValue - add explicit kernel argument with pass by
417418
// value type into given arg_list

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ struct zeInfoPayloadArgument
6161
{
6262
bool operator==(const zeInfoPayloadArgument& other) const
6363
{
64-
return arg_type == other.arg_type && offset == other.offset && size == other.size && arg_index == other.arg_index && addrmode == other.addrmode && addrspace == other.addrspace && access_type == other.access_type && sampler_index == other.sampler_index && source_offset == other.source_offset;
64+
return arg_type == other.arg_type && offset == other.offset && size == other.size && arg_index == other.arg_index && addrmode == other.addrmode && addrspace == other.addrspace && access_type == other.access_type && sampler_index == other.sampler_index && source_offset == other.source_offset && slm_alignment == other.slm_alignment;
6565
}
6666
zeinfo_str_t arg_type;
6767
zeinfo_int32_t offset = 0;
@@ -72,6 +72,7 @@ struct zeInfoPayloadArgument
7272
zeinfo_str_t access_type;
7373
zeinfo_int32_t sampler_index = -1;
7474
zeinfo_int32_t source_offset = -1;
75+
zeinfo_int32_t slm_alignment = 0;
7576
};
7677
struct zeInfoPerThreadPayloadArgument
7778
{
@@ -175,7 +176,7 @@ struct zeInfoContainer
175176
HostAccessesTy global_host_access_table;
176177
};
177178
struct PreDefinedAttrGetter{
178-
static zeinfo_str_t getVersionNumber() { return "1.13"; }
179+
static zeinfo_str_t getVersionNumber() { return "1.14"; }
179180

180181
enum class ArgThreadSchedulingMode {
181182
age_based,

IGC/ZEBinWriter/zebin/source/autogen/ZEInfoYAML.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ void MappingTraits<zeInfoPayloadArgument>::mapping(IO& io, zeInfoPayloadArgument
7878
io.mapOptional("access_type", info.access_type, std::string());
7979
io.mapOptional("sampler_index", info.sampler_index, -1);
8080
io.mapOptional("source_offset", info.source_offset, -1);
81+
io.mapOptional("slm_alignment", info.slm_alignment, 0);
8182
}
8283
void MappingTraits<zeInfoPerThreadPayloadArgument>::mapping(IO& io, zeInfoPerThreadPayloadArgument& info)
8384
{

IGC/ZEBinWriter/zebin/spec/zeinfo.md

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

99
# ZE Info
10-
Version 1.13
10+
Version 1.14
1111

1212
## Grammar
1313

@@ -149,6 +149,7 @@ If an attribute is **Required**, it must be present in payload arguments. If it'
149149
| access_type | <access_type> | Optional | | Present when arg_type is "arg_bypointer" |
150150
| sampler_index | int32 | Optional | -1 | Present when arg_type is "arg_bypointer" and address_space is "sampler" |
151151
| source_offset | int32 | Optional | -1 | Present when arg_type is "arg_byvalue" and the arg is a flattened aggregate element |
152+
| slm_alignment | int32 | Optional | 0 | Present when arg_type is "arg_bypointer", addrmode is "slm" and address_space is "local" |
152153
<!--- PayloadArgument PayloadArguments -->
153154

154155
### Supported argument types:
@@ -299,6 +300,7 @@ Format: \<_Major number_\>.\<_Minor number_\>
299300
- Minor number: Increase when backward-compatible features are added. For example, add new attributes.
300301

301302
## Change Note
303+
- **Version 1.14**: Add slm_alignment to payload argument.
302304
- **Version 1.13**: Add functions with the name and execution env.
303305
- **Version 1.12**: Add global_host_access_table to container.
304306
- **Version 1.11**: Add require_disable_eufusion attribute.

0 commit comments

Comments
 (0)