-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL] Add clang support for FPGA kernel attribute scheduler_target_fmax_mhz #2511
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
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9aa340d
[SYCL] Add clang support for FPGA kernel attribute scheduler_target_f…
schittir c5d18d7
Complete draft patch and add a test
schittir 72fdbae
Fix format
schittir ace7f7b
Expand attribute defintion and add upper limit for attribute parameter
schittir a17251d
Handle case where attribute parameter is value dependent
schittir 16f34b2
Fix merge conflict
schittir 0186657
Add CodeGen test
schittir c0adc00
Modify two methods for better code reuse
schittir c66ca64
Fix format error; use sign extension for consistency
schittir c6b9db5
Fix typos
schittir 22d3786
Get rid of check for avoiding this attribute on non-OpenCL kernels
schittir 37ce692
Minor changes to address code review comments
schittir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// RUN: %clang_cc1 -fsycl -fsycl-is-device -disable-llvm-passes -triple spir64-unknown-unknown-sycldevice -emit-llvm -o - %s | FileCheck %s | ||
|
||
#include "Inputs/sycl.hpp" | ||
[[intelfpga::scheduler_target_fmax_mhz(5)]] void | ||
func() {} | ||
|
||
template <int N> | ||
[[intelfpga::scheduler_target_fmax_mhz(N)]] void zoo() {} | ||
|
||
int main() { | ||
cl::sycl::kernel_single_task<class test_kernel1>( | ||
[]() [[intelfpga::scheduler_target_fmax_mhz(2)]]{}); | ||
|
||
cl::sycl::kernel_single_task<class test_kernel2>( | ||
[]() { func(); }); | ||
|
||
cl::sycl::kernel_single_task<class test_kernel3>( | ||
[]() { zoo<75>(); }); | ||
} | ||
// CHECK: define spir_kernel void @{{.*}}test_kernel1() {{.*}} !scheduler_target_fmax_mhz ![[PARAM1:[0-9]+]] | ||
// CHECK: define spir_kernel void @{{.*}}test_kernel2() {{.*}} !scheduler_target_fmax_mhz ![[PARAM2:[0-9]+]] | ||
schittir marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// CHECK: define spir_kernel void @{{.*}}test_kernel3() {{.*}} !scheduler_target_fmax_mhz ![[PARAM3:[0-9]+]] | ||
// CHECK: ![[PARAM1]] = !{i32 2} | ||
// CHECK: ![[PARAM2]] = !{i32 5} | ||
// CHECK: ![[PARAM3]] = !{i32 75} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// RUN: %clang_cc1 %s -fsyntax-only -ast-dump -fsycl -fsycl-is-device -triple spir64 -Wno-sycl-2017-compat -verify | FileCheck %s | ||
|
||
#include "Inputs/sycl.hpp" | ||
[[intelfpga::scheduler_target_fmax_mhz(2)]] void | ||
func() {} | ||
|
||
template <int N> | ||
[[intelfpga::scheduler_target_fmax_mhz(N)]] void zoo() {} | ||
|
||
int main() { | ||
// CHECK-LABEL: FunctionDecl {{.*}}test_kernel1 'void ()' | ||
// CHECK: SYCLIntelSchedulerTargetFmaxMhzAttr {{.*}} | ||
// CHECK-NEXT: ConstantExpr {{.*}} 'int' | ||
// CHECK-NEXT: value: Int 5 | ||
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 5 | ||
cl::sycl::kernel_single_task<class test_kernel1>( | ||
[]() [[intelfpga::scheduler_target_fmax_mhz(5)]]{}); | ||
|
||
// CHECK-LABEL: FunctionDecl {{.*}}test_kernel2 'void ()' | ||
// CHECK: SYCLIntelSchedulerTargetFmaxMhzAttr {{.*}} | ||
// CHECK-NEXT: ConstantExpr {{.*}} 'int' | ||
// CHECK-NEXT: value: Int 2 | ||
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 2 | ||
cl::sycl::kernel_single_task<class test_kernel2>( | ||
[]() { func(); }); | ||
|
||
// CHECK-LABEL: FunctionDecl {{.*}}test_kernel3 'void ()' | ||
// CHECK: SYCLIntelSchedulerTargetFmaxMhzAttr {{.*}} | ||
// CHECK-NEXT: SubstNonTypeTemplateParmExpr {{.*}} 'int' | ||
// CHECK-NEXT: NonTypeTemplateParmDecl {{.*}} referenced 'int' depth 0 index 0 N | ||
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 75 | ||
cl::sycl::kernel_single_task<class test_kernel3>( | ||
[]() { zoo<75>(); }); | ||
|
||
[[intelfpga::scheduler_target_fmax_mhz(0)]] int Var = 0; // expected-error{{'scheduler_target_fmax_mhz' attribute only applies to functions}} | ||
schittir marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
cl::sycl::kernel_single_task<class test_kernel4>( | ||
[]() [[intelfpga::scheduler_target_fmax_mhz(1048577)]]{}); // expected-error{{'scheduler_target_fmax_mhz' attribute requires integer constant between 0 and 1048576 inclusive}} | ||
|
||
cl::sycl::kernel_single_task<class test_kernel5>( | ||
[]() [[intelfpga::scheduler_target_fmax_mhz(-4)]]{}); // expected-error{{'scheduler_target_fmax_mhz' attribute requires integer constant between 0 and 1048576 inclusive}} | ||
|
||
cl::sycl::kernel_single_task<class test_kernel6>( | ||
[]() [[intelfpga::scheduler_target_fmax_mhz(1), intelfpga::scheduler_target_fmax_mhz(2)]]{}); // expected-warning{{attribute 'scheduler_target_fmax_mhz' is already applied with different parameters}} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.