Skip to content

Commit df9531f

Browse files
committed
Address review comments
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
1 parent 61d6ea7 commit df9531f

File tree

10 files changed

+32
-38
lines changed

10 files changed

+32
-38
lines changed

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ void CodeGenModule::Release() {
939939
// Emit metadata for all aspects defined in the aspects enum.
940940
if (AspectsEnumDecl) {
941941
llvm::NamedMDNode *AspectEnumValsMD =
942-
TheModule.getOrInsertNamedMetadata("intel_sycl_aspects");
942+
TheModule.getOrInsertNamedMetadata("sycl_aspects");
943943
for (const EnumConstantDecl *ECD : AspectsEnumDecl->enumerators())
944944
AspectEnumValsMD->addOperand(
945945
getAspectEnumValueMD(Context, TheModule.getContext(), ECD));
Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
1-
// RUN: %clang_cc1 -fsycl-is-device -triple spir64-unknown-unknown -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s
1+
// RUN: %clang_cc1 -internal-isystem %S/Inputs -fsycl-is-device -triple spir64-unknown-unknown -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s
22

33
// Tests for IR of [[__sycl_detail__::sycl_type(aspect)]] enum.
4-
enum class [[__sycl_detail__::sycl_type(aspect)]] aspect {
5-
host = 0,
6-
cpu = 1,
7-
gpu = 2,
8-
accelerator = 3,
9-
custom = 4,
10-
fp16 = 5,
11-
fp64 = 6,
12-
future_aspect = 12
13-
};
4+
#include "sycl.hpp"
145

15-
// CHECK: !intel_sycl_aspects = !{![[HOST:[0-9]+]], ![[CPU:[0-9]+]], ![[GPU:[0-9]+]], ![[ACC:[0-9]+]], ![[CUSTOM:[0-9]+]], ![[FP16:[0-9]+]], ![[FP64:[0-9]+]], ![[FUTURE_ASPECT:[0-9]+]]}
16-
// CHECK: [[HOST]] = !{!"host", i32 0}
17-
// CHECK: [[CPU]] = !{!"cpu", i32 1}
18-
// CHECK: [[GPU]] = !{!"gpu", i32 2}
19-
// CHECK: [[ACC]] = !{!"accelerator", i32 3}
20-
// CHECK: [[CUSTOM]] = !{!"custom", i32 4}
21-
// CHECK: [[FP16]] = !{!"fp16", i32 5}
22-
// CHECK: [[FP64]] = !{!"fp64", i32 6}
23-
// CHECK: [[FUTURE_ASPECT]] = !{!"future_aspect", i32 12}
6+
// CHECK: !sycl_aspects = !{![[HOST:[0-9]+]], ![[CPU:[0-9]+]], ![[GPU:[0-9]+]], ![[ACC:[0-9]+]], ![[CUSTOM:[0-9]+]], ![[FP16:[0-9]+]], ![[FP64:[0-9]+]]}
7+
// CHECK: ![[HOST]] = !{!"host", i32 0}
8+
// CHECK: ![[CPU]] = !{!"cpu", i32 1}
9+
// CHECK: ![[GPU]] = !{!"gpu", i32 2}
10+
// CHECK: ![[ACC]] = !{!"accelerator", i32 3}
11+
// CHECK: ![[CUSTOM]] = !{!"custom", i32 4}
12+
// CHECK: ![[FP16]] = !{!"fp16", i32 5}
13+
// CHECK: ![[FP64]] = !{!"fp64", i32 6}

llvm/lib/SYCLLowerIR/SYCLPropagateAspectsUsage.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,18 @@ TypeToAspectsMapTy getTypesThatUseAspectsFromMetadata(const Module &M) {
8181

8282
using AspectValueToNameMapTy = SmallMapVector<StringRef, int, 32>;
8383

84-
/// Retrieves from metadata (intel_sycl_aspects) the mapping between SYCL aspect
85-
/// names and their integral values.
84+
/// Retrieves from metadata (sycl_aspects) the mapping between SYCL aspect names
85+
/// and their integral values.
8686
AspectValueToNameMapTy getSYCLAspectsFromMetadata(const Module &M) {
87-
const NamedMDNode *Node = M.getNamedMetadata("intel_sycl_aspects");
87+
const NamedMDNode *Node = M.getNamedMetadata("sycl_aspects");
8888
AspectValueToNameMapTy Result;
8989
if (!Node)
9090
return Result;
9191

9292
for (const auto OperandIt : Node->operands()) {
9393
const MDNode &N = *OperandIt;
9494
assert(N.getNumOperands() == 2 &&
95-
"Each operand of intel_sycl_aspects must be a pair.");
95+
"Each operand of sycl_aspects must be a pair.");
9696

9797
// The aspect's name is the first operand.
9898
const auto *AspectName = cast<MDString>(N.getOperand(0));
@@ -369,7 +369,7 @@ SYCLPropagateAspectsUsagePass::run(Module &M, ModuleAnalysisManager &MAM) {
369369
// that use aspects, so we can skip this pass.
370370
if (AspectValues.empty()) {
371371
assert(TypesWithAspects.empty() &&
372-
"intel_sycl_aspects metadata is missing but "
372+
"sycl_aspects metadata is missing but "
373373
"intel_types_that_use_aspects is present.");
374374
return PreservedAnalyses::all();
375375
}

llvm/test/SYCLLowerIR/PropagateAspectsUsage/call-graph-1.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ define spir_func void @func3() {
5050
!0 = !{!"Optional.A", i32 1}
5151
!1 = !{!"Optional.B", i32 2}
5252

53-
!intel_sycl_aspects = !{!2}
53+
!sycl_aspects = !{!2}
5454
!2 = !{!"fp64", i32 6}
5555

5656
; CHECK: ![[#ID1]] = !{i32 1}

llvm/test/SYCLLowerIR/PropagateAspectsUsage/call-graph-2.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ define spir_func void @func4() {
5151
!0 = !{!"Optional.A", i32 1}
5252
!1 = !{!"Optional.B", i32 2}
5353

54-
!intel_sycl_aspects = !{!2}
54+
!sycl_aspects = !{!2}
5555
!2 = !{!"fp64", i32 6}
5656

5757
; CHECK: ![[#ID1]] = !{i32 1, i32 2}

llvm/test/SYCLLowerIR/PropagateAspectsUsage/composite-types-1.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ define spir_func void @funcA.assepts.optional(%A.optional %0) {
103103
!intel_types_that_use_aspects = !{!0}
104104
!0 = !{!"A.optional", i32 1}
105105

106-
!intel_sycl_aspects = !{!1}
106+
!sycl_aspects = !{!1}
107107
!1 = !{!"fp64", i32 6}
108108

109109
; CHECK: ![[MDID]] = !{i32 1}

llvm/test/SYCLLowerIR/PropagateAspectsUsage/double.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ define spir_func void @func.composite() {
3434
ret void
3535
}
3636

37-
!intel_sycl_aspects = !{!0}
37+
!sycl_aspects = !{!0}
3838
!0 = !{!"fp64", i32 6}
3939

4040
; CHECK: ![[MDID]] = !{i32 6}

llvm/test/SYCLLowerIR/PropagateAspectsUsage/multiple-aspects.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ define spir_kernel void @kernel() {
4646
!2 = !{!"C", i32 2}
4747
!3 = !{!"D", i32 3, i32 4}
4848

49-
!intel_sycl_aspects = !{!4}
49+
!sycl_aspects = !{!4}
5050
!4 = !{!"fp64", i32 6}
5151

5252
; CHECK: ![[#ID0]] = !{i32 0}

llvm/test/SYCLLowerIR/PropagateAspectsUsage/no-uses-of-optional.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ define weak dso_local spir_func void @func() {
1919
!intel_types_that_use_aspects = !{!0}
2020
!0 = !{!"MyStruct", i32 1}
2121

22-
!intel_sycl_aspects = !{!2}
22+
!sycl_aspects = !{!2}
2323
!2 = !{!"fp64", i32 6}

sycl/doc/design/OptionalDeviceFeatures.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,19 +424,23 @@ around that limitation by creating global named metadata that references the
424424
type's name.
425425

426426
To synchronize the integral values of given aspects between the SYCL headers and
427-
the compiler, the `!intel_sycl_aspects` metadata is added to the module, based
428-
on the values defined in the enum. Inside this metadata node, each value of the
429-
aspect enum is represented by another metadata node with two operands; the name
430-
of the value and the corresponding integral value. An example of this is:
427+
the compiler, the `!sycl_aspects` metadata is added to the module, based on the
428+
values defined in the enum. Inside this metadata node, each value of the aspect
429+
enum is represented by another metadata node with two operands; the name of the
430+
value and the corresponding integral value. An example of this is:
431431

432432
```
433-
!intel_sycl_aspects = !{!0, !1, !2, ...}
433+
!sycl_aspects = !{!0, !1, !2, ...}
434434
!0 = !{!"host", i32 0}
435435
!1 = !{!"cpu", i32 1}
436436
!2 = !{!"gpu", i32 2}
437437
...
438438
```
439439

440+
**NOTE**: The `!sycl_aspects` metadata is both used by the compiler to identify
441+
the aspect values of implicit aspect requirements, such as `aspect::fp64` from
442+
the use of `double`, and to offer better diagnostic messages.
443+
440444
We also introduce three metadata that can be attached to a function definition
441445
similar to the existing `!intel_reqd_sub_group_size`:
442446

@@ -499,7 +503,7 @@ to the following rules:
499503
the aspects from that attribute.
500504

501505
* If a completed enum is decorated with `[[sycl_detail::sycl_type(aspect)]]` the
502-
front-end adds an `!intel_sycl_aspects` metadata to the module containing one
506+
front-end adds an `!sycl_aspects` metadata to the module containing one
503507
metadata node for each value in the enum. If there are multiple enum
504508
definitions with the `[[sycl_detail::sycl_type(aspect)]]` attribute a
505509
diagnostic is issued.

0 commit comments

Comments
 (0)