-
Notifications
You must be signed in to change notification settings - Fork 731
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
[SYCL] Treat "ar" image format as PI_DEVICE_BINARY_TYPE_NATIVE #12587
Merged
aelovikov-intel
merged 9 commits into
intel:sycl
from
aelovikov-intel:support-ar-as-native
Feb 5, 2024
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
aedcf7a
[NFCI][SYCL] Refactor getBinaryImageFormat
aelovikov-intel 2e2dc77
[SYCL] Treat "ar" image format as PI_DEVICE_BINARY_TYPE_NATIVE
aelovikov-intel f017f4a
Address code-review comments
aelovikov-intel a445c43
Merge remote-tracking branch 'my/refactor-get-format' into HEAD
aelovikov-intel 286c3bb
Move code around
aelovikov-intel 64e0fd8
Add an E2E test
aelovikov-intel f917715
clang-format the test
aelovikov-intel 908427f
ocloc must be present to support AOT
aelovikov-intel 08f0e39
Merge remote-tracking branch 'origin/sycl' into HEAD
aelovikov-intel 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 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,89 @@ | ||
// Don't use normal %{run} as we need to control cache directory removal and | ||
// cannot do that reliably when number of devices is unknown. | ||
// | ||
// REQUIRES: level_zero, ocloc | ||
// | ||
// DEFINE: %{cache_vars} = env SYCL_CACHE_PERSISTENT=1 SYCL_CACHE_TRACE=1 SYCL_CACHE_DIR=%t/cache_dir | ||
// DEFINE: %{build_cmd} = %{build} | ||
// RUN: mkdir -p %t/cache_dir | ||
// | ||
// The following block of code should be copy-pasted as-is to verify different | ||
// JIT/AOT options. Don't know how to avoid code duplication. | ||
// ****************************** | ||
// Check the logs first. | ||
// RUN: %{build_cmd} -DVALUE=1 -o %t.out | ||
// RUN: rm -rf %t/cache_dir/* | ||
// RUN: %{cache_vars} %{run-unfiltered-devices} %t.out 2>&1 | FileCheck %s %if windows %{ --check-prefixes=CHECK,CHECK-WIN %} | ||
// | ||
// Now try to substitute the cached image and verify it is actually taken and | ||
// the code/binary there is executed. | ||
// RUN: mv %t/cache_dir/*/*/*/*/*.bin %t.value1.bin | ||
// RUN: rm -rf %t/cache_dir/* | ||
// RUN: %{build_cmd} -DVALUE=2 -o %t.out | ||
// RUN: %{cache_vars} %{run-unfiltered-devices} %t.out 2>&1 | FileCheck %s --check-prefixes RESULT2 | ||
// RUN: mv %t.value1.bin %t/cache_dir/*/*/*/*/*.bin | ||
// RUN: %{cache_vars} %{run-unfiltered-devices} %t.out 2>&1 | FileCheck %s --check-prefixes RESULT1 | ||
// ****************************** | ||
// | ||
// REDEFINE: %{build_cmd} = %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device acm-g10" %s | ||
// ****************************** | ||
// Check the logs first. | ||
// RUN: %{build_cmd} -DVALUE=1 -o %t.out | ||
// RUN: rm -rf %t/cache_dir/* | ||
// RUN: %{cache_vars} %{run-unfiltered-devices} %t.out 2>&1 | FileCheck %s %if windows %{ --check-prefixes=CHECK,CHECK-WIN %} | ||
// | ||
// Now try to substitute the cached image and verify it is actually taken and | ||
// the code/binary there is executed. | ||
// RUN: mv %t/cache_dir/*/*/*/*/*.bin %t.value1.bin | ||
// RUN: rm -rf %t/cache_dir/* | ||
// RUN: %{build_cmd} -DVALUE=2 -o %t.out | ||
// RUN: %{cache_vars} %{run-unfiltered-devices} %t.out 2>&1 | FileCheck %s --check-prefixes RESULT2 | ||
// RUN: mv %t.value1.bin %t/cache_dir/*/*/*/*/*.bin | ||
// RUN: %{cache_vars} %{run-unfiltered-devices} %t.out 2>&1 | FileCheck %s --check-prefixes RESULT1 | ||
// ****************************** | ||
// | ||
// REDEFINE: %{build_cmd} = %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device acm-g10,acm-g11" %s | ||
// ****************************** | ||
// Check the logs first. | ||
// RUN: %{build_cmd} -DVALUE=1 -o %t.out | ||
// RUN: rm -rf %t/cache_dir/* | ||
// RUN: %{cache_vars} %{run-unfiltered-devices} %t.out 2>&1 | FileCheck %s %if windows %{ --check-prefixes=CHECK,CHECK-WIN %} | ||
// | ||
// Now try to substitute the cached image and verify it is actually taken and | ||
// the code/binary there is executed. | ||
// RUN: mv %t/cache_dir/*/*/*/*/*.bin %t.value1.bin | ||
// RUN: rm -rf %t/cache_dir/* | ||
// RUN: %{build_cmd} -DVALUE=2 -o %t.out | ||
// RUN: %{cache_vars} %{run-unfiltered-devices} %t.out 2>&1 | FileCheck %s --check-prefixes RESULT2 | ||
// RUN: mv %t.value1.bin %t/cache_dir/*/*/*/*/*.bin | ||
// RUN: %{cache_vars} %{run-unfiltered-devices} %t.out 2>&1 | FileCheck %s --check-prefixes RESULT1 | ||
// ****************************** | ||
|
||
// CHECK: Code caching: device binary has been cached: [[BIN_FILE:.*]] | ||
// CHECK-WIN: Code caching: using cached device binary: [[BIN_FILE]] | ||
// CHECK-WIN: Code caching: using cached device binary: [[BIN_FILE]] | ||
|
||
// RESULT1: Result (0): 1 | ||
// RESULT1: Result (1): 1 | ||
// RESULT1: Result (2): 1 | ||
|
||
// RESULT2: Result (0): 2 | ||
// RESULT2: Result (1): 2 | ||
// RESULT2: Result (2): 2 | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
int main() { | ||
for (int i = 0; i < 3; ++i) { | ||
sycl::buffer<int, 1> b{1}; | ||
sycl::queue{} | ||
.submit([&](sycl::handler &cgh) { | ||
sycl::accessor acc{b, cgh}; | ||
cgh.single_task([=]() { acc[0] = VALUE; }); | ||
}) | ||
.wait(); | ||
std::cout << "Result (" << i << "): " << sycl::host_accessor{b}[0] | ||
<< std::endl; | ||
} | ||
return 0; | ||
} |
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.
Small nit; I would prefer to have the comment outside the loop as having it inside the loop without brackets makes it hard to read... Unless you're used to Python code. 😉
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'll keep as-is as it matches surrounding code better.