Skip to content

Commit 447c40c

Browse files
Fix generating localIDs in zebin
This commit fixes generating localIDs in zebin. With thix fix, Emit Local in compute walker will be set accordingly with the size of local_id argtype (currently, Emit Local is set to Emit None, which prevents generating local IDs). Related-To: NEO-6089 Signed-off-by: Kacper Nowak <[email protected]>
1 parent 48fd1f2 commit 447c40c

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

shared/source/device_binary_format/zebin_decoder.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,9 @@ NEO::DecodeError populateArgDescriptor(const NEO::Elf::ZebinKernelMetadata::Type
687687
dst.kernelAttributes.numLocalIdChannels = static_cast<uint8_t>(tupleSize);
688688
break;
689689
}
690+
dst.kernelAttributes.localId[0] = tupleSize > 0;
691+
dst.kernelAttributes.localId[1] = tupleSize > 1;
692+
dst.kernelAttributes.localId[2] = tupleSize > 2;
690693
dst.kernelAttributes.perThreadDataSize = dst.kernelAttributes.simdSize;
691694
dst.kernelAttributes.perThreadDataSize *= sizeof(LocalIdT);
692695
dst.kernelAttributes.perThreadDataSize = alignUp(dst.kernelAttributes.perThreadDataSize, grfSize);
@@ -711,6 +714,9 @@ NEO::DecodeError populateArgDescriptor(const NEO::Elf::ZebinKernelMetadata::Type
711714
dst.kernelAttributes.numLocalIdChannels = static_cast<uint8_t>(tupleSize);
712715
break;
713716
}
717+
dst.kernelAttributes.localId[0] = tupleSize > 0;
718+
dst.kernelAttributes.localId[1] = tupleSize > 1;
719+
dst.kernelAttributes.localId[2] = tupleSize > 2;
714720
dst.kernelAttributes.simdSize = 1;
715721
dst.kernelAttributes.perThreadDataSize = dst.kernelAttributes.simdSize;
716722
dst.kernelAttributes.perThreadDataSize *= dst.kernelAttributes.numLocalIdChannels;

shared/test/unit_test/device_binary_format/zebin_decoder_tests.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3808,7 +3808,7 @@ TEST(PopulateArgDescriptorPerThreadPayload, GivenArgTypeLocalIdWhenSizeIsInvalid
38083808
EXPECT_TRUE(warnings.empty()) << warnings;
38093809
}
38103810

3811-
TEST(PopulateArgDescriptorPerThreadPayload, GivenArgTypeLocalIdWhenSizeIsValidThenCalculateNumChannelAccordingly) {
3811+
TEST(PopulateArgDescriptorPerThreadPayload, GivenArgTypeLocalIdWhenSizeIsValidThenCalculateNumChannelAndSetEmitLocalIdAccordingly) {
38123812
uint32_t simdSizes[] = {8, 16, 32};
38133813
uint32_t numChannelsOpts[] = {1, 2, 3};
38143814

@@ -3849,6 +3849,11 @@ TEST(PopulateArgDescriptorPerThreadPayload, GivenArgTypeLocalIdWhenSizeIsValidTh
38493849
ASSERT_EQ(1U, programInfo.kernelInfos.size());
38503850
EXPECT_EQ(numChannels, programInfo.kernelInfos[0]->kernelDescriptor.kernelAttributes.numLocalIdChannels) << warnings << "simd : " << simdSize << ", num channels : " << numChannels;
38513851
EXPECT_EQ(simdSize, programInfo.kernelInfos[0]->kernelDescriptor.kernelAttributes.simdSize) << warnings << "simd : " << simdSize << ", num channels : " << numChannels;
3852+
3853+
const auto &emitLocalId = programInfo.kernelInfos[0]->kernelDescriptor.kernelAttributes.localId;
3854+
EXPECT_EQ(static_cast<uint8_t>(numChannels > 0), emitLocalId[0]);
3855+
EXPECT_EQ(static_cast<uint8_t>(numChannels > 1), emitLocalId[1]);
3856+
EXPECT_EQ(static_cast<uint8_t>(numChannels > 2), emitLocalId[2]);
38523857
}
38533858
}
38543859
}
@@ -3919,7 +3924,7 @@ TEST(PopulateArgDescriptorPerThreadPayload, GivenArgTypePackedLocalIdWhenSizeIsI
39193924
EXPECT_TRUE(warnings.empty()) << warnings;
39203925
}
39213926

3922-
TEST(PopulateArgDescriptorPerThreadPayload, GivenArgTypePackedLocalIdWhenSizeIsValidThenCalculateNumChannelAccordingly) {
3927+
TEST(PopulateArgDescriptorPerThreadPayload, GivenArgTypePackedLocalIdWhenSizeIsValidThenCalculateNumChannelAndSetEmitLocalIdAccordingly) {
39233928
uint32_t simdSizes[] = {1};
39243929
uint32_t numChannelsOpts[] = {1, 2, 3};
39253930

@@ -3960,6 +3965,11 @@ TEST(PopulateArgDescriptorPerThreadPayload, GivenArgTypePackedLocalIdWhenSizeIsV
39603965
ASSERT_EQ(1U, programInfo.kernelInfos.size());
39613966
EXPECT_EQ(numChannels, programInfo.kernelInfos[0]->kernelDescriptor.kernelAttributes.numLocalIdChannels) << warnings << "simd : " << simdSize << ", num channels : " << numChannels;
39623967
EXPECT_EQ(simdSize, programInfo.kernelInfos[0]->kernelDescriptor.kernelAttributes.simdSize) << warnings << "simd : " << simdSize << ", num channels : " << numChannels;
3968+
3969+
const auto &emitLocalId = programInfo.kernelInfos[0]->kernelDescriptor.kernelAttributes.localId;
3970+
EXPECT_EQ(static_cast<uint8_t>(numChannels > 0), emitLocalId[0]);
3971+
EXPECT_EQ(static_cast<uint8_t>(numChannels > 1), emitLocalId[1]);
3972+
EXPECT_EQ(static_cast<uint8_t>(numChannels > 2), emitLocalId[2]);
39633973
}
39643974
}
39653975
}
@@ -5099,4 +5109,4 @@ TEST_F(IntelGTNotesFixture, WhenValidatingTargetDeviceGivenValidTargetDeviceAndI
50995109
ASSERT_TRUE(outErrReason.empty());
51005110

51015111
EXPECT_FALSE(validateTargetDevice(elf, targetDevice));
5102-
}
5112+
}

0 commit comments

Comments
 (0)