-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[SPIR-V] [NFC] Verify cl_intel_subgroup_local_block_io extension in SPIR-V BE #118796
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
VyacheslavLevytskyy
merged 3 commits into
llvm:main
from
vmaksimo:test-cl_intel_subgroup_local_block_io
Dec 9, 2024
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
156 changes: 156 additions & 0 deletions
156
llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_subgroups/cl_intel_subgroup_local_block_io.ll
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,156 @@ | ||
; Modified from: https://github.com/KhronosGroup/SPIRV-LLVM-Translator/test/extensions/INTEL/SPV_INTEL_subgroups/cl_intel_sub_groups.ll | ||
|
||
;Source: | ||
;void __kernel test(float2 x, uint c, | ||
; read_only image2d_t image_in, | ||
; write_only image2d_t image_out, | ||
; int2 coord, | ||
; __local uint* p, | ||
; __local ushort* sp, | ||
; __local uchar* cp, | ||
; __local ulong* lp) { | ||
; | ||
; uint2 ui2 = intel_sub_group_block_read2(image_in, coord); | ||
; intel_sub_group_block_write2(image_out, coord, ui2); | ||
; ui2 = intel_sub_group_block_read2(p); | ||
; intel_sub_group_block_write2(p, ui2); | ||
; | ||
; ushort2 us2 = intel_sub_group_block_read_us2(image_in, coord); | ||
; intel_sub_group_block_write_us2(image_out, coord, us2); | ||
; us2 = intel_sub_group_block_read_us2(sp); | ||
; intel_sub_group_block_write_us2(sp, us2); | ||
; | ||
; uchar2 uc2 = intel_sub_group_block_read_uc2(image_in, coord); | ||
; intel_sub_group_block_write_uc2(image_out, coord, uc2); | ||
; uc2 = intel_sub_group_block_read_uc2(cp); | ||
; intel_sub_group_block_write_uc2(cp, uc2); | ||
; | ||
; ulong2 ul2 = intel_sub_group_block_read_ul2(image_in, coord); | ||
; intel_sub_group_block_write_ul2(image_out, coord, ul2); | ||
; ul2 = intel_sub_group_block_read_ul2(lp); | ||
; intel_sub_group_block_write_ul2(lp, ul2); | ||
;} | ||
|
||
; RUN: not llc -O0 -mtriple=spirv32-unknown-unknown %s -o %t.spvt 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR | ||
|
||
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_INTEL_subgroups %s -o - | FileCheck %s | ||
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_INTEL_subgroups %s -o - -filetype=obj | spirv-val %} | ||
|
||
; CHECK-ERROR: LLVM ERROR: intel_sub_group_block_read2: the builtin requires the following SPIR-V extension: SPV_INTEL_subgroups | ||
|
||
; CHECK-DAG: Capability SubgroupBufferBlockIOINTEL | ||
; CHECK-DAG: Capability SubgroupImageBlockIOINTEL | ||
; CHECK: Extension "SPV_INTEL_subgroups" | ||
|
||
; CHECK-SPIRV-LABEL: Function | ||
; CHECK-SPIRV-LABEL: Label | ||
|
||
; CHECK: SubgroupImageBlockReadINTEL | ||
; CHECK: SubgroupImageBlockWriteINTEL | ||
; CHECK: SubgroupBlockReadINTEL | ||
; CHECK: SubgroupBlockWriteINTEL | ||
|
||
; CHECK: SubgroupImageBlockReadINTEL | ||
; CHECK: SubgroupImageBlockWriteINTEL | ||
; CHECK: SubgroupBlockReadINTEL | ||
; CHECK: SubgroupBlockWriteINTEL | ||
|
||
; CHECK: SubgroupImageBlockReadINTEL | ||
; CHECK: SubgroupImageBlockWriteINTEL | ||
; CHECK: SubgroupBlockReadINTEL | ||
; CHECK: SubgroupBlockWriteINTEL | ||
|
||
; CHECK: SubgroupImageBlockReadINTEL | ||
; CHECK: SubgroupImageBlockWriteINTEL | ||
; CHECK: SubgroupBlockReadINTEL | ||
; CHECK: SubgroupBlockWriteINTEL | ||
|
||
; CHECK-SPIRV-LABEL: Return | ||
|
||
%opencl.image2d_ro_t = type opaque | ||
%opencl.image2d_wo_t = type opaque | ||
|
||
; Function Attrs: convergent nounwind | ||
define spir_kernel void @test(<2 x float> %x, i32 %c, ptr addrspace(3) %image_in, ptr addrspace(3) %image_out, <2 x i32> %coord, ptr addrspace(3) %p, ptr addrspace(3) %sp, ptr addrspace(3) %cp, ptr addrspace(3) %lp) !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 !kernel_arg_name !6 { | ||
entry: | ||
%call4 = tail call spir_func <2 x i32> @_Z27intel_sub_group_block_read214ocl_image2d_roDv2_i(ptr addrspace(3) %image_in, <2 x i32> %coord) | ||
tail call spir_func void @_Z28intel_sub_group_block_write214ocl_image2d_woDv2_iDv2_j(ptr addrspace(3) %image_out, <2 x i32> %coord, <2 x i32> %call4) | ||
%call5 = tail call spir_func <2 x i32> @_Z27intel_sub_group_block_read2PU3AS1Kj(ptr addrspace(3) %p) | ||
tail call spir_func void @_Z28intel_sub_group_block_write2PU3AS1jDv2_j(ptr addrspace(3) %p, <2 x i32> %call5) | ||
|
||
%call6 = tail call spir_func <2 x i16> @_Z30intel_sub_group_block_read_us214ocl_image2d_roDv2_i(ptr addrspace(3) %image_in, <2 x i32> %coord) | ||
tail call spir_func void @_Z31intel_sub_group_block_write_us214ocl_image2d_woDv2_iDv2_t(ptr addrspace(3) %image_out, <2 x i32> %coord, <2 x i16> %call6) | ||
%call7 = tail call spir_func <2 x i16> @_Z30intel_sub_group_block_read_us2PU3AS1Kt(ptr addrspace(3) %sp) | ||
tail call spir_func void @_Z31intel_sub_group_block_write_us2PU3AS1tDv2_t(ptr addrspace(3) %sp, <2 x i16> %call7) | ||
|
||
%call8 = tail call spir_func <2 x i8> @_Z30intel_sub_group_block_read_uc214ocl_image2d_roDv2_i(ptr addrspace(3) %image_in, <2 x i32> %coord) | ||
tail call spir_func void @_Z31intel_sub_group_block_write_uc214ocl_image2d_woDv2_iDv2_h(ptr addrspace(3) %image_out, <2 x i32> %coord, <2 x i8> %call8) | ||
%call9 = tail call spir_func <2 x i8> @_Z30intel_sub_group_block_read_uc2PU3AS1Kh(ptr addrspace(3) %cp) | ||
tail call spir_func void @_Z31intel_sub_group_block_write_uc2PU3AS1hDv2_h(ptr addrspace(3) %cp, <2 x i8> %call9) | ||
|
||
%call10 = tail call spir_func <2 x i64> @_Z30intel_sub_group_block_read_ul214ocl_image2d_roDv2_i(ptr addrspace(3) %image_in, <2 x i32> %coord) | ||
tail call spir_func void @_Z31intel_sub_group_block_write_ul214ocl_image2d_woDv2_iDv2_m(ptr addrspace(3) %image_out, <2 x i32> %coord, <2 x i64> %call10) | ||
%call11 = tail call spir_func <2 x i64> @_Z30intel_sub_group_block_read_ul2PU3AS1Km(ptr addrspace(3) %lp) | ||
tail call spir_func void @_Z31intel_sub_group_block_write_ul2PU3AS1mDv2_m(ptr addrspace(3) %lp, <2 x i64> %call11) | ||
|
||
ret void | ||
} | ||
|
||
; Function Attrs: convergent | ||
declare spir_func <2 x i32> @_Z27intel_sub_group_block_read214ocl_image2d_roDv2_i(ptr addrspace(3), <2 x i32>) | ||
|
||
; Function Attrs: convergent | ||
declare spir_func void @_Z28intel_sub_group_block_write214ocl_image2d_woDv2_iDv2_j(ptr addrspace(3), <2 x i32>, <2 x i32>) | ||
|
||
; Function Attrs: convergent | ||
declare spir_func <2 x i32> @_Z27intel_sub_group_block_read2PU3AS1Kj(ptr addrspace(3)) | ||
|
||
; Function Attrs: convergent | ||
declare spir_func void @_Z28intel_sub_group_block_write2PU3AS1jDv2_j(ptr addrspace(3), <2 x i32>) | ||
|
||
; Function Attrs: convergent | ||
declare spir_func <2 x i16> @_Z30intel_sub_group_block_read_us214ocl_image2d_roDv2_i(ptr addrspace(3), <2 x i32>) | ||
|
||
; Function Attrs: convergent | ||
declare spir_func void @_Z31intel_sub_group_block_write_us214ocl_image2d_woDv2_iDv2_t(ptr addrspace(3), <2 x i32>, <2 x i16>) | ||
|
||
; Function Attrs: convergent | ||
declare spir_func <2 x i16> @_Z30intel_sub_group_block_read_us2PU3AS1Kt(ptr addrspace(3)) | ||
|
||
; Function Attrs: convergent | ||
declare spir_func void @_Z31intel_sub_group_block_write_us2PU3AS1tDv2_t(ptr addrspace(3), <2 x i16>) | ||
|
||
; Function Attrs: convergent | ||
declare spir_func <2 x i8> @_Z30intel_sub_group_block_read_uc214ocl_image2d_roDv2_i(ptr addrspace(3), <2 x i32>) | ||
|
||
; Function Attrs: convergent | ||
declare spir_func void @_Z31intel_sub_group_block_write_uc214ocl_image2d_woDv2_iDv2_h(ptr addrspace(3), <2 x i32>, <2 x i8>) | ||
|
||
; Function Attrs: convergent | ||
declare spir_func <2 x i8> @_Z30intel_sub_group_block_read_uc2PU3AS1Kh(ptr addrspace(3)) | ||
|
||
; Function Attrs: convergent | ||
declare spir_func void @_Z31intel_sub_group_block_write_uc2PU3AS1hDv2_h(ptr addrspace(3), <2 x i8>) | ||
|
||
; Function Attrs: convergent | ||
declare spir_func <2 x i64> @_Z30intel_sub_group_block_read_ul214ocl_image2d_roDv2_i(ptr addrspace(3), <2 x i32>) | ||
|
||
; Function Attrs: convergent | ||
declare spir_func void @_Z31intel_sub_group_block_write_ul214ocl_image2d_woDv2_iDv2_m(ptr addrspace(3), <2 x i32>, <2 x i64>) | ||
|
||
; Function Attrs: convergent | ||
declare spir_func <2 x i64> @_Z30intel_sub_group_block_read_ul2PU3AS1Km(ptr addrspace(3)) | ||
|
||
; Function Attrs: convergent | ||
declare spir_func void @_Z31intel_sub_group_block_write_ul2PU3AS1mDv2_m(ptr addrspace(3), <2 x i64>) | ||
|
||
!opencl.ocl.version = !{!0} | ||
!opencl.spir.version = !{!0} | ||
|
||
!0 = !{i32 1, i32 2} | ||
!1 = !{i32 0, i32 0, i32 1, i32 1, i32 0, i32 1, i32 1, i32 1, i32 1} | ||
!2 = !{!"none", !"none", !"read_only", !"write_only", !"none", !"none", !"none", !"none", !"none"} | ||
!3 = !{!"float2", !"uint", !"image2d_t", !"image2d_t", !"int2", !"uint*", !"ushort*", !"uchar*", !"ulong*"} | ||
!4 = !{!"float __attribute__((ext_vector_type(2)))", !"uint", !"image2d_t", !"image2d_t", !"int __attribute__((ext_vector_type(2)))", !"uint*", !"ushort*", !"uchar*", !"ulong*"} | ||
!5 = !{!"", !"", !"", !"", !"", !"", !"", !"", !""} | ||
!6 = !{!"x", !"c", !"image_in", !"image_out", !"coord", !"p", !"sp", !"cp", !"lp"} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, but what is a principal difference between this test and lets say https://github.com/llvm/llvm-project/blob/main/llvm/test/CodeGen/SPIRV/extensions/SPV_INTEL_subgroups/cl_intel_sub_groups.ll ? From the first glance they seem to test the same functionality, though the naming of cl_intel_sub_groups.ll is missleading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test does not have shuffle instructions.
But the actual main difference is that input pointer to the builtins is in Local (
addrspace (3)
) instead of Global (addrspace (1)
).cl_intel_subgroup_local_block_io
just allows to use local ptr instread of global ptr, so no different functionality is expected to be tested except address space