Skip to content

Commit c73f10c

Browse files
Extend multi tile debug flags to state compute mode command
Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
1 parent 8502e72 commit c73f10c

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

shared/source/command_container/command_encoder_xehp_and_later.inl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,16 @@ void EncodeComputeMode<Family>::adjustComputeMode(LinearStream &csr, void *const
542542
maskBits |= Family::stateComputeModeLargeGrfModeMask;
543543
}
544544

545+
if (DebugManager.flags.ForceMultiGpuAtomics.get() != -1) {
546+
stateComputeMode.setForceDisableSupportForMultiGpuAtomics(!!DebugManager.flags.ForceMultiGpuAtomics.get());
547+
maskBits |= Family::stateComputeModeForceDisableSupportMultiGpuAtomics;
548+
}
549+
550+
if (DebugManager.flags.ForceMultiGpuPartialWrites.get() != -1) {
551+
stateComputeMode.setForceDisableSupportForMultiGpuPartialWrites(!!DebugManager.flags.ForceMultiGpuPartialWrites.get());
552+
maskBits |= Family::stateComputeModeForceDisableSupportMultiGpuPartialWrites;
553+
}
554+
545555
stateComputeMode.setMaskBits(maskBits);
546556

547557
auto buffer = csr.getSpaceForCmd<STATE_COMPUTE_MODE>();

shared/source/xe_hp_core/hw_cmds_base.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ struct XeHpCore {
2424

2525
static constexpr uint32_t stateComputeModeForceNonCoherentMask = (0b11u << 3);
2626
static constexpr uint32_t stateComputeModeLargeGrfModeMask = (1u << 15);
27+
static constexpr uint32_t stateComputeModeForceDisableSupportMultiGpuPartialWrites = (1u << 2);
28+
static constexpr uint32_t stateComputeModeForceDisableSupportMultiGpuAtomics = (1u << 1);
2729

2830
static constexpr bool isUsingL3Control = true;
2931

shared/test/common/xe_hp_core/test_encode_xe_hp_core.cpp

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,90 @@ XE_HP_CORE_TEST_F(CommandEncodeXeHpCoreTest, whenProgrammingStateComputeModeThen
5353
EXPECT_TRUE(pScm->getLargeGrfMode());
5454
}
5555

56+
XE_HP_CORE_TEST_F(CommandEncodeXeHpCoreTest, givenForceDisableMultiAtomicsWhenDebugFlagIsZeroThenExpectForceDisableMultiAtomicsSetToFalse) {
57+
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
58+
59+
DebugManagerStateRestore dbgRestorer;
60+
DebugManager.flags.ForceMultiGpuAtomics.set(0);
61+
62+
uint8_t buffer[64]{};
63+
64+
STATE_COMPUTE_MODE scmCommandTemplate = FamilyType::cmdInitStateComputeMode;
65+
scmCommandTemplate.setForceDisableSupportForMultiGpuAtomics(true);
66+
67+
StateComputeModeProperties properties;
68+
LinearStream cmdStream(buffer, sizeof(buffer));
69+
EncodeComputeMode<FamilyType>::adjustComputeMode(cmdStream, &scmCommandTemplate, properties, *defaultHwInfo);
70+
auto scmCommand = reinterpret_cast<STATE_COMPUTE_MODE *>(cmdStream.getCpuBase());
71+
72+
uint32_t expectedMaskBits = FamilyType::stateComputeModeForceDisableSupportMultiGpuAtomics;
73+
EXPECT_EQ(expectedMaskBits, scmCommand->getMaskBits());
74+
EXPECT_FALSE(scmCommand->getForceDisableSupportForMultiGpuAtomics());
75+
}
76+
77+
XE_HP_CORE_TEST_F(CommandEncodeXeHpCoreTest, givenForceDisableMultiAtomicsWhenDebugFlagIsOneThenExpectForceDisableMultiAtomicsSetToTrue) {
78+
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
79+
80+
DebugManagerStateRestore dbgRestorer;
81+
DebugManager.flags.ForceMultiGpuAtomics.set(1);
82+
83+
uint8_t buffer[64]{};
84+
85+
STATE_COMPUTE_MODE scmCommandTemplate = FamilyType::cmdInitStateComputeMode;
86+
scmCommandTemplate.setForceDisableSupportForMultiGpuAtomics(false);
87+
88+
StateComputeModeProperties properties;
89+
LinearStream cmdStream(buffer, sizeof(buffer));
90+
EncodeComputeMode<FamilyType>::adjustComputeMode(cmdStream, &scmCommandTemplate, properties, *defaultHwInfo);
91+
auto scmCommand = reinterpret_cast<STATE_COMPUTE_MODE *>(cmdStream.getCpuBase());
92+
93+
uint32_t expectedMaskBits = FamilyType::stateComputeModeForceDisableSupportMultiGpuAtomics;
94+
EXPECT_EQ(expectedMaskBits, scmCommand->getMaskBits());
95+
EXPECT_TRUE(scmCommand->getForceDisableSupportForMultiGpuAtomics());
96+
}
97+
98+
XE_HP_CORE_TEST_F(CommandEncodeXeHpCoreTest, givenForceDisableMultiPartialWritesWhenDebugFlagIsZeroThenExpectForceDisableMultiPartialWritesSetToFalse) {
99+
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
100+
101+
DebugManagerStateRestore dbgRestorer;
102+
DebugManager.flags.ForceMultiGpuPartialWrites.set(0);
103+
104+
uint8_t buffer[64]{};
105+
106+
STATE_COMPUTE_MODE scmCommandTemplate = FamilyType::cmdInitStateComputeMode;
107+
scmCommandTemplate.setForceDisableSupportForMultiGpuPartialWrites(true);
108+
109+
StateComputeModeProperties properties;
110+
LinearStream cmdStream(buffer, sizeof(buffer));
111+
EncodeComputeMode<FamilyType>::adjustComputeMode(cmdStream, &scmCommandTemplate, properties, *defaultHwInfo);
112+
auto scmCommand = reinterpret_cast<STATE_COMPUTE_MODE *>(cmdStream.getCpuBase());
113+
114+
uint32_t expectedMaskBits = FamilyType::stateComputeModeForceDisableSupportMultiGpuPartialWrites;
115+
EXPECT_EQ(expectedMaskBits, scmCommand->getMaskBits());
116+
EXPECT_FALSE(scmCommand->getForceDisableSupportForMultiGpuAtomics());
117+
}
118+
119+
XE_HP_CORE_TEST_F(CommandEncodeXeHpCoreTest, givenForceDisableMultiPartialWritesWhenDebugFlagIsOneThenExpectForceDisableMultiPartialWritesSetToTrue) {
120+
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
121+
122+
DebugManagerStateRestore dbgRestorer;
123+
DebugManager.flags.ForceMultiGpuPartialWrites.set(1);
124+
125+
uint8_t buffer[64]{};
126+
127+
STATE_COMPUTE_MODE scmCommandTemplate = FamilyType::cmdInitStateComputeMode;
128+
scmCommandTemplate.setForceDisableSupportForMultiGpuPartialWrites(false);
129+
130+
StateComputeModeProperties properties;
131+
LinearStream cmdStream(buffer, sizeof(buffer));
132+
EncodeComputeMode<FamilyType>::adjustComputeMode(cmdStream, &scmCommandTemplate, properties, *defaultHwInfo);
133+
auto scmCommand = reinterpret_cast<STATE_COMPUTE_MODE *>(cmdStream.getCpuBase());
134+
135+
uint32_t expectedMaskBits = FamilyType::stateComputeModeForceDisableSupportMultiGpuPartialWrites;
136+
EXPECT_EQ(expectedMaskBits, scmCommand->getMaskBits());
137+
EXPECT_TRUE(scmCommand->getForceDisableSupportForMultiGpuPartialWrites());
138+
}
139+
56140
struct EncodeKernelGlobalAtomicsFixture : public CommandEncodeStatesFixture, public ::testing::Test {
57141
void SetUp() override {
58142
DebugManager.flags.CreateMultipleSubDevices.set(2);

0 commit comments

Comments
 (0)