Skip to content

Commit 9ea929b

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web' (4 commits)
2 parents 5a0b48d + bdf2e56 commit 9ea929b

34 files changed

+297
-41
lines changed

libc/include/endian.h.def

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//===-- POSIX header endian.h ---------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIBC_ENDIAN_H
10+
#define LLVM_LIBC_ENDIAN_H
11+
12+
#include "__llvm-libc-common.h"
13+
#include "llvm-libc-macros/endian-macros.h"
14+
15+
%%public_api()
16+
17+
#endif // LLVM_LIBC_ENDIAN_H
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//===-- Macros defined in poll.h header file ------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIBC_MACROS_POLL_MACROS_H
10+
#define LLVM_LIBC_MACROS_POLL_MACROS_H
11+
12+
#ifdef __linux__
13+
#include "linux/poll-macros.h"
14+
#endif
15+
16+
#endif // LLVM_LIBC_MACROS_POLL_MACROS_H

libc/include/poll.h.def

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//===-- C standard library header poll.h ----------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIBC_POLL_H
10+
#define LLVM_LIBC_POLL_H
11+
12+
#include "__llvm-libc-common.h"
13+
#include "llvm-libc-macros/poll-macros.h"
14+
15+
%%public_api()
16+
17+
#endif // LLVM_LIBC_POLL_H
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//===-- Unittests for countlsk --------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "CountlsTest.h"
10+
11+
#include "src/stdfix/countlsk.h"
12+
13+
LIST_COUNTLS_TESTS(accum, LIBC_NAMESPACE::countlsk);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//===-- Unittests for countlslk -------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "CountlsTest.h"
10+
11+
#include "src/stdfix/countlslk.h"
12+
13+
LIST_COUNTLS_TESTS(long accum, LIBC_NAMESPACE::countlslk);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//===-- Unittests for countlsr --------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "CountlsTest.h"
10+
11+
#include "src/stdfix/countlsr.h"
12+
13+
LIST_COUNTLS_TESTS(fract, LIBC_NAMESPACE::countlsr);

llvm/lib/Transforms/Utils/InlineFunction.cpp

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,19 +1143,31 @@ static void AddAliasScopeMetadata(CallBase &CB, ValueToValueMapTy &VMap,
11431143
DenseMap<const Argument *, MDNode *> NewScopes;
11441144
MDBuilder MDB(CalledFunc->getContext());
11451145

1146+
// For spir/spirv targets, disable function name encoding
1147+
// in alias metadata to reduce metadata bloat and improve compilation
1148+
// performance.
1149+
const Module *M = CalledFunc->getParent();
1150+
const auto Arch = M->getTargetTriple().getArch();
1151+
const bool IsSPIRModule =
1152+
Arch == Triple::ArchType::spir || Arch == Triple::ArchType::spir64 ||
1153+
Arch == Triple::ArchType::spirv || Arch == Triple::ArchType::spirv64;
1154+
11461155
// Create a new scope domain for this function.
1147-
MDNode *NewDomain =
1148-
MDB.createAnonymousAliasScopeDomain(CalledFunc->getName());
1156+
MDNode *NewDomain = MDB.createAnonymousAliasScopeDomain(
1157+
IsSPIRModule ? StringRef() : CalledFunc->getName());
11491158
for (unsigned i = 0, e = NoAliasArgs.size(); i != e; ++i) {
11501159
const Argument *A = NoAliasArgs[i];
11511160

1152-
std::string Name = std::string(CalledFunc->getName());
1153-
if (A->hasName()) {
1154-
Name += ": %";
1155-
Name += A->getName();
1156-
} else {
1157-
Name += ": argument ";
1158-
Name += utostr(i);
1161+
std::string Name;
1162+
if (!IsSPIRModule) {
1163+
Name = std::string(CalledFunc->getName());
1164+
if (A->hasName()) {
1165+
Name += ": %";
1166+
Name += A->getName();
1167+
} else {
1168+
Name += ": argument ";
1169+
Name += utostr(i);
1170+
}
11591171
}
11601172

11611173
// Note: We always create a new anonymous root here. This is true regardless
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
; Test that alias scope metadata does not include function names for SPIR target.
2+
; This reduces metadata bloat and improves compilation performance for SYCL.
3+
;
4+
; RUN: opt -passes=inline -enable-noalias-to-md-conversion -S < %s | FileCheck %s
5+
6+
; Check that optional string metadata node is not generated.
7+
; CHECK-NOT: !"callee: %a"
8+
; CHECK-NOT: !"callee2: %a"
9+
; CHECK-NOT: !"callee2: %b"
10+
11+
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
12+
target triple = "spir64-unknown-unknown"
13+
14+
define void @callee(ptr noalias nocapture %a, ptr nocapture readonly %c) #0 {
15+
entry:
16+
%0 = load float, ptr %c, align 4
17+
%arrayidx = getelementptr inbounds float, ptr %a, i64 5
18+
store float %0, ptr %arrayidx, align 4
19+
ret void
20+
}
21+
22+
; Don't check correctness precisely - just check if aliasing info is still
23+
; generated during inlining for SPIR target.
24+
; CHECK-LABEL: caller(
25+
; CHECK: load float
26+
; CHECK-SAME: !noalias ![[#Scope1:]]
27+
; CHECK: store float
28+
; CHECK-SAME: !alias.scope ![[#Scope1]]
29+
30+
define void @caller(ptr nocapture %a, ptr nocapture readonly %c) #0 {
31+
entry:
32+
tail call void @callee(ptr %a, ptr %c)
33+
%0 = load float, ptr %c, align 4
34+
%arrayidx = getelementptr inbounds float, ptr %a, i64 7
35+
store float %0, ptr %arrayidx, align 4
36+
ret void
37+
}
38+
39+
define void @callee2(ptr noalias nocapture %a, ptr noalias nocapture %b, ptr nocapture readonly %c) #0 {
40+
entry:
41+
%0 = load float, ptr %c, align 4
42+
%arrayidx = getelementptr inbounds float, ptr %a, i64 5
43+
store float %0, ptr %arrayidx, align 4
44+
%arrayidx1 = getelementptr inbounds float, ptr %b, i64 8
45+
store float %0, ptr %arrayidx1, align 4
46+
ret void
47+
}
48+
49+
; Don't check correctness precisely - just check if aliasing info is still
50+
; generated during inlining for SPIR target.
51+
; CHECK-LABEL: caller2(
52+
; CHECK: load float
53+
; CHECK-SAME: !noalias ![[#]]
54+
; CHECK: store float
55+
; CHECK-SAME: !alias.scope ![[#Scope3:]], !noalias ![[#Scope4:]]
56+
; CHECK: store float
57+
; CHECK-SAME: !alias.scope ![[#Scope4:]], !noalias ![[#Scope3:]]
58+
59+
define void @caller2(ptr nocapture %a, ptr nocapture %b, ptr nocapture readonly %c) #0 {
60+
entry:
61+
tail call void @callee2(ptr %a, ptr %b, ptr %c)
62+
%0 = load float, ptr %c, align 4
63+
%arrayidx = getelementptr inbounds float, ptr %a, i64 7
64+
store float %0, ptr %arrayidx, align 4
65+
ret void
66+
}
67+
68+
attributes #0 = { nounwind }
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
; Test that alias scope metadata does not include function names for SPIR-V target.
2+
; This reduces metadata bloat and improves compilation performance for SYCL.
3+
;
4+
; RUN: opt -passes=inline -enable-noalias-to-md-conversion -S < %s | FileCheck %s
5+
6+
; Check that optional string metadata node is not generated.
7+
; CHECK-NOT: !"callee: %a"
8+
; CHECK-NOT: !"callee2: %a"
9+
; CHECK-NOT: !"callee2: %b"
10+
11+
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
12+
target triple = "spirv64-unknown-unknown"
13+
14+
define void @callee(ptr noalias nocapture %a, ptr nocapture readonly %c) #0 {
15+
entry:
16+
%0 = load float, ptr %c, align 4
17+
%arrayidx = getelementptr inbounds float, ptr %a, i64 5
18+
store float %0, ptr %arrayidx, align 4
19+
ret void
20+
}
21+
22+
; Don't check correctness precisely - just check if aliasing info is still
23+
; generated during inlining for SPIR-V target.
24+
; CHECK-LABEL: caller(
25+
; CHECK: load float
26+
; CHECK-SAME: !noalias ![[#Scope1:]]
27+
; CHECK: store float
28+
; CHECK-SAME: !alias.scope ![[#Scope1]]
29+
30+
define void @caller(ptr nocapture %a, ptr nocapture readonly %c) #0 {
31+
entry:
32+
tail call void @callee(ptr %a, ptr %c)
33+
%0 = load float, ptr %c, align 4
34+
%arrayidx = getelementptr inbounds float, ptr %a, i64 7
35+
store float %0, ptr %arrayidx, align 4
36+
ret void
37+
}
38+
39+
define void @callee2(ptr noalias nocapture %a, ptr noalias nocapture %b, ptr nocapture readonly %c) #0 {
40+
entry:
41+
%0 = load float, ptr %c, align 4
42+
%arrayidx = getelementptr inbounds float, ptr %a, i64 5
43+
store float %0, ptr %arrayidx, align 4
44+
%arrayidx1 = getelementptr inbounds float, ptr %b, i64 8
45+
store float %0, ptr %arrayidx1, align 4
46+
ret void
47+
}
48+
49+
; Don't check correctness precisely - just check if aliasing info is still
50+
; generated during inlining for SPIR-V target.
51+
; CHECK-LABEL: caller2(
52+
; CHECK: load float
53+
; CHECK-SAME: !noalias ![[#]]
54+
; CHECK: store float
55+
; CHECK-SAME: !alias.scope ![[#Scope3:]], !noalias ![[#Scope4:]]
56+
; CHECK: store float
57+
; CHECK-SAME: !alias.scope ![[#Scope4:]], !noalias ![[#Scope3:]]
58+
59+
define void @caller2(ptr nocapture %a, ptr nocapture %b, ptr nocapture readonly %c) #0 {
60+
entry:
61+
tail call void @callee2(ptr %a, ptr %b, ptr %c)
62+
%0 = load float, ptr %c, align 4
63+
%arrayidx = getelementptr inbounds float, ptr %a, i64 7
64+
store float %0, ptr %arrayidx, align 4
65+
ret void
66+
}
67+
68+
attributes #0 = { nounwind }

sycl/test-e2e/Basic/device_event.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// RUN: %{build} -o %t.run
22
// RUN: %{run} %t.run
33

4-
// UNSUPPORTED: spirv-backend
5-
// UNSUPPORTED-TRACKER: CMPLRLLVM-64705
6-
74
//==--------device_event.cpp - SYCL class device_event test ----------------==//
85
//
96
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.

0 commit comments

Comments
 (0)