Skip to content

Commit 9a5fda5

Browse files
JaroszPiotrigcbot
authored andcommitted
Fix HW GlobalData alignment
Alignmet of HW GlobalData data should be 64 bytes. Add 8 bytes to the padding.
1 parent b859709 commit 9a5fda5

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

IGC/AdaptorCommon/RayTracing/API/RayDispatchGlobalData.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ struct RayDispatchGlobalData
234234
} rt_data_info;
235235
// In addition to the dword of padding to align `common`, we also
236236
// add 8 dwords so Xe and Xe3 both have the same RTGlobals size.
237-
uint32_t paddingBits[1+6]; // padding
237+
uint32_t paddingBits[1+8]; // padding
238238

239239
// HW doesn't read anything below this point.
240240
RayDispatchGlobalDataCommon common;
@@ -286,7 +286,7 @@ struct RayDispatchGlobalData
286286
uint32_t pad_mbz : 31;
287287
uint64_t hitGroupBasePtr; // base pointer of hit group shader record array (16-bytes alignment)
288288
uint64_t missShaderBasePtr; // base pointer of miss shader record array (8-bytes alignment)
289-
uint32_t _align_mbz[2]; // pad hardware section to 64 bytes
289+
uint32_t _align_mbz[4]; // pad hardware section to 64 bytes
290290

291291
// HW doesn't read anything below this point.
292292
RayDispatchGlobalDataCommon common;
@@ -303,7 +303,10 @@ constexpr uint32_t RTGlobalsAlign = 256;
303303
constexpr uint32_t RTStackAlign = 128;
304304
static_assert(RTStackAlign % RayDispatchGlobalData::StackChunkSize == 0, "no?");
305305

306-
static_assert(sizeof(RayDispatchGlobalData) == 184, "unexpected size?");
306+
static_assert((sizeof(RayDispatchGlobalData::RT::Xe) - sizeof(RayDispatchGlobalData::RayDispatchGlobalDataCommon)) % 64 == 0, "Unexpected GlobalData alignment");
307+
static_assert((sizeof(RayDispatchGlobalData::RT::Xe3) - sizeof(RayDispatchGlobalData::RayDispatchGlobalDataCommon)) % 64 == 0, "Unexpected GlobalData alignment");
308+
309+
static_assert(sizeof(RayDispatchGlobalData) == 192, "unexpected size?");
307310
static_assert(sizeof(RayDispatchGlobalData::RT::Xe) == sizeof(RayDispatchGlobalData), "unexpected size?");
308311
static_assert(sizeof(RayDispatchGlobalData::RT::Xe3) == sizeof(RayDispatchGlobalData), "unexpected size?");
309312
static_assert(offsetof(RayDispatchGlobalData::RT::Xe, common) == offsetof(RayDispatchGlobalData::RT::Xe3, common), "unexpected size?");

IGC/AdaptorCommon/RayTracing/AutoGenRTStackAccessPrivateOS.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ static Type* _struct_IGC__RayDispatchGlobalData__RT__Xe(Module &M)
488488
[&] {
489489
auto *EltTy =
490490
IntegerType::get(M.getContext(), 32);
491-
return ArrayType::get(EltTy, 7);
491+
return ArrayType::get(EltTy, 9);
492492
}(),
493493
_struct_IGC__RayDispatchGlobalData__RayDispatchGlobalDataCommon(M),
494494
};

0 commit comments

Comments
 (0)