-
Notifications
You must be signed in to change notification settings - Fork 790
[SYCL] Add support for eliminated arg masks in SYCLBIN kernel bundles #19163
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
steffenlarsen
merged 8 commits into
intel:sycl
from
steffenlarsen:steffe/syclbin_elim_arg_mask
Jul 2, 2025
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
09cda1e
[SYCL] Add support for eliminated arg masks in SYCLBIN kernel bundles
steffenlarsen c37c0f6
Merge branch 'sycl' into steffe/syclbin_elim_arg_mask
steffenlarsen dee759b
Fix merge mistake
steffenlarsen 6e83909
Merge remote-tracking branch 'intel/sycl' into steffe/syclbin_elim_ar…
steffenlarsen 31b0d36
Merge remote-tracking branch 'intel/sycl' into steffe/syclbin_elim_ar…
steffenlarsen bd680c0
Fix header
steffenlarsen f5bc838
Remove req after fix
steffenlarsen be35a07
Add xfail
steffenlarsen 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include "common.hpp" | ||
|
||
#include <sycl/usm.hpp> | ||
|
||
static constexpr size_t NUM = 1024; | ||
static constexpr size_t WGSIZE = 16; | ||
static constexpr float EPS = 0.001; | ||
|
||
int main(int argc, char *argv[]) { | ||
assert(argc == 2); | ||
|
||
sycl::queue Q; | ||
|
||
int Failed = CommonLoadCheck(Q.get_context(), argv[1]); | ||
|
||
#if defined(SYCLBIN_INPUT_STATE) | ||
auto KBInput = syclexp::get_kernel_bundle<sycl::bundle_state::input>( | ||
Q.get_context(), std::string{argv[1]}); | ||
auto KBExe = sycl::build(KBInput); | ||
#elif defined(SYCLBIN_OBJECT_STATE) | ||
auto KBObj = syclexp::get_kernel_bundle<sycl::bundle_state::object>( | ||
Q.get_context(), std::string{argv[1]}); | ||
auto KBExe = sycl::link(KBObj); | ||
#else // defined(SYCLBIN_EXECUTABLE_STATE) | ||
auto KBExe = syclexp::get_kernel_bundle<sycl::bundle_state::executable>( | ||
Q.get_context(), std::string{argv[1]}); | ||
#endif | ||
|
||
assert(KBExe.ext_oneapi_has_kernel("iota")); | ||
sycl::kernel IotaKern = KBExe.ext_oneapi_get_kernel("iota"); | ||
|
||
float *Ptr = sycl::malloc_shared<float>(NUM, Q); | ||
Q.submit([&](sycl::handler &CGH) { | ||
// First arugment is unused, but should still be passed, even if eliminated | ||
// by DAE. | ||
CGH.set_args(3.14f, Ptr); | ||
CGH.parallel_for(sycl::nd_range{{NUM}, {WGSIZE}}, IotaKern); | ||
}).wait_and_throw(); | ||
|
||
for (int I = 0; I < NUM; I++) { | ||
const float Truth = static_cast<float>(I); | ||
if (std::abs(Ptr[I] - Truth) > EPS) { | ||
std::cout << "Result: " << Ptr[I] << " expected " << I << "\n"; | ||
++Failed; | ||
} | ||
} | ||
sycl::free(Ptr, Q); | ||
return Failed; | ||
} |
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,10 @@ | ||
#include <sycl/sycl.hpp> | ||
|
||
namespace syclexp = sycl::ext::oneapi::experimental; | ||
namespace syclext = sycl::ext::oneapi; | ||
|
||
extern "C" SYCL_EXT_ONEAPI_FUNCTION_PROPERTY( | ||
(syclexp::nd_range_kernel<1>)) void iota(float, float *ptr) { | ||
size_t id = syclext::this_work_item::get_nd_item<1>().get_global_linear_id(); | ||
ptr[id] = static_cast<float>(id); | ||
} |
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,24 @@ | ||
//==--------- basic_executable.cpp --- SYCLBIN extension tests -------------==// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// REQUIRES: aspect-usm_device_allocations | ||
|
||
// -- Test for using a kernel from a SYCLBIN with a dead argument. | ||
|
||
// Due to the regression in https://github.com/intel/llvm/issues/18432 it will | ||
// fail to build the SYCLBIN with nvptx targets. Once this is fixed, | ||
// %{sycl_target_opts} should be added to the SYCLBIN generation run-line. | ||
// REQUIRES: target-spir | ||
|
||
// RUN: %clangxx --offload-new-driver -fsyclbin=executable %S/Inputs/dae_kernel.cpp -o %t.syclbin | ||
// RUN: %{build} -o %t.out | ||
// RUN: %{l0_leak_check} %{run} %t.out %t.syclbin | ||
|
||
#define SYCLBIN_EXECUTABLE_STATE | ||
|
||
#include "Inputs/dae.hpp" |
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,24 @@ | ||
//==--------- basic_input.cpp --- SYCLBIN extension tests ------------------==// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// REQUIRES: aspect-usm_device_allocations | ||
|
||
// -- Test for using a kernel from a SYCLBIN with a dead argument. | ||
|
||
// Due to the regression in https://github.com/intel/llvm/issues/18432 it will | ||
// fail to build the SYCLBIN with nvptx targets. Once this is fixed, | ||
// %{sycl_target_opts} should be added to the SYCLBIN generation run-line. | ||
// REQUIRES: target-spir | ||
|
||
// RUN: %clangxx --offload-new-driver -fsyclbin=input %S/Inputs/dae_kernel.cpp -o %t.syclbin | ||
// RUN: %{build} -o %t.out | ||
// RUN: %{l0_leak_check} %{run} %t.out %t.syclbin | ||
|
||
#define SYCLBIN_INPUT_STATE | ||
|
||
#include "Inputs/dae.hpp" |
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,24 @@ | ||
//==--------- basic_object.cpp --- SYCLBIN extension tests -----------------==// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// REQUIRES: aspect-usm_device_allocations | ||
|
||
// -- Test for using a kernel from a SYCLBIN with a dead argument. | ||
|
||
// Due to the regression in https://github.com/intel/llvm/issues/18432 it will | ||
// fail to build the SYCLBIN with nvptx targets. Once this is fixed, | ||
// %{sycl_target_opts} should be added to the SYCLBIN generation run-line. | ||
// REQUIRES: target-spir | ||
|
||
// RUN: %clangxx --offload-new-driver -fsyclbin=object %S/Inputs/dae_kernel.cpp -o %t.syclbin | ||
// RUN: %{build} -o %t.out | ||
// RUN: %{l0_leak_check} %{run} %t.out %t.syclbin | ||
|
||
#define SYCLBIN_OBJECT_STATE | ||
|
||
#include "Inputs/dae.hpp" |
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
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.
Uh oh!
There was an error while loading. Please reload this page.