-
Notifications
You must be signed in to change notification settings - Fork 796
[SYCL] Add support for new FPGA loop attribute nofusion #2715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
d73d505
48d3465
cf15440
8246250
d513748
822be0e
14e71a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| // RUN: %clang_cc1 -triple spir64-unknown-unknown-sycldevice -disable-llvm-passes -fsycl -fsycl-is-device -emit-llvm %s -o - | FileCheck %s | ||
|
||
|
|
||
| // CHECK: br label %while.cond, !llvm.loop ![[MD_NF_1:[0-9]+]] | ||
| // CHECK: br label %for.cond3, !llvm.loop ![[MD_NF_2:[0-9]+]] | ||
| // CHECK: i1 %cmp18, label %do.body, label %do.end, !llvm.loop ![[MD_NF_3:[0-9]+]] | ||
| // CHECK: br label %for.cond20, !llvm.loop ![[MD_NF_4:[0-9]+]] | ||
| // CHECK: br label %for.cond41, !llvm.loop ![[MD_NF_5:[0-9]+]] | ||
| // CHECK: br label %for.cond50, !llvm.loop ![[MD_NF_6:[0-9]+]] | ||
|
|
||
| #include "Inputs/sycl.hpp" | ||
|
|
||
| void nofusion() { | ||
| int a[10]; | ||
|
|
||
| int i = 0; | ||
| [[intel::nofusion]] while (i < 10) { | ||
| a[i] += 7; | ||
| } | ||
|
|
||
| for (int i = 0; i < 10; ++i) { | ||
| [[intel::nofusion]] for (int j = 0; j < 10; ++j) { | ||
| a[i] += a[j]; | ||
| } | ||
| } | ||
|
|
||
| [[intel::nofusion]] do { | ||
| a[i] += 4; | ||
| } | ||
| while (i < 10) | ||
| ; | ||
|
|
||
| [[intel::nofusion]] for (int i = 0; i < 10; ++i) { | ||
| for (int j = 0; j < 10; ++j) { | ||
| a[i] += a[j]; | ||
| } | ||
| } | ||
|
|
||
| int k = 0; | ||
| [[intel::nofusion]] for (auto k : a) { | ||
| k += 2; | ||
| } | ||
|
|
||
| [[intel::nofusion]] for (int i = 0; i < 10; ++i) { | ||
| a[i] += 3; | ||
| } | ||
| } | ||
|
|
||
| int main() { | ||
| cl::sycl::kernel_single_task<class kernel_function>([]() { | ||
Fznamznon marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| nofusion(); | ||
| }); | ||
| return 0; | ||
| } | ||
|
|
||
| // CHECK: ![[MD_NF_1]] = distinct !{![[MD_NF_1]], ![[MD_Nofusion:[0-9]+]]} | ||
| // CHECK: ![[MD_Nofusion]] = !{!"llvm.loop.fusion.disable"} | ||
| // CHECK: ![[MD_NF_2]] = distinct !{![[MD_NF_2]], ![[MD_Nofusion]]} | ||
| // CHECK: ![[MD_NF_3]] = distinct !{![[MD_NF_3]], ![[MD_Nofusion]]} | ||
| // CHECK: ![[MD_NF_4]] = distinct !{![[MD_NF_4]], ![[MD_Nofusion]]} | ||
| // CHECK: ![[MD_NF_5]] = distinct !{![[MD_NF_5]], ![[MD_Nofusion]]} | ||
| // CHECK: ![[MD_NF_6]] = distinct !{![[MD_NF_6]], ![[MD_Nofusion]]} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // RUN: %clang_cc1 -fsycl -fsycl-is-device -fsyntax-only -ast-dump -Wno-sycl-2017-compat -verify %s | FileCheck %s | ||
| // expected-no-diagnostics | ||
|
|
||
| #include "Inputs/sycl.hpp" | ||
|
|
||
| void nofusion() { | ||
| int a1[10], a2[10]; | ||
|
|
||
| // CHECK: AttributedStmt | ||
| // CHECK-NEXT: SYCLIntelFPGANofusionAttr {{.*}} | ||
Fznamznon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| [[intel::nofusion]] for (int p = 0; p < 10; ++p) { | ||
| a1[p] = a2[p] = 0; | ||
| } | ||
|
|
||
| // CHECK: AttributedStmt | ||
| // CHECK-NEXT: SYCLIntelFPGANofusionAttr {{.*}} | ||
| int i = 0; | ||
| [[intel::nofusion]] while (i < 10) { | ||
| a1[i] += 3; | ||
| } | ||
|
|
||
| // CHECK: AttributedStmt | ||
| // CHECK-NEXT: SYCLIntelFPGANofusionAttr {{.*}} | ||
| for (int i = 0; i < 10; ++i) { | ||
| [[intel::nofusion]] for (int j = 0; j < 10; ++j) { | ||
| a1[i] += a1[j]; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| int main() { | ||
| cl::sycl::kernel_single_task<class kernel_function>([]() { | ||
| nofusion(); | ||
| }); | ||
| return 0; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.