@@ -3650,7 +3650,7 @@ namespace IGC
3650
3650
{
3651
3651
CodeGenContext* context = m_program->GetContext ();
3652
3652
bool isOptDisabled = context->getModuleMetaData ()->compOpt .OptDisable ;
3653
- typedef std::unique_ptr< char , std::function<void (char *)>> param_uptr ;
3653
+ using param_uptr = std::unique_ptr<char , std::function<void (char *)>>;
3654
3654
auto literal_deleter = [](char * val) {};
3655
3655
auto dup_deleter = [](char * val) {free (val); };
3656
3656
// create vbuilder->Compile() params
@@ -3702,30 +3702,26 @@ namespace IGC
3702
3702
}
3703
3703
}
3704
3704
if (IGC_IS_FLAG_DISABLED (ForceDisableShaderDebugHashCodeInKernel) &&
3705
- (context->m_DriverInfo .EnableShaderDebugHashCodeInKernel () ||
3706
- IGC_IS_FLAG_ENABLED (ShaderDebugHashCodeInKernel)))
3707
- {
3708
- QWORD AssemblyHash = { 0 };
3709
- AssemblyHash = context->hash .getAsmHash ();
3710
- params.push_back (param_uptr (" -hashmovs" , literal_deleter));
3711
- std::string Low = std::to_string ((DWORD)AssemblyHash);
3712
- std::string High = std::to_string ((DWORD)(AssemblyHash >> 32 ));
3713
- params.push_back (param_uptr (_strdup (Low.c_str ()), dup_deleter));
3714
- params.push_back (param_uptr (_strdup (High.c_str ()), dup_deleter));
3715
-
3716
- QWORD NosHash = { 0 };
3717
- NosHash = context->hash .getNosHash ();
3718
- QWORD PsoHash = { 0 };
3719
- PsoHash = context->hash .getPsoHash ();
3720
- QWORD hashToUse = NosHash != 0 ? NosHash : PsoHash;
3721
- if (hashToUse)
3705
+ (context->m_DriverInfo .EnableShaderDebugHashCodeInKernel () ||
3706
+ IGC_IS_FLAG_ENABLED (ShaderDebugHashCodeInKernel)))
3707
+ {
3708
+ auto addHash = [&](char * OptName, QWORD Hash)
3722
3709
{
3723
- params.push_back (param_uptr (" -hashmovs1 " , literal_deleter));
3724
- std::string Low = std::to_string ((DWORD)hashToUse );
3725
- std::string High = std::to_string ((DWORD)(hashToUse >> 32 ));
3710
+ params.push_back (param_uptr (OptName , literal_deleter));
3711
+ std::string Low = std::to_string ((DWORD)Hash );
3712
+ std::string High = std::to_string ((DWORD)(Hash >> 32 ));
3726
3713
params.push_back (param_uptr (_strdup (Low.c_str ()), dup_deleter));
3727
3714
params.push_back (param_uptr (_strdup (High.c_str ()), dup_deleter));
3728
- }
3715
+ };
3716
+
3717
+ QWORD AssemblyHash = context->hash .getAsmHash ();
3718
+ addHash (" -hashmovs" , AssemblyHash);
3719
+
3720
+ QWORD NosHash = context->hash .getNosHash ();
3721
+ QWORD PsoHash = context->hash .getPsoHash ();
3722
+ QWORD hashToUse = NosHash != 0 ? NosHash : PsoHash;
3723
+ if (hashToUse)
3724
+ addHash (" -hashmovs1" , hashToUse);
3729
3725
}
3730
3726
}
3731
3727
void CEncoder::InitVISABuilderOptions (TARGET_PLATFORM VISAPlatform, bool canAbortOnSpill, bool hasStackCall, bool enableVISA_IR)
0 commit comments