Skip to content

Commit 5af044b

Browse files
wpansys_zuul
authored andcommitted
Handle image resources for CM on OCL
Change-Id: I92b1b7877ed1c9aef390310be8c6e15c2256a704
1 parent ed5bb4c commit 5af044b

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

IGC/AdaptorOCL/cmc.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void CMKernel::createConstArgumentAnnotation(unsigned argNo, unsigned sizeInByte
7474
}
7575

7676
// TODO: this is incomplete.
77-
void CMKernel::createSamplerAnnotation(unsigned argNo, unsigned payloadPosition)
77+
void CMKernel::createSamplerAnnotation(unsigned argNo)
7878
{
7979
iOpenCL::SAMPLER_OBJECT_TYPE samplerType;
8080
samplerType = iOpenCL::SAMPLER_OBJECT_TEXTURE;
@@ -88,12 +88,12 @@ void CMKernel::createSamplerAnnotation(unsigned argNo, unsigned payloadPosition)
8888
samplerArg->LocationCount = 0;
8989
samplerArg->IsBindlessAccess = false;
9090
samplerArg->IsEmulationArgument = false;
91-
samplerArg->PayloadPosition = payloadPosition;
91+
samplerArg->PayloadPosition = 0;
9292

9393
m_kernelInfo.m_samplerArgument.push_back(samplerArg);
9494
}
9595

96-
void CMKernel::createImageAnnotation(unsigned argNo, unsigned BTI, unsigned payloadPosition, unsigned dim, bool isWriteable)
96+
void CMKernel::createImageAnnotation(unsigned argNo, unsigned BTI, unsigned dim, bool isWriteable)
9797
{
9898
iOpenCL::ImageArgumentAnnotation* imageInput = new iOpenCL::ImageArgumentAnnotation;
9999

@@ -115,7 +115,7 @@ void CMKernel::createImageAnnotation(unsigned argNo, unsigned BTI, unsigned payl
115115
imageInput->AccessedByFloatCoords = false;
116116
imageInput->AccessedByIntCoords = false;
117117
imageInput->IsBindlessAccess = false;
118-
imageInput->PayloadPosition = payloadPosition;
118+
imageInput->PayloadPosition = 0;
119119
imageInput->Writeable = isWriteable;
120120
m_kernelInfo.m_imageInputAnnotations.push_back(imageInput);
121121
}
@@ -314,7 +314,8 @@ static void generatePatchTokens(const cmc_kernel_info *info, CMKernel& kernel)
314314
kernel.m_kernelInfo.m_argIndexMap.clear();
315315

316316
for (auto &AI : info->arg_descs) {
317-
maxArgEnd = std::max(AI.offset + AI.sizeInBytes, maxArgEnd);
317+
if (AI.offset > 0)
318+
maxArgEnd = std::max(AI.offset + AI.sizeInBytes, maxArgEnd);
318319
bool isWriteable = AI.access != cmc_access_kind::read_only;
319320

320321
switch (AI.kind) {
@@ -332,19 +333,19 @@ static void generatePatchTokens(const cmc_kernel_info *info, CMKernel& kernel)
332333
kernel.createPointerGlobalAnnotation(AI.index, AI.sizeInBytes, AI.offset - constantPayloadStart, -1);
333334
break;
334335
case cmc_arg_kind::Sampler:
335-
kernel.createSamplerAnnotation(AI.index, AI.offset - constantPayloadStart);
336+
kernel.createSamplerAnnotation(AI.index);
336337
kernel.m_kernelInfo.m_argIndexMap[AI.index] = AI.BTI;
337338
break;
338339
case cmc_arg_kind::Image1d:
339-
kernel.createImageAnnotation(AI.index, AI.BTI, AI.offset - constantPayloadStart, 1, isWriteable);
340+
kernel.createImageAnnotation(AI.index, AI.BTI, 1, isWriteable);
340341
kernel.m_kernelInfo.m_argIndexMap[AI.index] = AI.BTI;
341342
break;
342343
case cmc_arg_kind::Image2d:
343-
kernel.createImageAnnotation(AI.index, AI.BTI, AI.offset - constantPayloadStart, 2, isWriteable);
344+
kernel.createImageAnnotation(AI.index, AI.BTI, 2, isWriteable);
344345
kernel.m_kernelInfo.m_argIndexMap[AI.index] = AI.BTI;
345346
break;
346347
case cmc_arg_kind::Image3d:
347-
kernel.createImageAnnotation(AI.index, AI.BTI, AI.offset - constantPayloadStart, 3, isWriteable);
348+
kernel.createImageAnnotation(AI.index, AI.BTI, 3, isWriteable);
348349
kernel.m_kernelInfo.m_argIndexMap[AI.index] = AI.BTI;
349350
break;
350351
}

IGC/AdaptorOCL/cmc.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class CMKernel {
6161
// 1D/2D/3D Surface
6262
void createImageAnnotation(unsigned argNo,
6363
unsigned BTI,
64-
unsigned payloadPosition,
6564
unsigned dim,
6665
bool isWriteable);
6766

@@ -81,7 +80,7 @@ class CMKernel {
8180
void createImplicitArgumentsAnnotation(unsigned payloadPosition);
8281

8382
// Sampler
84-
void createSamplerAnnotation(unsigned argNo, unsigned payloadPosition);
83+
void createSamplerAnnotation(unsigned argNo);
8584

8685
void RecomputeBTLayout(int numUAVs, int numResources);
8786
};

0 commit comments

Comments
 (0)