Skip to content

Commit 301d372

Browse files
pratikasharigcbot
authored andcommitted
Fix -preserver0 option in presence of pre-emption.
Skip -preserver0 option in presence of pre-emption.
1 parent 8612d2e commit 301d372

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4518,6 +4518,7 @@ namespace IGC
45184518
SaveOption(vISA_ActiveThreadsOnlyBarrier, true);
45194519
}
45204520

4521+
bool r0Reserved = false;
45214522
if ((context->type == ShaderType::OPENCL_SHADER || context->type == ShaderType::COMPUTE_SHADER
45224523
|| context->type == ShaderType::RAYTRACING_SHADER) &&
45234524
(m_program->m_Platform->preemptionSupported() || IGC_IS_FLAG_ENABLED(ForcePreemptionWA)) &&
@@ -4541,9 +4542,10 @@ namespace IGC
45414542
{
45424543
SaveOption(vISA_enablePreemption, true);
45434544
}
4545+
r0Reserved = true;
45444546
}
45454547

4546-
if ((context->type == ShaderType::OPENCL_SHADER || context->type == ShaderType::COMPUTE_SHADER) &&
4548+
if (!r0Reserved && (context->type == ShaderType::OPENCL_SHADER || context->type == ShaderType::COMPUTE_SHADER) &&
45474549
(m_program->m_Platform->isProductChildOf(IGFX_PVC) || IGC_IS_FLAG_ENABLED(ForcePreserveR0)))
45484550
{
45494551
// Force VISA to preserve r0 in r0 itself throughout the kernel/stackcall function.

visa/Optimizer.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,12 @@ void Optimizer::accSubBeforeRA() {
843843

844844
bool Optimizer::R0CopyNeeded() {
845845
if (!builder.canReadR0()) {
846+
// If r0 cannot be read then r0 has to be copied
847+
// and cannot be said to be preserved in r0. In
848+
// other words, these 2 are mutually exclusive
849+
// options.
850+
vISA_ASSERT(!kernel.getOption(vISA_PreserveR0InR0),
851+
"opposing options for r0 detected");
846852
return true;
847853
}
848854

0 commit comments

Comments
 (0)