Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPIRV] read kernel arg attributes from fuction/module metadata
The patch introduces reading the attributes of kernel arguments both from function-attached and module-level metadata, during kernel arguments lowering. Two tests are added to show the improvement. Differential Revision: https://reviews.llvm.org/D135106 Co-authored-by: Aleksandr Bezzubikov <zuban32s@gmail.com> Co-authored-by: Michal Paszkowski <michal.paszkowski@outlook.com> Co-authored-by: Andrey Tretyakov <andrey.tretyakov@mail.com> Co-authored-by: Konrad Trifunovic <konrad.trifunovic@intel.com>
- Loading branch information
1 parent
933fefb
commit 25ee36c
Showing
3 changed files
with
136 additions
and
19 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
12 changes: 12 additions & 0 deletions
12
llvm/test/CodeGen/SPIRV/opencl/kernel_arg_type_function_metadata.ll
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,12 @@ | ||
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s | ||
|
||
; CHECK: %[[#TypeSampler:]] = OpTypeSampler | ||
define spir_kernel void @foo(i64 %sampler) !kernel_arg_addr_space !7 !kernel_arg_access_qual !8 !kernel_arg_type !9 !kernel_arg_type_qual !10 !kernel_arg_base_type !9 { | ||
entry: | ||
ret void | ||
} | ||
|
||
!7 = !{i32 0} | ||
!8 = !{!"none"} | ||
!9 = !{!"sampler_t"} | ||
!10 = !{!""} |
16 changes: 16 additions & 0 deletions
16
llvm/test/CodeGen/SPIRV/opencl/kernel_arg_type_module_metadata.ll
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,16 @@ | ||
; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s | ||
|
||
; CHECK: %[[#TypeSampler:]] = OpTypeSampler | ||
define spir_kernel void @foo(i64 %sampler) { | ||
entry: | ||
ret void | ||
} | ||
!opencl.kernels = !{!0} | ||
|
||
!0 = !{void (i64)* @foo, !1, !2, !3, !4, !5, !6} | ||
!1 = !{!"kernel_arg_addr_space", i32 0} | ||
!2 = !{!"kernel_arg_access_qual", !"none"} | ||
!3 = !{!"kernel_arg_type", !"sampler_t"} | ||
!4 = !{!"kernel_arg_type_qual", !""} | ||
!5 = !{!"kernel_arg_base_type", !"sampler_t"} | ||
!6 = !{!"kernel_arg_name", !"sampler"} |