Skip to content

Commit 549c8bc

Browse files
committed
[SYCL] Update the OFK_SYCL value after 6cfec29 (#29086)
6cfec29 updated OFK_SYCL to be 0x8. We hardcoded in compiler.hpp to avoid include the header, we should update it to 0x8 as well, or else IsNewOffloadEntryType will return wrong value causing SEGV.
1 parent dd2ece6 commit 549c8bc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sycl/source/detail/compiler.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,15 @@ struct _sycl_offload_entry_struct {
118118
inline bool IsNewOffloadEntryType() {
119119
// Assume this is the new version of the struct.
120120
auto newStruct = reinterpret_cast<sycl_offload_entry_new>(this);
121-
121+
// See llvm/include/llvm/Object/OffloadBinary.h
122+
// #define OFK_SYCL (1 << 3)
122123
// Check if first 64 bits is equal to 0, next 16 bits is equal to 1, next 16
123-
// bits is equal to 4 (OK_SYCL), and check if Flags are zero. If all these
124+
// bits is equal to 8 (OFK_SYCL), and check if Flags are zero. If all these
124125
// conditions are met, then this is a newer version of the struct.
125126
// We can not just rely on checking the first 64 bits, because even for the
126127
// older version of the struct, the first 64 bits (void* addr) are zero.
127128
return newStruct->Reserved == 0 && newStruct->Version == 1 &&
128-
newStruct->Kind == 4 && newStruct->Flags == 0;
129+
newStruct->Kind == 8 && newStruct->Flags == 0;
129130
}
130131

131132
// Name is the only field that's used in SYCL.

0 commit comments

Comments
 (0)