-
Notifications
You must be signed in to change notification settings - Fork 130
[SYCL] Tests for Level Zero linker flags #713
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // RUN: %clangxx -fsycl -D__SYCL_INTERNAL_API %s -o %t.out | ||
| // RUN: %GPU_RUN_PLACEHOLDER %t.out | ||
| // REQUIRES: level_zero | ||
| // | ||
| //==--- level-zero-link-flags.cpp - Error handling for link flags --==// | ||
| // | ||
| // The Level Zero backend does not accept any online linker options. | ||
| // This test validates that an error is raised if you attempt to pass any. | ||
| // | ||
| // 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 | ||
| // | ||
| //===--------------------------------------------------------------===// | ||
|
|
||
| #include <CL/sycl.hpp> | ||
|
|
||
| class MyKernel; | ||
|
|
||
| void test() { | ||
| sycl::queue Queue; | ||
| sycl::context Context = Queue.get_context(); | ||
|
|
||
| sycl::program Program(Context); | ||
| Program.compile_with_kernel_type<MyKernel>(); | ||
|
|
||
| try { | ||
| Program.link("-foo"); | ||
| assert(false && "Expected error linking program"); | ||
| } catch (const sycl::exception &e) { | ||
| assert((e.code() == sycl::errc::build) && "Wrong error code"); | ||
| } catch (...) { | ||
| assert(false && "Expected sycl::exception"); | ||
| } | ||
|
|
||
| Queue.submit([&](sycl::handler &CGH) { CGH.single_task<MyKernel>([=] {}); }) | ||
| .wait(); | ||
| } | ||
|
|
||
| int main() { | ||
| test(); | ||
|
|
||
| return 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| // RUN: %clangxx -fsycl %s -o %t.out | ||
| // RUN: %GPU_RUN_PLACEHOLDER SYCL_PROGRAM_LINK_OPTIONS=-foo %t.out | ||
| // REQUIRES: level_zero | ||
| // | ||
| // This test is disabled because the runtime does not currently pass linker | ||
| // flags from SYCL_PROGRAM_LINK_OPTIONS when the program calls "sycl::link()". | ||
| // This seems like a bug since the runtime passes linker flags from that | ||
| // environment variable in other cases when it links device code. | ||
|
||
| // | ||
| // XFAIL: level_zero | ||
| // | ||
| //==--- level-zero-link-flags.cpp - Error handling for link flags --==// | ||
| // | ||
| // The Level Zero backend does not accept any online linker options. | ||
| // This test validates that an error is raised if you attempt to pass any. | ||
| // | ||
| // 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 | ||
| // | ||
| //===--------------------------------------------------------------===// | ||
|
|
||
| #include <sycl/sycl.hpp> | ||
|
|
||
| class MyKernel; | ||
|
|
||
| void test() { | ||
| sycl::queue Queue; | ||
| sycl::context Context = Queue.get_context(); | ||
|
|
||
| auto BundleInput = | ||
| sycl::get_kernel_bundle<MyKernel, sycl::bundle_state::input>(Context); | ||
| auto BundleObject = sycl::compile(BundleInput); | ||
|
|
||
| try { | ||
| sycl::link(BundleObject); | ||
| assert(false && "Expected error linking kernel bundle"); | ||
| } catch (const sycl::exception &e) { | ||
| std::string Msg(e.what()); | ||
| assert((e.code() == sycl::errc::build) && "Wrong error code"); | ||
| assert(Msg.find("-foo") != std::string::npos); | ||
| } catch (...) { | ||
| assert(false && "Expected sycl::exception"); | ||
| } | ||
|
|
||
| Queue.submit([&](sycl::handler &CGH) { CGH.single_task<MyKernel>([=] {}); }) | ||
| .wait(); | ||
| } | ||
|
|
||
| int main() { | ||
| test(); | ||
|
|
||
| return 0; | ||
| } | ||
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.
@bso-intel: I saw that you recently added the XFAIL for "ze_debug". I assume it makes sense to remove this now because this test is now unsupported on Level Zero. Agree?
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.
Yes, I am okay to remove those XFAIL lines as long as Sergey agrees with // UNSUPPORTED: level_zero