@@ -342,7 +342,7 @@ void CGen8OpenCLStateProcessor::CreateProgramScopePatchStream(const IGC::SOpenCL
342
342
ICBE_DPF_STR (output, GFXDBG_HARDWARE, " ** Program Scope patch lists **\n " );
343
343
ICBE_DPF_STR (output, GFXDBG_HARDWARE, " \n " );
344
344
345
- for (auto &iter : annotations.m_initConstantAnnotation )
345
+ for (const auto &iter : annotations.m_initConstantAnnotation )
346
346
{
347
347
iOpenCL::SPatchAllocateConstantMemorySurfaceProgramBinaryInfo patch;
348
348
memset ( &patch, 0 , sizeof ( patch ) );
@@ -363,7 +363,7 @@ void CGen8OpenCLStateProcessor::CreateProgramScopePatchStream(const IGC::SOpenCL
363
363
membuf.AddPadding (zeroPadding);
364
364
}
365
365
366
- for (auto & iter : annotations.m_initGlobalAnnotation )
366
+ for (const auto & iter : annotations.m_initGlobalAnnotation )
367
367
{
368
368
iOpenCL::SPatchAllocateGlobalMemorySurfaceProgramBinaryInfo patch;
369
369
memset ( &patch, 0 , sizeof ( patch ) );
@@ -386,7 +386,7 @@ void CGen8OpenCLStateProcessor::CreateProgramScopePatchStream(const IGC::SOpenCL
386
386
}
387
387
388
388
389
- for (auto & iter : annotations.m_initKernelTypeAnnotation )
389
+ for (const auto & iter : annotations.m_initKernelTypeAnnotation )
390
390
{
391
391
iOpenCL::SPatchKernelTypeProgramBinaryInfo patch;
392
392
@@ -405,7 +405,7 @@ void CGen8OpenCLStateProcessor::CreateProgramScopePatchStream(const IGC::SOpenCL
405
405
iter->KernelName .size ());
406
406
}
407
407
408
- for (auto & iter : annotations.m_initGlobalPointerAnnotation )
408
+ for (const auto & iter : annotations.m_initGlobalPointerAnnotation )
409
409
{
410
410
iOpenCL::SPatchGlobalPointerProgramBinaryInfo patch;
411
411
memset ( &patch, 0 , sizeof ( patch ) );
@@ -423,7 +423,7 @@ void CGen8OpenCLStateProcessor::CreateProgramScopePatchStream(const IGC::SOpenCL
423
423
membuf );
424
424
}
425
425
426
- for (auto & iter : annotations.m_initConstantPointerAnnotation )
426
+ for (const auto & iter : annotations.m_initConstantPointerAnnotation )
427
427
{
428
428
iOpenCL::SPatchConstantPointerProgramBinaryInfo patch;
429
429
memset ( &patch, 0 , sizeof ( patch ) );
@@ -613,9 +613,8 @@ RETVAL CGen8OpenCLStateProcessor::CreateSurfaceStateHeap(
613
613
}
614
614
615
615
// Now, add the constant buffer, if present.
616
- for ( auto iter : annotations.m_pointerInput )
616
+ for ( const auto & annotation : annotations.m_pointerInput )
617
617
{
618
- PointerInputAnnotation* annotation = iter;
619
618
unsigned int bti = annotations.m_argIndexMap .at (annotation->ArgumentNumber );
620
619
context.Surface .SurfaceOffset [ bti ] = (DWORD)membuf.Size ();
621
620
@@ -629,9 +628,8 @@ RETVAL CGen8OpenCLStateProcessor::CreateSurfaceStateHeap(
629
628
false )));
630
629
}
631
630
632
- for ( auto iter : annotations.m_pointerArgument )
631
+ for ( const auto & annotation : annotations.m_pointerArgument )
633
632
{
634
- PointerArgumentAnnotation* annotation = iter;
635
633
unsigned int bti = annotations.m_argIndexMap .at (annotation->ArgumentNumber );
636
634
context.Surface .SurfaceOffset [bti] = (DWORD)membuf.Size ();
637
635
@@ -646,9 +644,8 @@ RETVAL CGen8OpenCLStateProcessor::CreateSurfaceStateHeap(
646
644
}
647
645
648
646
// Images
649
- for ( auto i : annotations.m_imageInputAnnotations )
647
+ for ( const auto & annotation : annotations.m_imageInputAnnotations )
650
648
{
651
- ImageArgumentAnnotation* annotation = i;
652
649
653
650
if ( annotation->IsFixedBindingTableIndex )
654
651
{
@@ -805,7 +802,7 @@ RETVAL CGen8OpenCLStateProcessor::CreateSurfaceStateHeap(
805
802
806
803
// Fill up the SSH with BTI offsets increasing. The runtime currently
807
804
// expects this format.
808
- for (auto & kv : SurfaceStates)
805
+ for (const auto & kv : SurfaceStates)
809
806
{
810
807
const unsigned bti = kv.first ;
811
808
const SurfaceState &state = kv.second ;
@@ -897,7 +894,7 @@ RETVAL CGen8OpenCLStateProcessor::CreateDynamicStateHeap(
897
894
// Indirect states for inline samplers:
898
895
for (DWORD i = 0 ; i < numInlineSamplers && retValue.Success ; i++)
899
896
{
900
- const SamplerInputAnnotation* samplerAnnotation = annotations.m_samplerInput [i];
897
+ const auto & samplerAnnotation = annotations.m_samplerInput [i];
901
898
902
899
G6HWC::SGfxSamplerIndirectState bcState = G6HWC::g_cInitGfxSamplerIndirectState;
903
900
bcState.BorderColorRed = samplerAnnotation->BorderColorR ;
@@ -932,12 +929,9 @@ RETVAL CGen8OpenCLStateProcessor::CreateDynamicStateHeap(
932
929
DWORD borderColorStep = m_Context.hasProgrammableBorderColor () ? 1 : 0 ;
933
930
934
931
// 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 )
938
933
{
939
- const SamplerArgumentAnnotation* samplerAnnotation = *i;
940
-
934
+ borderColorIndex += borderColorStep;
941
935
context.Dynamic .SamplerOffset [samplerAnnotation->SamplerTableIndex ] = (DWORD)membuf.Size ();
942
936
943
937
// No need for sampler state for VME and VA...
@@ -994,12 +988,9 @@ RETVAL CGen8OpenCLStateProcessor::CreateDynamicStateHeap(
994
988
IGC_ASSERT (!m_Context.hasProgrammableBorderColor () || borderColorIndex == numArgumentSamplers);
995
989
996
990
// 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 )
1000
992
{
1001
- const SamplerInputAnnotation* samplerAnnotation = *i;
1002
-
993
+ borderColorIndex += borderColorStep;
1003
994
context.Dynamic .SamplerOffset [samplerAnnotation->SamplerTableIndex ] = (DWORD)membuf.Size ( );
1004
995
1005
996
IGC_ASSERT (samplerAnnotation->SamplerType == SAMPLER_OBJECT_TEXTURE);
@@ -1281,12 +1272,8 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
1281
1272
1282
1273
if ( retValue.Success )
1283
1274
{
1284
- for ( SamplerArgumentIterator i = annotations.m_samplerArgument .begin ();
1285
- i != annotations.m_samplerArgument .end ();
1286
- ++i )
1275
+ for (const auto & samplerAnnotation : annotations.m_samplerArgument )
1287
1276
{
1288
- SamplerArgumentAnnotation* samplerAnnotation = *i;
1289
-
1290
1277
iOpenCL::SPatchSamplerKernelArgument patch;
1291
1278
memset ( &patch, 0 , sizeof ( patch ) );
1292
1279
@@ -1361,12 +1348,8 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
1361
1348
{
1362
1349
bool transformable = InlineSamplersAllow3DImageTransformation (annotations);
1363
1350
1364
- for (ImageArgumentIterator i = annotations.m_imageInputAnnotations .begin ();
1365
- i != annotations.m_imageInputAnnotations .end ();
1366
- ++i )
1351
+ for (const auto & imageInput : annotations.m_imageInputAnnotations )
1367
1352
{
1368
- ImageArgumentAnnotation* imageInput = *i;
1369
-
1370
1353
iOpenCL::SPatchImageMemoryObjectKernelArgument patch;
1371
1354
1372
1355
memset ( &patch, 0 , sizeof ( patch ) );
@@ -1451,12 +1434,8 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
1451
1434
// Patch information for variable TGSM data parameters:
1452
1435
if ( retValue.Success )
1453
1436
{
1454
- for ( LocalArgumentIterator i = annotations.m_localPointerArgument .begin ();
1455
- i != annotations.m_localPointerArgument .end ();
1456
- ++i )
1437
+ for (const auto & localArg : annotations.m_localPointerArgument )
1457
1438
{
1458
- LocalArgumentAnnotation* localArg = *i;
1459
-
1460
1439
iOpenCL::SPatchDataParameterBuffer patch;
1461
1440
1462
1441
memset ( &patch, 0 , sizeof ( patch ) );
@@ -1487,12 +1466,8 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
1487
1466
// Constant Input Parameters
1488
1467
if ( retValue.Success )
1489
1468
{
1490
- for ( ConstantInputIterator i = annotations.m_constantInputAnnotation .begin ();
1491
- i != annotations.m_constantInputAnnotation .end ();
1492
- ++i )
1469
+ for (const auto & constInput : annotations.m_constantInputAnnotation )
1493
1470
{
1494
- ConstantInputAnnotation* constInput = *i;
1495
-
1496
1471
iOpenCL::SPatchDataParameterBuffer patch;
1497
1472
1498
1473
memset ( &patch, 0 , sizeof ( patch ) );
@@ -1527,12 +1502,8 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
1527
1502
// Pointer Kernel Arguments
1528
1503
if ( retValue.Success )
1529
1504
{
1530
- for ( PointerArgumentIterator i = annotations.m_pointerArgument .begin ();
1531
- i != annotations.m_pointerArgument .end ();
1532
- ++i )
1505
+ for (const auto & ptrArg : annotations.m_pointerArgument )
1533
1506
{
1534
- PointerArgumentAnnotation* ptrArg = *i;
1535
-
1536
1507
if ( ptrArg->IsStateless == true || ptrArg->IsBindlessAccess )
1537
1508
{
1538
1509
if ( ptrArg->AddressSpace == KERNEL_ARGUMENT_ADDRESS_SPACE_GLOBAL )
@@ -1632,7 +1603,7 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
1632
1603
{
1633
1604
if (annotations.m_printfBufferAnnotation != nullptr )
1634
1605
{
1635
- iOpenCL::PrintfBufferAnnotation * printfBufAnn = annotations.m_printfBufferAnnotation ;
1606
+ const auto & printfBufAnn = annotations.m_printfBufferAnnotation ;
1636
1607
1637
1608
iOpenCL::SPatchAllocateStatelessPrintfSurface patch;
1638
1609
memset (&patch, 0 , sizeof (patch));
@@ -1659,7 +1630,7 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
1659
1630
{
1660
1631
if (annotations.m_syncBufferAnnotation != nullptr )
1661
1632
{
1662
- iOpenCL::SyncBufferAnnotation* syncBufAnn = annotations.m_syncBufferAnnotation ;
1633
+ const auto & syncBufAnn = annotations.m_syncBufferAnnotation ;
1663
1634
1664
1635
iOpenCL::SPatchAllocateSyncBuffer patch;
1665
1636
memset (&patch, 0 , sizeof (patch));
@@ -1683,12 +1654,8 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
1683
1654
// Pointer inputs with initializer
1684
1655
if ( retValue.Success )
1685
1656
{
1686
- for ( PointerInputIterator i = annotations.m_pointerInput .begin ();
1687
- i != annotations.m_pointerInput .end ();
1688
- ++i )
1657
+ for (const auto & ptrArg : annotations.m_pointerInput )
1689
1658
{
1690
- PointerInputAnnotation* ptrArg = *i;
1691
-
1692
1659
if ( ptrArg->IsStateless == true )
1693
1660
{
1694
1661
if (ptrArg->AddressSpace == iOpenCL::KERNEL_ARGUMENT_ADDRESS_SPACE_CONSTANT)
@@ -1735,26 +1702,25 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
1735
1702
}
1736
1703
else if (ptrArg->AddressSpace == iOpenCL::KERNEL_ARGUMENT_ADDRESS_SPACE_PRIVATE)
1737
1704
{
1738
-
1739
1705
iOpenCL::SPatchAllocateStatelessPrivateSurface patch;
1740
1706
memset ( &patch, 0 , sizeof ( patch ) );
1741
1707
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 );
1744
1710
patch.Token = iOpenCL::PATCH_TOKEN_ALLOCATE_STATELESS_PRIVATE_MEMORY;
1745
1711
patch.Size = sizeof ( patch );
1746
1712
patch.SurfaceStateHeapOffset = context.Surface .SurfaceOffset [ bti ];
1747
1713
// FIXME: IGC currently set PerThreadPrivateMemorySize with size assumed to be per-simt-thread by setting IsSimtThread==1
1748
1714
patch.IsSimtThread = 1 ;
1749
1715
patch.PerThreadPrivateMemorySize =
1750
1716
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 ;
1754
1720
1755
1721
dataParameterStreamSize = std::max (
1756
1722
dataParameterStreamSize,
1757
- ptrArg ->PayloadPosition + ptrArg ->PayloadSizeInBytes );
1723
+ privInput ->PayloadPosition + privInput ->PayloadSizeInBytes );
1758
1724
1759
1725
retValue = AddPatchItem (
1760
1726
patch,
@@ -1825,12 +1791,8 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
1825
1791
// Constant Arguments
1826
1792
if ( retValue.Success )
1827
1793
{
1828
- for ( ConstantArgumentIterator i = annotations.m_constantArgumentAnnotation .begin ();
1829
- i != annotations.m_constantArgumentAnnotation .end ();
1830
- ++i )
1794
+ for (const auto & constInput : annotations.m_constantArgumentAnnotation )
1831
1795
{
1832
- ConstantArgumentAnnotation* constInput = *i;
1833
-
1834
1796
iOpenCL::SPatchDataParameterBuffer patch;
1835
1797
1836
1798
memset ( &patch, 0 , sizeof ( patch ) );
@@ -1861,7 +1823,7 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
1861
1823
}
1862
1824
if (retValue.Success && annotations.m_startGAS != NULL )
1863
1825
{
1864
- const iOpenCL::StartGASAnnotation* startGAS = annotations.m_startGAS ;
1826
+ const auto & startGAS = annotations.m_startGAS ;
1865
1827
1866
1828
iOpenCL::SPatchDataParameterBuffer patch;
1867
1829
memset (&patch, 0 , sizeof (patch));
@@ -2051,12 +2013,8 @@ RETVAL CGen8OpenCLStateProcessor::CreatePatchList(
2051
2013
// Patch for String Annotations
2052
2014
if ( retValue.Success )
2053
2015
{
2054
- for ( PrintfStringIterator i = annotations.m_printfStringAnnotations .begin ();
2055
- i != annotations.m_printfStringAnnotations .end ();
2056
- i++ )
2016
+ for (const auto & stringAnn : annotations.m_printfStringAnnotations )
2057
2017
{
2058
- PrintfStringAnnotation *stringAnn = *i;
2059
-
2060
2018
iOpenCL::SPatchString patch;
2061
2019
memset ( &patch, 0 , sizeof ( patch ) );
2062
2020
@@ -2348,7 +2306,7 @@ RETVAL CGen8OpenCLStateProcessor::AddKernelAttributePatchItems(
2348
2306
2349
2307
std::string filteredAttributes;
2350
2308
2351
- for ( auto & s: tokens )
2309
+ for ( const auto & s: tokens)
2352
2310
{
2353
2311
for ( int index = 0 ; index < numAllowedAttributes; index++ )
2354
2312
{
@@ -2393,10 +2351,10 @@ RETVAL CGen8OpenCLStateProcessor::AddKernelArgumentPatchItems(
2393
2351
2394
2352
RETVAL retValue = g_cInitRetValue;
2395
2353
2396
- const std::vector<iOpenCL::KernelArgumentInfoAnnotation*> & kernelArgInfo = annotations.m_kernelArgInfo ;
2354
+ const auto & kernelArgInfo = annotations.m_kernelArgInfo ;
2397
2355
2398
2356
int index = 0 ;
2399
- for ( auto argInfo : kernelArgInfo)
2357
+ for ( const auto & argInfo : kernelArgInfo)
2400
2358
{
2401
2359
iOpenCL::SPatchKernelArgumentInfo patch;
2402
2360
memset ( &patch, 0 , sizeof ( patch ) );
@@ -2742,9 +2700,8 @@ bool CGen8OpenCLStateProcessor::InlineSamplersAllow3DImageTransformation(const I
2742
2700
// addressMode == CLAMP_TO_EDGE
2743
2701
// filter == NEAREST
2744
2702
// normalizedCoords = false
2745
- for (auto i = annotations.m_samplerInput . begin (); i != annotations. m_samplerInput . end (); ++i )
2703
+ for (const auto & samplerAnnotation : annotations.m_samplerInput )
2746
2704
{
2747
- const SamplerInputAnnotation* samplerAnnotation = *i;
2748
2705
if (samplerAnnotation->SamplerType == SAMPLER_OBJECT_TEXTURE)
2749
2706
{
2750
2707
if (samplerAnnotation->NormalizedCoords ||
0 commit comments