-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL][FPGA] Apply [[intel::use_stall_enable_clusters]] attribute to any function #3900
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
19 commits
Select commit
Hold shift + click to select a range
f2df511
[SYCL][FPGA] Apply [[intel::use_stall_enable_clusters]] attribute to …
smanna12 b2ecda7
update doc
smanna12 2ce3bc3
fix clang format issues
smanna12 4d76f3e
address review comments
smanna12 63cb9f5
fix clang format errors
smanna12 54347d2
address review comments
smanna12 d0a6ac8
fix format issues
smanna12 5e226a0
address review comments
smanna12 fddae48
address review comments
smanna12 10dd6ff
update Doc
smanna12 8ebc290
Merge remote-tracking branch 'my_remote/sycl' into ApplyAttrAnyFunction
smanna12 4dac683
generate the metadata in device-mode
smanna12 8da68a8
address review comments
smanna12 a57d932
update doc
smanna12 dbbacf0
add comments in test
smanna12 a916048
update tests
smanna12 6798311
update Sema/CodeGen tests and add comments
smanna12 91a94c3
address review comments
smanna12 1d5b16f
update doc based on aaron's comment
smanna12 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 was deleted.
Oops, something went wrong.
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,54 @@ | ||
// RUN: %clang_cc1 -fsycl-is-device -internal-isystem %S/Inputs -triple spir64-unknown-unknown-sycldevice -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s | ||
|
||
// Tests for IR of Intel FPGA [[intel::use_stall_enable_clusters]] function attribute on Device. | ||
// The metadata to be attached to the functionDecl that the attribute is applied to. | ||
// The attributes do not get propagated to kernel metadata i.e. spir_kernel. | ||
|
||
#include "sycl.hpp" | ||
|
||
using namespace cl::sycl; | ||
queue q; | ||
|
||
[[intel::use_stall_enable_clusters]] void test() {} | ||
|
||
struct FuncObj { | ||
[[intel::use_stall_enable_clusters]] void operator()() const {} | ||
}; | ||
|
||
void test1() { | ||
auto lambda = []() [[intel::use_stall_enable_clusters]]{}; | ||
lambda(); | ||
} | ||
|
||
class Foo { | ||
public: | ||
[[intel::use_stall_enable_clusters]] void operator()() const {} | ||
}; | ||
|
||
int main() { | ||
q.submit([&](handler &h) { | ||
// CHECK: define {{.*}}spir_kernel void @{{.*}}test_kernel1() #0 !kernel_arg_buffer_location ![[NUM4:[0-9]+]] | ||
// CHECK: define {{.*}}spir_func void @{{.*}}FuncObjclEv(%struct.{{.*}}FuncObj addrspace(4)* align 1 dereferenceable_or_null(1) %this) #3 comdat align 2 !stall_enable ![[NUM5:[0-9]+]] | ||
h.single_task<class test_kernel1>( | ||
FuncObj()); | ||
|
||
// CHECK: define {{.*}}spir_kernel void @{{.*}}test_kernel2() #0 !kernel_arg_buffer_location ![[NUM4]] | ||
// CHECK define {{.*}}spir_func void @{{.*}}FooclEv(%class._ZTS3Foo.Foo addrspace(4)* align 1 dereferenceable_or_null(1) %this) #3 comdat align 2 !stall_enable ![[NUM5]] | ||
Foo f; | ||
h.single_task<class test_kernel2>(f); | ||
|
||
// CHECK: define {{.*}}spir_kernel void @{{.*}}test_kernel3() #0 !kernel_arg_buffer_location ![[NUM4]] | ||
// CHECK: define {{.*}}spir_func void @_Z4testv() #3 !stall_enable ![[NUM5]] | ||
h.single_task<class test_kernel3>( | ||
[]() { test(); }); | ||
|
||
// CHECK: define {{.*}}spir_kernel void @{{.*}}test_kernel4() #0 !kernel_arg_buffer_location ![[NUM4]] | ||
// CHECK: define {{.*}}spir_func void @{{.*}}test1vENKUlvE_clEv(%class.{{.*}}test1{{.*}}.anon addrspace(4)* align 1 dereferenceable_or_null(1) %this) #4 align 2 !stall_enable ![[NUM5]] | ||
h.single_task<class test_kernel4>( | ||
[]() { test1(); }); | ||
}); | ||
return 0; | ||
} | ||
|
||
// CHECK: ![[NUM4]] = !{} | ||
// CHECK: ![[NUM5]] = !{i32 1} |
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,29 @@ | ||
// RUN: %clang_cc1 -fsycl-is-host -triple -x86_64-unknown-linux-gnu -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s | ||
|
||
// Tests for IR of Intel FPGA [[intel::use_stall_enable_clusters]] function attribute on Host (no-op in IR-CodeGen for host-mode). | ||
|
||
[[intel::use_stall_enable_clusters]] void test() {} | ||
|
||
void test1() { | ||
auto lambda = []() [[intel::use_stall_enable_clusters]]{}; | ||
lambda(); | ||
} | ||
|
||
template <typename name, typename Func> | ||
elizabethandrews marked this conversation as resolved.
Show resolved
Hide resolved
|
||
__attribute__((sycl_kernel)) void kernel(const Func &kernelFunc) { | ||
kernelFunc(); | ||
} | ||
|
||
class KernelFunctor { | ||
public: | ||
[[intel::use_stall_enable_clusters]] void operator()() const {} | ||
|
||
}; | ||
|
||
void foo() { | ||
|
||
KernelFunctor f; | ||
kernel<class kernel_name_1>(f); | ||
} | ||
|
||
// CHECK-NOT: !stall_enable |
This file was deleted.
Oops, something went wrong.
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,60 @@ | ||
// RUN: %clang_cc1 %s -fsyntax-only -internal-isystem %S/Inputs -fsycl-is-device -Wno-sycl-2017-compat -DTRIGGER_ERROR -verify | ||
// RUN: %clang_cc1 -fsycl-is-device -internal-isystem %S/Inputs -fsyntax-only -ast-dump -Wno-sycl-2017-compat %s | FileCheck %s | ||
|
||
// Test that checks [[intel::use_stall_enable_clusters]] attribute support on function. | ||
|
||
#include "sycl.hpp" | ||
|
||
using namespace cl::sycl; | ||
queue q; | ||
|
||
// Test attribute is presented on function definition. | ||
[[intel::use_stall_enable_clusters]] void test() {} | ||
// CHECK: FunctionDecl{{.*}}test | ||
// CHECK: SYCLIntelUseStallEnableClustersAttr | ||
|
||
// Tests for incorrect argument values for Intel FPGA use_stall_enable_clusters function attribute. | ||
#ifdef TRIGGER_ERROR | ||
[[intel::use_stall_enable_clusters(1)]] void test1() {} // expected-error{{'use_stall_enable_clusters' attribute takes no arguments}} | ||
[[intel::use_stall_enable_clusters]] int test2; // expected-error{{'use_stall_enable_clusters' attribute only applies to functions}} | ||
#endif | ||
|
||
// Test attribute is presented on function call operator (of a function object). | ||
struct FuncObj { | ||
[[intel::use_stall_enable_clusters]] void operator()() const {} | ||
// CHECK: CXXRecordDecl{{.*}}implicit struct FuncObj | ||
// CHECK-NEXT: CXXMethodDecl{{.*}}used operator() 'void () const' | ||
// CHECK-NEXT-NEXT:SYCLIntelUseStallEnableClustersAttr | ||
}; | ||
|
||
// Test attribute is presented on lambda function(applied to a function type for the lambda's call operator). | ||
void test3() { | ||
auto lambda = []() [[intel::use_stall_enable_clusters]]{}; | ||
lambda(); | ||
// CHECK: FunctionDecl{{.*}}test3 | ||
// CHECK: LambdaExpr | ||
// CHECK: SYCLIntelUseStallEnableClustersAttr | ||
} | ||
|
||
int main() { | ||
q.submit([&](handler &h) { | ||
// Test attribute is not propagated to the kernel. | ||
// CHECK-LABEL: FunctionDecl {{.*}}test_kernel1 | ||
// CHECK-NOT: SYCLIntelUseStallEnableClustersAttr {{.*}} | ||
h.single_task<class test_kernel1>( | ||
FuncObj()); | ||
|
||
// Test attribute does not present on LambdaExpr called by kernel. | ||
// CHECK-LABEL: FunctionDecl {{.*}}test_kernel2 | ||
// CHECK-NOT: SYCLIntelUseStallEnableClustersAttr {{.*}} | ||
h.single_task<class test_kernel2>( | ||
[]() [[intel::use_stall_enable_clusters]]{}); | ||
elizabethandrews marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// Test attribute is not propagated to the kernel. | ||
// CHECK-LABEL: FunctionDecl {{.*}}test_kernel3 | ||
// CHECK-NOT: SYCLIntelUseStallEnableClustersAttr {{.*}} | ||
h.single_task<class test_kernel3>( | ||
[]() { test(); }); | ||
}); | ||
return 0; | ||
} |
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.