Skip to content

Commit 50ec25b

Browse files
author
Chen, Brox
committed
Merge branch 'sycl' of https://github.com/intel/llvm into op-forward-ann-arg
2 parents 613c71d + e749f01 commit 50ec25b

31 files changed

+597
-282
lines changed

.github/workflows/sycl_linux_precommit.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
branches:
99
- sycl
1010
- sycl-devops-pr/**
11+
- sycl-rel-**
1112
# Do not run builds if changes are only in the following locations
1213
paths-ignore:
1314
- '.github/ISSUE_TEMPLATE/**'

.github/workflows/sycl_post_commit.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches:
66
- sycl
77
- sycl-devops-pr/**
8+
- sycl-rel-**
89

910
pull_request:
1011
branches:

.github/workflows/sycl_windows_precommit.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- sycl
77
- sycl-devops-pr/**
88
- llvmspirv_pulldown
9+
- sycl-rel-**
910
# Do not run builds if changes are only in the following locations
1011
paths-ignore:
1112
- '.github/ISSUE_TEMPLATE/**'

clang-tools-extra/clangd/Compiler.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ void disableUnsupportedOptions(CompilerInvocation &CI) {
8989
CI.getLangOpts().ProfileListFiles.clear();
9090
CI.getLangOpts().XRayAlwaysInstrumentFiles.clear();
9191
CI.getLangOpts().XRayNeverInstrumentFiles.clear();
92+
if (CI.getLangOpts().SYCLIsDevice) {
93+
CI.getLangOpts().SYCLIsDevice = false;
94+
CI.getLangOpts().SYCLUnnamedLambda = false;
95+
CI.getLangOpts().DeclareSPIRVBuiltins = false;
96+
CI.getTargetOpts().Triple = CI.getTargetOpts().HostTriple;
97+
}
9298
}
9399

94100
std::unique_ptr<CompilerInvocation>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# RUN: rm -rf %t.dir/* && mkdir -p %t.dir
2+
# RUN: echo '[{"directory": "%/t.dir", "command": "clang++ -fsycl main.cpp", "file": "main.cpp"}]' > %t.dir/compile_commands.json
3+
# RUN: sed -e "s|INPUT_DIR|%/t.dir|g" %s > %t.test.1
4+
5+
# On Windows, we need the URI in didOpen to look like "uri":"file:///C:/..."
6+
# (with the extra slash in the front), so we add it here.
7+
# RUN: sed -E -e 's|"file://([A-Z]):/|"file:///\1:/|g' %t.test.1 > %t.test
8+
9+
# RUN: clangd -lit-test < %t.test | FileCheck -strict-whitespace %t.test
10+
11+
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"initializationOptions":{"compilationDatabasePath":"INPUT_DIR"}}}
12+
---
13+
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///main.cpp","languageId":"cpp","version":1,"text":"#include <sycl/sycl.hpp>\nsycl::queue q{};"}}}
14+
---
15+
{"jsonrpc":"2.0","id":1,"method":"textDocument/symbolInfo","params":{
16+
"textDocument":{"uri":"test:///main.cpp"},
17+
"position":{"line":1,"character":13}
18+
}}
19+
# CHECK: "id": 1
20+
# CHECK-NEXT: "jsonrpc": "2.0",
21+
# CHECK-NEXT: "result": [
22+
# CHECK-NEXT: {
23+
# CHECK-NEXT: "containerName": "sycl::queue::",
24+
# CHECK-NEXT: "declarationRange": {
25+
# CHECK-NEXT: "range": {
26+
# CHECK-NEXT: "end": {
27+
# CHECK-NEXT: "character": 16,
28+
# CHECK-NEXT: "line": 124
29+
# CHECK-NEXT: },
30+
# CHECK-NEXT: "start": {
31+
# CHECK-NEXT: "character": 11,
32+
# CHECK-NEXT: "line": 124
33+
# CHECK-NEXT: }
34+
# CHECK-NEXT: },
35+
# CHECK-NEXT: "uri": "file://{{.*}}/include/sycl/queue.hpp"
36+
# CHECK-NEXT: },
37+
---
38+
{"jsonrpc":"2.0","id":3,"method":"shutdown"}
39+
---
40+
{"jsonrpc":"2.0","method":"exit"}

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7520,9 +7520,7 @@ static void handleSYCLIntelDoublePumpAttr(Sema &S, Decl *D,
75207520

75217521
/// Handle the [[intel::fpga_memory]] attribute.
75227522
/// This is incompatible with the [[intel::fpga_register]] attribute.
7523-
static void handleSYCLIntelMemoryAttr(Sema &S, Decl *D,
7524-
const ParsedAttr &AL) {
7525-
checkForDuplicateAttribute<SYCLIntelMemoryAttr>(S, D, AL);
7523+
static void handleSYCLIntelMemoryAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
75267524
if (checkAttrMutualExclusion<SYCLIntelRegisterAttr>(S, D, AL))
75277525
return;
75287526

@@ -7543,10 +7541,20 @@ static void handleSYCLIntelMemoryAttr(Sema &S, Decl *D,
75437541
}
75447542
}
75457543

7546-
// We are adding a user memory attribute, drop any implicit default.
7547-
if (auto *MA = D->getAttr<SYCLIntelMemoryAttr>())
7548-
if (MA->isImplicit())
7549-
D->dropAttr<SYCLIntelMemoryAttr>();
7544+
if (auto *MA = D->getAttr<SYCLIntelMemoryAttr>()) {
7545+
// Check to see if there's a duplicate memory attribute with different
7546+
// values already applied to the declaration.
7547+
if (!MA->isImplicit()) {
7548+
if (MA->getKind() != Kind) {
7549+
S.Diag(AL.getLoc(), diag::warn_duplicate_attribute) << &AL;
7550+
S.Diag(MA->getLocation(), diag::note_previous_attribute);
7551+
}
7552+
// Drop the duplicate attribute.
7553+
return;
7554+
}
7555+
// We are adding a user memory attribute, drop any implicit default.
7556+
D->dropAttr<SYCLIntelMemoryAttr>();
7557+
}
75507558

75517559
D->addAttr(::new (S.Context) SYCLIntelMemoryAttr(S.Context, AL, Kind));
75527560
}

clang/test/SemaSYCL/intel-fpga-local-ast.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,46 @@ void check_ast()
265265
[[intel::merge("mrg6", "depth")]]
266266
[[intel::merge("mrg6", "depth")]] unsigned int mrg_mrg6[4];
267267

268+
// Check to see if there's a duplicate attribute with different values
269+
// already applied to the declaration. Drop the duplicate attribute.
270+
// CHECK: VarDecl{{.*}}mem_block_ram
271+
// CHECK: SYCLIntelMemoryAttr{{.*}}MLAB
272+
// CHECK-NOT: SYCLIntelMemoryAttr
273+
[[intel::fpga_memory("MLAB")]]
274+
[[intel::fpga_memory("BLOCK_RAM")]] unsigned int mem_block_ram[32];
275+
276+
// Check to see if there's a duplicate attribute with same Default values
277+
// already applied to the declaration. Drop the duplicate attribute.
278+
// CHECK: VarDecl{{.*}}mem_memory
279+
// CHECK: SYCLIntelMemoryAttr{{.*}}Default
280+
// CHECK-NOT: SYCLIntelMemoryAttr
281+
[[intel::fpga_memory]]
282+
[[intel::fpga_memory]] unsigned int mem_memory[64];
283+
284+
// Check to see if there's a duplicate attribute with same values
285+
// already applied to the declaration. Drop the duplicate attribute.
286+
// CHECK: VarDecl{{.*}}mem_memory_block
287+
// CHECK: SYCLIntelMemoryAttr{{.*}}BlockRAM
288+
// CHECK-NOT: SYCLIntelMemoryAttr
289+
[[intel::fpga_memory("BLOCK_RAM")]]
290+
[[intel::fpga_memory("BLOCK_RAM")]] unsigned int mem_memory_block[64];
291+
292+
// Check to see if there's a duplicate attribute with different values
293+
// already applied to the declaration. Drop the duplicate attribute.
294+
// CHECK: VarDecl{{.*}}mem_mlabs
295+
// CHECK: SYCLIntelMemoryAttr{{.*}}Default
296+
// CHECK-NOT: SYCLIntelMemoryAttr
297+
[[intel::fpga_memory]]
298+
[[intel::fpga_memory("MLAB")]] unsigned int mem_mlabs[64];
299+
300+
// Check to see if there's a duplicate attribute with different values
301+
// already applied to the declaration. Drop the duplicate attribute.
302+
// CHECK: VarDecl{{.*}}mem_mlabs_block_ram
303+
// CHECK: SYCLIntelMemoryAttr{{.*}}BlockRAM
304+
// CHECK-NOT: SYCLIntelMemoryAttr
305+
[[intel::fpga_memory("BLOCK_RAM")]]
306+
[[intel::fpga_memory]] unsigned int mem_mlabs_block_ram[64];
307+
268308
// FIXME: Duplicate attribute should be ignored.
269309
// Both are applied at the moment.
270310
//CHECK: VarDecl{{.*}}bb_bb

clang/test/SemaSYCL/intel-fpga-local.cpp

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,45 @@ void diagnostics()
143143
//expected-note@-2 {{conflicting attribute is here}}
144144
unsigned int mem_reg[64];
145145

146-
//expected-warning@+1{{attribute 'fpga_memory' is already applied}}
147-
[[intel::fpga_memory]] [[intel::fpga_memory]] unsigned int mem_mem[64];
146+
// Check to see if there's a duplicate attribute with same Default values
147+
// already applied to the declaration.
148+
// No diagnostic is emitted because the arguments match.
149+
[[intel::fpga_memory]]
150+
[[intel::fpga_memory]] unsigned int mem_mem[64]; // OK
148151

149152
//expected-warning@+1 {{unknown attribute 'memory' ignored}}
150153
[[intelfpga::memory]] unsigned int memory_var[64];
151154

155+
// Check to see if there's a duplicate attribute with different values
156+
// already applied to the declaration.
157+
// Diagnostic is emitted because the arguments mismatch.
158+
//expected-warning@+2{{attribute 'fpga_memory' is already applied with different arguments}}
159+
[[intel::fpga_memory("MLAB")]] // expected-note {{previous attribute is here}}
160+
[[intel::fpga_memory("BLOCK_RAM")]] unsigned int mem_block_ram[32];
161+
162+
// Check to see if there's a duplicate attribute with same values
163+
// already applied to the declaration.
164+
// No diagnostic is emitted because the arguments match.
165+
[[intel::fpga_memory("MLAB")]]
166+
[[intel::fpga_memory("MLAB")]] unsigned int mem_mlab[32]; // OK
167+
168+
[[intel::fpga_memory("BLOCK_RAM")]]
169+
[[intel::fpga_memory("BLOCK_RAM")]] unsigned int mem_block[32]; // OK
170+
171+
// Check to see if there's a duplicate attribute with different values
172+
// already applied to the declaration.
173+
// Diagnostic is emitted because the arguments mismatch.
174+
//expected-warning@+2{{attribute 'fpga_memory' is already applied with different arguments}}
175+
[[intel::fpga_memory]] // expected-note {{previous attribute is here}}
176+
[[intel::fpga_memory("MLAB")]] unsigned int mem_mlabs[64];
177+
178+
// Check to see if there's a duplicate attribute with different values
179+
// already applied to the declaration.
180+
// Diagnostic is emitted because the arguments mismatch.
181+
//expected-warning@+2{{attribute 'fpga_memory' is already applied with different arguments}}
182+
[[intel::fpga_memory("BLOCK_RAM")]] // expected-note {{previous attribute is here}}
183+
[[intel::fpga_memory]] unsigned int mem_mlabs_block_ram[64];
184+
152185
// **bankwidth
153186
//expected-warning@+1 {{unknown attribute 'bankwidth' ignored}}
154187
[[intelfpga::bankwidth(4)]] unsigned int bankwidth_var[32];

llvm-spirv/test/FPFastMathModeNotNaNFast.spvasm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
OpName %r3 "r3"
1414
OpName %r4 "r4"
1515
OpName %r5 "r5"
16+
OpName %r6 "r6"
1617
OpDecorate %dec FPFastMathMode NotNaN|Fast
1718
%dec = OpDecorationGroup
18-
OpGroupDecorate %dec %r1 %r2 %r3 %r4 %r5
19+
OpGroupDecorate %dec %r1 %r2 %r3 %r4 %r5 %r6
1920
%void = OpTypeVoid
2021
%float = OpTypeFloat 32
2122
%5 = OpTypeFunction %void %float %float
@@ -28,6 +29,7 @@
2829
%r3 = OpFMul %float %a %b
2930
%r4 = OpFDiv %float %a %b
3031
%r5 = OpFRem %float %a %b
32+
%r6 = OpFNegate %float %a
3133
OpReturn
3234
OpFunctionEnd
3335

@@ -36,3 +38,4 @@
3638
; CHECK: %r3 = fmul fast float %a, %b
3739
; CHECK: %r4 = fdiv fast float %a, %b
3840
; CHECK: %r5 = frem fast float %a, %b
41+
; CHECK: %r6 = fneg fast float %a

llvm-spirv/test/OpFNegate.spvasm

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)