Skip to content

Commit a97afef

Browse files
author
Brox Chen
authored
[SYCL] Update a few SPIRV values in compileTimeProperties (#8699)
Correct a few values in compileTimeProperties according to SPIRV specs. And skip collecting sycl-alignment to SPIRV.ParamDecoration metadata
1 parent cfcba11 commit a97afef

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

llvm/lib/SYCLLowerIR/CompileTimeProperties.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ SYCL_COMPILE_TIME_PROPERTY("sycl-dwidth", 6178, DecorValueTy::uint32)
2727
SYCL_COMPILE_TIME_PROPERTY("sycl-latency", 6179, DecorValueTy::uint32)
2828
SYCL_COMPILE_TIME_PROPERTY("sycl-read-write-mode", 6180, DecorValueTy::uint32)
2929
SYCL_COMPILE_TIME_PROPERTY("sycl-maxburst", 6181, DecorValueTy::uint32)
30-
SYCL_COMPILE_TIME_PROPERTY("sycl-alignment", 6182, DecorValueTy::uint32)
31-
SYCL_COMPILE_TIME_PROPERTY("sycl-wait-request", 6183, DecorValueTy::uint32)
32-
SYCL_COMPILE_TIME_PROPERTY("sycl-stable", 6184, DecorValueTy::boolean)
30+
SYCL_COMPILE_TIME_PROPERTY("sycl-alignment", 44, DecorValueTy::uint32)
31+
SYCL_COMPILE_TIME_PROPERTY("sycl-wait-request", 6182, DecorValueTy::uint32)
32+
SYCL_COMPILE_TIME_PROPERTY("sycl-stable", 6183, DecorValueTy::boolean)
3333
SYCL_COMPILE_TIME_PROPERTY("sycl-strict", 19, DecorValueTy::boolean)

llvm/lib/SYCLLowerIR/CompileTimePropertiesPass.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ PreservedAnalyses CompileTimePropertiesPass::run(Module &M,
337337
if (F.getCallingConv() != CallingConv::SPIR_KERNEL)
338338
continue;
339339

340+
// Compile time properties on kernel arguments
340341
{
341342
SmallVector<Metadata *, 8> MDOps;
342343
MDOps.reserve(F.arg_size());
@@ -345,8 +346,12 @@ PreservedAnalyses CompileTimePropertiesPass::run(Module &M,
345346
SmallVector<Metadata *, 8> MDArgOps;
346347
for (auto &Attribute : F.getAttributes().getParamAttrs(I)) {
347348
if (MDNode *SPIRVMetadata =
348-
attributeToDecorateMetadata(Ctx, Attribute))
349+
attributeToDecorateMetadata(Ctx, Attribute)) {
350+
// sycl-alignment is not collected to SPIRV.ParamDecoration
351+
if (Attribute.getKindAsString() == "sycl-alignment")
352+
continue;
349353
MDArgOps.push_back(SPIRVMetadata);
354+
}
350355
}
351356
if (!MDArgOps.empty())
352357
FoundKernelProperties = true;

llvm/test/tools/sycl-post-link/sycl-kernel-arg-annotations.ll

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ entry:
2929
!1587 = !{i32 -1}
3030
!1588 = !{i32 -1, i32 -1, i32 -1}
3131
; CHECK-DAG: ![[PARMDECOR_CASE1]] = !{![[ARG:[0-9]+]]}
32-
; CHECK-DAG: ![[ARG]] = !{![[ALIGN:[0-9]+]], ![[AWIDTH:[0-9]+]], ![[BL:[0-9]+]], ![[CONDUIT:[0-9]+]], ![[DWIDTH:[0-9]+]], ![[LATENCY:[0-9]+]], ![[MAXBURST:[0-9]+]], ![[RWMODE:[0-9]+]], ![[REGMAP:[0-9]+]], ![[STABLE:[0-9]+]], ![[STRICT:[0-9]+]], ![[WAITREQ:[0-9]+]]}
32+
; CHECK-DAG: ![[ARG]] = !{![[AWIDTH:[0-9]+]], ![[BL:[0-9]+]], ![[CONDUIT:[0-9]+]], ![[DWIDTH:[0-9]+]], ![[LATENCY:[0-9]+]], ![[MAXBURST:[0-9]+]], ![[RWMODE:[0-9]+]], ![[REGMAP:[0-9]+]], ![[STABLE:[0-9]+]], ![[STRICT:[0-9]+]], ![[WAITREQ:[0-9]+]]}
3333

34-
; CHECK: ![[ALIGN]] = !{i32 6182, i32 4}
3534
; CHECK: ![[AWIDTH]] = !{i32 6177, i32 32}
3635
; CHECK: ![[BL]] = !{i32 5921, i32 10}
3736
; CHECK: ![[CONDUIT]] = !{i32 6175, i32 1}
@@ -40,13 +39,11 @@ entry:
4039
; CHECK: ![[MAXBURST]] = !{i32 6181, i32 3}
4140
; CHECK: ![[RWMODE]] = !{i32 6180, i32 2}
4241
; CHECK: ![[REGMAP]] = !{i32 6176, i32 1}
43-
; CHECK: ![[STABLE]] = !{i32 6184, i32 1}
42+
; CHECK: ![[STABLE]] = !{i32 6183, i32 1}
4443
; CHECK: ![[STRICT]] = !{i32 19, i32 1}
45-
; CHECK: ![[WAITREQ]] = !{i32 6183, i32 5}
44+
; CHECK: ![[WAITREQ]] = !{i32 6182, i32 5}
4645

47-
; CHECK-DAG: ![[PARMDECOR_CASE2]] = !{![[ARG1:[0-9]+]], ![[ARG2:[0-9]+]], ![[ARG3:[0-9]+]]}
48-
; CHECK-DAG: ![[ARG1]] = !{![[ALIGN1:[0-9]+]]}
49-
; CHECK: ![[ALIGN1]] = !{i32 6182, i32 8}
50-
; CHECK-DAG: ![[ARG2]] = !{}
46+
; CHECK-DAG: ![[PARMDECOR_CASE2]] = !{![[ARG1:[0-9]+]], ![[ARG1:[0-9]+]], ![[ARG3:[0-9]+]]}
47+
; CHECK-DAG: ![[ARG1]] = !{}
5148
; CHECK-DAG: ![[ARG3]] = !{![[AWIDTH3:[0-9]+]]}
5249
; CHECK: ![[AWIDTH3]] = !{i32 6177, i32 64}

0 commit comments

Comments
 (0)