-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL][ESIMD] Remove wrapping buffer objects into images. #2746
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
4 commits
Select commit
Hold shift + click to select a range
57baaee
[SYCL][ESIMD] Add 'esimd_acc_ptr' parameter attribute to FE.
kbobrovs f768b3d
[SYCL][ESIMD] Refactor ESIMD kernel support in FE.
kbobrovs 69d8d7a
[SYCL][ESIMD] LowerESIMD: add 'buffer_t' MD for accessor kernel argum…
kbobrovs cb221b6
[SYCL][ESIMD] RT: remove wrapping buffer objects into images.
kbobrovs 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// RUN: %clang_cc1 -fsycl -fsycl-explicit-simd -fsycl-is-device \ | ||
// RUN: -internal-isystem %S/Inputs -triple spir64-unknown-unknown-sycldevice \ | ||
// RUN: -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s | ||
|
||
// This test checks | ||
// 1) proper metadata generation for accessors used in ESIMD | ||
// kernels: | ||
// - Proper 'kernel_arg_accessor_ptr' metadata is generated by the FE for | ||
// ESIMD kernels | ||
// - Pointers originating from accessors are marked with 'buffer_t' and proper | ||
// argument kind. | ||
// 2) __init_esimd function is used to initialize the accessor rather than | ||
// __init. | ||
|
||
#include "sycl.hpp" | ||
|
||
using namespace cl::sycl; | ||
|
||
void test(int val) { | ||
queue q; | ||
q.submit([&](handler &h) { | ||
cl::sycl::accessor<int, 1, cl::sycl::access::mode::read_write> accessorA; | ||
cl::sycl::accessor<int, 1, cl::sycl::access::mode::read> accessorB; | ||
|
||
h.single_task<class esimd_kernel>( | ||
[=]() __attribute__((sycl_explicit_simd)) { | ||
accessorA.use(val); | ||
accessorB.use(); | ||
}); | ||
}); | ||
|
||
// --- Name | ||
// CHECK-LABEL: define spir_kernel void @"_ZTSZZ4testiENK3$_0clERN2cl4sycl7handlerEE12esimd_kernel"( | ||
// --- Signature | ||
// CHECK: i32 addrspace(1)* "VCArgumentDesc"="buffer_t" "VCArgumentIOKind"="0" "VCArgumentKind"="2" %_arg_, | ||
// CHECK: i32 "VCArgumentDesc" "VCArgumentIOKind"="0" "VCArgumentKind"="0" %_arg_1, | ||
// CHECK: i32 addrspace(1)* "VCArgumentDesc"="buffer_t" "VCArgumentIOKind"="0" "VCArgumentKind"="2" %_arg_3) | ||
// --- Attributes | ||
// CHECK: {{.*}} !kernel_arg_accessor_ptr ![[ACC_PTR_ATTR:[0-9]+]] !sycl_explicit_simd !{{[0-9]+}} {{.*}}{ | ||
// --- init_esimd call is expected instead of __init: | ||
// CHECK: call spir_func void @{{.*}}__init_esimd{{.*}}(%"{{.*}}sycl::accessor" addrspace(4)* %{{[0-9]+}}, i32 addrspace(1)* %{{[0-9]+}}) | ||
// CHECK-LABEL: } | ||
// CHECK: ![[ACC_PTR_ATTR]] = !{i1 true, i1 false, i1 true} | ||
} |
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.
Could you please check that
__init_esimd
is called instead of regular__init
in case of ESIMD kernel?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 is basically proven by the fact that an accessor is translated into a single pointer arg (as in __init_esimd) rather than 4 (as in __init). I'll see if I can make direct check. Do you have suggestions, BTW?
Uh oh!
There was an error while loading. Please reload this page.
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.
I don't remember exactly, but I was under impression that we don't enable early optimizations for ESIMD mode, am I right?
In case if IR is not optimized, I would just check that there are two calls to
__init_esimd function
, i.e. (the following LLVM IR may contain errors):Or you can even check which argument of the kernel is passed like here
llvm/clang/test/CodeGenSYCL/accessor_inheritance.cpp
Line 84 in 3b8af22
In case if IR is optimized for ESIMD mode, we can check presence of
__init_esimd
in non-optimized IR.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.
ok, thanks. Will try