@@ -342,7 +342,7 @@ void CGen8OpenCLStateProcessor::CreateProgramScopePatchStream(const IGC::SOpenCL
342342 ICBE_DPF_STR (output, GFXDBG_HARDWARE, " ** Program Scope patch lists **\n " );
343343 ICBE_DPF_STR (output, GFXDBG_HARDWARE, " \n " );
344344
345- for (auto &iter : annotations.m_initConstantAnnotation )
345+ for (const auto &iter : annotations.m_initConstantAnnotation )
346346 {
347347 iOpenCL::SPatchAllocateConstantMemorySurfaceProgramBinaryInfo patch;
348348 memset ( &patch, 0 , sizeof ( patch ) );
@@ -363,7 +363,7 @@ void CGen8OpenCLStateProcessor::CreateProgramScopePatchStream(const IGC::SOpenCL
363363 membuf.AddPadding (zeroPadding);
364364 }
365365
366- for (auto & iter : annotations.m_initGlobalAnnotation )
366+ for (const auto & iter : annotations.m_initGlobalAnnotation )
367367 {
368368 iOpenCL::SPatchAllocateGlobalMemorySurfaceProgramBinaryInfo patch;
369369 memset ( &patch, 0 , sizeof ( patch ) );
@@ -386,7 +386,7 @@ void CGen8OpenCLStateProcessor::CreateProgramScopePatchStream(const IGC::SOpenCL
386386 }
387387
388388
389- for (auto & iter : annotations.m_initKernelTypeAnnotation )
389+ for (const auto & iter : annotations.m_initKernelTypeAnnotation )
390390 {
391391 iOpenCL::SPatchKernelTypeProgramBinaryInfo patch;
392392
@@ -405,7 +405,7 @@ void CGen8OpenCLStateProcessor::CreateProgramScopePatchStream(const IGC::SOpenCL
405405 iter->KernelName .size ());
406406 }
407407
408- for (auto & iter : annotations.m_initGlobalPointerAnnotation )
408+ for (const auto & iter : annotations.m_initGlobalPointerAnnotation )
409409 {
410410 iOpenCL::SPatchGlobalPointerProgramBinaryInfo patch;
411411 memset ( &patch, 0 , sizeof ( patch ) );
@@ -423,7 +423,7 @@ void CGen8OpenCLStateProcessor::CreateProgramScopePatchStream(const IGC::SOpenCL
423423 membuf );
424424 }
425425
426- for (auto & iter : annotations.m_initConstantPointerAnnotation )
426+ for (const auto & iter : annotations.m_initConstantPointerAnnotation )
427427 {
428428 iOpenCL::SPatchConstantPointerProgramBinaryInfo patch;
429429 memset ( &patch, 0 , sizeof ( patch ) );
@@ -613,9 +613,8 @@ RETVAL CGen8OpenCLStateProcessor::CreateSurfaceStateHeap(
613613 }
614614
615615 // Now, add the constant buffer, if present.
616- for ( auto iter : annotations.m_pointerInput )
616+ for ( const auto & annotation : annotations.m_pointerInput )
617617 {
618- PointerInputAnnotation* annotation = iter;
619618 unsigned int bti = annotations.m_argIndexMap .at (annotation->ArgumentNumber );
620619 context.Surface .SurfaceOffset [ bti ] = (DWORD)membuf.Size ();
621620
@@ -629,9 +628,8 @@ RETVAL CGen8OpenCLStateProcessor::CreateSurfaceStateHeap(
629628 false )));
630629 }
631630
632- for ( auto iter : annotations.m_pointerArgument )
631+ for ( const auto & annotation : annotations.m_pointerArgument )
633632 {
634- PointerArgumentAnnotation* annotation = iter;
635633 unsigned int bti = annotations.m_argIndexMap .at (annotation->ArgumentNumber );
636634 context.Surface .SurfaceOffset [bti] = (DWORD)membuf.Size ();
637635
@@ -646,9 +644,8 @@ RETVAL CGen8OpenCLStateProcessor::CreateSurfaceStateHeap(
646644 }
647645
648646 // Images
649- for ( auto i : annotations.m_imageInputAnnotations )
647+ for ( const auto & annotation : annotations.m_imageInputAnnotations )
650648 {
651- ImageArgumentAnnotation* annotation = i;
652649
653650 if ( annotation->IsFixedBindingTableIndex )
654651 {
@@ -805,7 +802,7 @@ RETVAL CGen8OpenCLStateProcessor::CreateSurfaceStateHeap(
805802
806803 // Fill up the SSH with BTI offsets increasing. The runtime currently
807804 // expects this format.
808- for (auto & kv : SurfaceStates)
805+ for (const auto & kv : SurfaceStates)
809806 {
810807 const unsigned bti = kv.first ;
811808 const SurfaceState &state = kv.second ;
@@ -897,7 +894,7 @@ RETVAL CGen8OpenCLStateProcessor::CreateDynamicStateHeap(
897894 // Indirect states for inline samplers:
898895 for (DWORD i = 0 ; i < numInlineSamplers && retValue.Success ; i++)
899896 {
900- const SamplerInputAnnotation* samplerAnnotation = annotations.m_samplerInput [i];
897+ const auto & samplerAnnotation = annotations.m_samplerInput [i];
901898
902899 G6HWC::SGfxSamplerIndirectState bcState = G6HWC::g_cInitGfxSamplerIndirectState;
903900 bcState.BorderColorRed = samplerAnnotation->BorderColorR ;
@@ -932,12 +929,9 @@ RETVAL CGen8OpenCLStateProcessor::CreateDynamicStateHeap(
932929 DWORD borderColorStep = m_Context.hasProgrammableBorderColor () ? 1 : 0 ;
933930
934931 // First handle the sampler arguments
935- for (auto i = annotations.m_samplerArgument .begin ();
936- i != annotations.m_samplerArgument .end ();
937- ++i, borderColorIndex += borderColorStep)
932+ for (const auto & samplerAnnotation : annotations.m_samplerArgument )
938933 {
939- const SamplerArgumentAnnotation* samplerAnnotation = *i;
940-
934+ borderColorIndex += borderColorStep;
941935 context.Dynamic .SamplerOffset [samplerAnnotation->SamplerTableIndex ] = (DWORD)membuf.Size ();
942936
943937 // No need for sampler state for VME and VA...
@@ -994,12 +988,9 @@ RETVAL CGen8OpenCLStateProcessor::CreateDynamicStateHeap(
994988 IGC_ASSERT (!m_Context.hasProgrammableBorderColor () || borderColorIndex == numArgumentSamplers);
995989
996990 // And then the inline samplers
997- for (auto i = annotations.m_samplerInput .begin ();
998- i != annotations.m_samplerInput .end ();
999- ++i, borderColorIndex += borderColorStep)
991+ for (const auto & samplerAnnotation : annotations.m_samplerInput )
1000992 {
1001- const SamplerInputAnnotation* samplerAnnotation = *i;
1002-
993+ borderColorIndex += borderColorStep;
1003994 context.Dynamic .SamplerOffset [samplerAnnotation->SamplerTableIndex ] = (DWORD)membuf.Size ( );
1004995
1005996 IGC_ASSERT (samplerAnnotation->SamplerType == SAMPLER_OBJECT_TEXTURE);
@@ -1281,12 +1272,8 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
12811272
12821273 if ( retValue.Success )
12831274 {
1284- for ( SamplerArgumentIterator i = annotations.m_samplerArgument .begin ();
1285- i != annotations.m_samplerArgument .end ();
1286- ++i )
1275+ for (const auto & samplerAnnotation : annotations.m_samplerArgument )
12871276 {
1288- SamplerArgumentAnnotation* samplerAnnotation = *i;
1289-
12901277 iOpenCL::SPatchSamplerKernelArgument patch;
12911278 memset ( &patch, 0 , sizeof ( patch ) );
12921279
@@ -1361,12 +1348,8 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
13611348 {
13621349 bool transformable = InlineSamplersAllow3DImageTransformation (annotations);
13631350
1364- for (ImageArgumentIterator i = annotations.m_imageInputAnnotations .begin ();
1365- i != annotations.m_imageInputAnnotations .end ();
1366- ++i )
1351+ for (const auto & imageInput : annotations.m_imageInputAnnotations )
13671352 {
1368- ImageArgumentAnnotation* imageInput = *i;
1369-
13701353 iOpenCL::SPatchImageMemoryObjectKernelArgument patch;
13711354
13721355 memset ( &patch, 0 , sizeof ( patch ) );
@@ -1451,12 +1434,8 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
14511434 // Patch information for variable TGSM data parameters:
14521435 if ( retValue.Success )
14531436 {
1454- for ( LocalArgumentIterator i = annotations.m_localPointerArgument .begin ();
1455- i != annotations.m_localPointerArgument .end ();
1456- ++i )
1437+ for (const auto & localArg : annotations.m_localPointerArgument )
14571438 {
1458- LocalArgumentAnnotation* localArg = *i;
1459-
14601439 iOpenCL::SPatchDataParameterBuffer patch;
14611440
14621441 memset ( &patch, 0 , sizeof ( patch ) );
@@ -1487,12 +1466,8 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
14871466 // Constant Input Parameters
14881467 if ( retValue.Success )
14891468 {
1490- for ( ConstantInputIterator i = annotations.m_constantInputAnnotation .begin ();
1491- i != annotations.m_constantInputAnnotation .end ();
1492- ++i )
1469+ for (const auto & constInput : annotations.m_constantInputAnnotation )
14931470 {
1494- ConstantInputAnnotation* constInput = *i;
1495-
14961471 iOpenCL::SPatchDataParameterBuffer patch;
14971472
14981473 memset ( &patch, 0 , sizeof ( patch ) );
@@ -1527,12 +1502,8 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
15271502 // Pointer Kernel Arguments
15281503 if ( retValue.Success )
15291504 {
1530- for ( PointerArgumentIterator i = annotations.m_pointerArgument .begin ();
1531- i != annotations.m_pointerArgument .end ();
1532- ++i )
1505+ for (const auto & ptrArg : annotations.m_pointerArgument )
15331506 {
1534- PointerArgumentAnnotation* ptrArg = *i;
1535-
15361507 if ( ptrArg->IsStateless == true || ptrArg->IsBindlessAccess )
15371508 {
15381509 if ( ptrArg->AddressSpace == KERNEL_ARGUMENT_ADDRESS_SPACE_GLOBAL )
@@ -1632,7 +1603,7 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
16321603 {
16331604 if (annotations.m_printfBufferAnnotation != nullptr )
16341605 {
1635- iOpenCL::PrintfBufferAnnotation * printfBufAnn = annotations.m_printfBufferAnnotation ;
1606+ const auto & printfBufAnn = annotations.m_printfBufferAnnotation ;
16361607
16371608 iOpenCL::SPatchAllocateStatelessPrintfSurface patch;
16381609 memset (&patch, 0 , sizeof (patch));
@@ -1659,7 +1630,7 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
16591630 {
16601631 if (annotations.m_syncBufferAnnotation != nullptr )
16611632 {
1662- iOpenCL::SyncBufferAnnotation* syncBufAnn = annotations.m_syncBufferAnnotation ;
1633+ const auto & syncBufAnn = annotations.m_syncBufferAnnotation ;
16631634
16641635 iOpenCL::SPatchAllocateSyncBuffer patch;
16651636 memset (&patch, 0 , sizeof (patch));
@@ -1683,12 +1654,8 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
16831654 // Pointer inputs with initializer
16841655 if ( retValue.Success )
16851656 {
1686- for ( PointerInputIterator i = annotations.m_pointerInput .begin ();
1687- i != annotations.m_pointerInput .end ();
1688- ++i )
1657+ for (const auto & ptrArg : annotations.m_pointerInput )
16891658 {
1690- PointerInputAnnotation* ptrArg = *i;
1691-
16921659 if ( ptrArg->IsStateless == true )
16931660 {
16941661 if (ptrArg->AddressSpace == iOpenCL::KERNEL_ARGUMENT_ADDRESS_SPACE_CONSTANT)
@@ -1735,26 +1702,25 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
17351702 }
17361703 else if (ptrArg->AddressSpace == iOpenCL::KERNEL_ARGUMENT_ADDRESS_SPACE_PRIVATE)
17371704 {
1738-
17391705 iOpenCL::SPatchAllocateStatelessPrivateSurface patch;
17401706 memset ( &patch, 0 , sizeof ( patch ) );
17411707
1742- PrivateInputAnnotation* ptrArg = static_cast <PrivateInputAnnotation*>(*i );
1743- unsigned int bti = annotations.m_argIndexMap .at (ptrArg ->ArgumentNumber );
1708+ PrivateInputAnnotation* privInput = static_cast <PrivateInputAnnotation*>(ptrArg. get () );
1709+ unsigned int bti = annotations.m_argIndexMap .at (privInput ->ArgumentNumber );
17441710 patch.Token = iOpenCL::PATCH_TOKEN_ALLOCATE_STATELESS_PRIVATE_MEMORY;
17451711 patch.Size = sizeof ( patch );
17461712 patch.SurfaceStateHeapOffset = context.Surface .SurfaceOffset [ bti ];
17471713 // FIXME: IGC currently set PerThreadPrivateMemorySize with size assumed to be per-simt-thread by setting IsSimtThread==1
17481714 patch.IsSimtThread = 1 ;
17491715 patch.PerThreadPrivateMemorySize =
17501716 std::max ((DWORD)IGC_GET_FLAG_VALUE (ForcePerThreadPrivateMemorySize),
1751- ptrArg ->PerThreadPrivateMemorySize );
1752- patch.DataParamOffset = ptrArg ->PayloadPosition ;
1753- patch.DataParamSize = ptrArg ->PayloadSizeInBytes ;
1717+ privInput ->PerThreadPrivateMemorySize );
1718+ patch.DataParamOffset = privInput ->PayloadPosition ;
1719+ patch.DataParamSize = privInput ->PayloadSizeInBytes ;
17541720
17551721 dataParameterStreamSize = std::max (
17561722 dataParameterStreamSize,
1757- ptrArg ->PayloadPosition + ptrArg ->PayloadSizeInBytes );
1723+ privInput ->PayloadPosition + privInput ->PayloadSizeInBytes );
17581724
17591725 retValue = AddPatchItem (
17601726 patch,
@@ -1825,12 +1791,8 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
18251791 // Constant Arguments
18261792 if ( retValue.Success )
18271793 {
1828- for ( ConstantArgumentIterator i = annotations.m_constantArgumentAnnotation .begin ();
1829- i != annotations.m_constantArgumentAnnotation .end ();
1830- ++i )
1794+ for (const auto & constInput : annotations.m_constantArgumentAnnotation )
18311795 {
1832- ConstantArgumentAnnotation* constInput = *i;
1833-
18341796 iOpenCL::SPatchDataParameterBuffer patch;
18351797
18361798 memset ( &patch, 0 , sizeof ( patch ) );
@@ -1861,7 +1823,7 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
18611823 }
18621824 if (retValue.Success && annotations.m_startGAS != NULL )
18631825 {
1864- const iOpenCL::StartGASAnnotation* startGAS = annotations.m_startGAS ;
1826+ const auto & startGAS = annotations.m_startGAS ;
18651827
18661828 iOpenCL::SPatchDataParameterBuffer patch;
18671829 memset (&patch, 0 , sizeof (patch));
@@ -2051,12 +2013,8 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
20512013 // Patch for String Annotations
20522014 if ( retValue.Success )
20532015 {
2054- for ( PrintfStringIterator i = annotations.m_printfStringAnnotations .begin ();
2055- i != annotations.m_printfStringAnnotations .end ();
2056- i++ )
2016+ for (const auto & stringAnn : annotations.m_printfStringAnnotations )
20572017 {
2058- PrintfStringAnnotation *stringAnn = *i;
2059-
20602018 iOpenCL::SPatchString patch;
20612019 memset ( &patch, 0 , sizeof ( patch ) );
20622020
@@ -2348,7 +2306,7 @@ RETVAL CGen8OpenCLStateProcessor::AddKernelAttributePatchItems(
23482306
23492307 std::string filteredAttributes;
23502308
2351- for ( auto & s: tokens )
2309+ for ( const auto & s: tokens)
23522310 {
23532311 for ( int index = 0 ; index < numAllowedAttributes; index++ )
23542312 {
@@ -2393,10 +2351,10 @@ RETVAL CGen8OpenCLStateProcessor::AddKernelArgumentPatchItems(
23932351
23942352 RETVAL retValue = g_cInitRetValue;
23952353
2396- const std::vector<iOpenCL::KernelArgumentInfoAnnotation*> & kernelArgInfo = annotations.m_kernelArgInfo ;
2354+ const auto & kernelArgInfo = annotations.m_kernelArgInfo ;
23972355
23982356 int index = 0 ;
2399- for ( auto argInfo : kernelArgInfo)
2357+ for ( const auto & argInfo : kernelArgInfo)
24002358 {
24012359 iOpenCL::SPatchKernelArgumentInfo patch;
24022360 memset ( &patch, 0 , sizeof ( patch ) );
@@ -2742,9 +2700,8 @@ bool CGen8OpenCLStateProcessor::InlineSamplersAllow3DImageTransformation(const I
27422700 // addressMode == CLAMP_TO_EDGE
27432701 // filter == NEAREST
27442702 // normalizedCoords = false
2745- for (auto i = annotations.m_samplerInput . begin (); i != annotations. m_samplerInput . end (); ++i )
2703+ for (const auto & samplerAnnotation : annotations.m_samplerInput )
27462704 {
2747- const SamplerInputAnnotation* samplerAnnotation = *i;
27482705 if (samplerAnnotation->SamplerType == SAMPLER_OBJECT_TEXTURE)
27492706 {
27502707 if (samplerAnnotation->NormalizedCoords ||
0 commit comments