forked from llvm/clangir
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CIR][Dialect][CodeGen] Add a unit attribute for OpenCL kernels (llvm…
…#877) We need a target-independent way to distinguish OpenCL kernels in ClangIR. This PR adds a unit attribute `OpenCLKernelAttr` similar to the one in Clang AST. This attribute is attached to the extra attribute dictionary of `cir.func` operations only. (Not for `cir.call`.)
- Loading branch information
1 parent
908f19c
commit 183567b
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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 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,14 @@ | ||
// RUN: %clang_cc1 -fclangir -emit-cir -triple spirv64-unknown-unknown %s -o %t.cir | ||
// RUN: FileCheck %s --input-file=%t.cir --check-prefix=CIR | ||
|
||
|
||
// CIR: #fn_attr[[KERNEL1:[0-9]*]] = {{.+}}cl.kernel = #cir.cl.kernel | ||
// CIR-NEXT: #fn_attr[[FUNC1:[0-9]*]] = | ||
// CIR-NOT: cl.kernel = #cir.cl.kernel | ||
|
||
kernel void kernel1() {} | ||
// CIR: cir.func @kernel1{{.+}} extra(#fn_attr[[KERNEL1]]) | ||
|
||
void func1() {} | ||
|
||
// CIR: cir.func @func1{{.+}} extra(#fn_attr[[FUNC1]]) |