Skip to content

[SYCL] Improve intel-fpga-loops test #1034

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

Merged
merged 2 commits into from
Jan 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 18 additions & 40 deletions clang/test/CodeGenSYCL/intel-fpga-loops.cpp
Original file line number Diff line number Diff line change
@@ -1,55 +1,35 @@
// RUN: %clang_cc1 -triple spir64-unknown-unknown-sycldevice -disable-llvm-passes -fsycl-is-device -emit-llvm %s -o - | FileCheck %s

// CHECK: br label %for.cond, !llvm.loop ![[MD_A:[0-9]+]]
// CHECK: br label %for.cond, !llvm.loop ![[MD_B:[0-9]+]]
// CHECK: br label %for.cond, !llvm.loop ![[MD_C:[0-9]+]]
// CHECK: br label %for.cond2, !llvm.loop ![[MD_D:[0-9]+]]
// CHECK: br label %for.cond, !llvm.loop ![[MD_E:[0-9]+]]
// CHECK: br label %for.cond2, !llvm.loop ![[MD_F:[0-9]+]]
// CHECK: br label %for.cond, !llvm.loop ![[MD_II:[0-9]+]]
// CHECK: br label %for.cond2, !llvm.loop ![[MD_II_2:[0-9]+]]
// CHECK: br label %for.cond, !llvm.loop ![[MD_MC:[0-9]+]]
// CHECK: br label %for.cond2, !llvm.loop ![[MD_MC_2:[0-9]+]]

// CHECK: ![[MD_A]] = distinct !{![[MD_A]], ![[MD_ii:[0-9]+]]}
// CHECK-NEXT: ![[MD_ii]] = !{!"llvm.loop.ii.count", i32 2}
void goo() {
int a[10];
[[intelfpga::ii(2)]]
for (int i = 0; i != 10; ++i)
a[i] = 0;
}

// CHECK: ![[MD_B]] = distinct !{![[MD_B]], ![[MD_max_concurrency:[0-9]+]]}
// CHECK-NEXT: ![[MD_max_concurrency]] = !{!"llvm.loop.max_concurrency.count", i32 2}
void zoo() {
int a[10];
[[intelfpga::max_concurrency(2)]]
for (int i = 0; i != 10; ++i)
a[i] = 0;
}

// CHECK: ![[MD_C]] = distinct !{![[MD_C]], ![[MD_ii_2:[0-9]+]]}
// CHECK-NEXT: ![[MD_ii_2]] = !{!"llvm.loop.ii.count", i32 4}
template <int A>
void boo() {
void ii() {
int a[10];
// CHECK: ![[MD_II]] = distinct !{![[MD_II]], ![[MD_ii_count:[0-9]+]]}
// CHECK-NEXT: ![[MD_ii_count]] = !{!"llvm.loop.ii.count", i32 4}
[[intelfpga::ii(A)]]
for (int i = 0; i != 10; ++i)
a[i] = 0;
// CHECK: ![[MD_D]] = distinct !{![[MD_D]], ![[MD_ii_3:[0-9]+]]}
// CHECK-NEXT: ![[MD_ii_3]] = !{!"llvm.loop.ii.count", i32 8}
// CHECK: ![[MD_II_2]] = distinct !{![[MD_II_2]], ![[MD_ii_count_2:[0-9]+]]}
// CHECK-NEXT: ![[MD_ii_count_2]] = !{!"llvm.loop.ii.count", i32 8}
[[intelfpga::ii(8)]]
for (int i = 0; i != 10; ++i)
a[i] = 0;
}

// CHECK: ![[MD_E]] = distinct !{![[MD_E]], ![[MD_max_concurrency_2:[0-9]+]]}
// CHECK-NEXT: ![[MD_max_concurrency_2]] = !{!"llvm.loop.max_concurrency.count", i32 0}
template <int B>
void foo() {
template <int A>
void max_concurrency() {
int a[10];
[[intelfpga::max_concurrency(B)]]
// CHECK: ![[MD_MC]] = distinct !{![[MD_MC]], ![[MD_max_concurrency:[0-9]+]]}
// CHECK-NEXT: ![[MD_max_concurrency]] = !{!"llvm.loop.max_concurrency.count", i32 0}
[[intelfpga::max_concurrency(A)]]
for (int i = 0; i != 10; ++i)
a[i] = 0;
// CHECK: ![[MD_F]] = distinct !{![[MD_F]], ![[MD_max_concurrency_3:[0-9]+]]}
// CHECK-NEXT: ![[MD_max_concurrency_3]] = !{!"llvm.loop.max_concurrency.count", i32 4}
// CHECK: ![[MD_MC_2]] = distinct !{![[MD_MC_2]], ![[MD_max_concurrency_2:[0-9]+]]}
// CHECK-NEXT: ![[MD_max_concurrency_2]] = !{!"llvm.loop.max_concurrency.count", i32 4}
[[intelfpga::max_concurrency(4)]]
for (int i = 0; i != 10; ++i)
a[i] = 0;
Expand All @@ -62,10 +42,8 @@ __attribute__((sycl_kernel)) void kernel_single_task(Func kernelFunc) {

int main() {
kernel_single_task<class kernel_function>([]() {
goo();
zoo();
boo<4>();
foo<0>();
ii<4>();
max_concurrency<0>();
});
return 0;
}