This repository was archived by the owner on Mar 28, 2023. It is now read-only.
forked from llvm/llvm-test-suite
-
Notifications
You must be signed in to change notification settings - Fork 130
[SYCL] Add test for kernel program cache #594
Closed
Closed
Changes from all commits
Commits
Show all changes
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out | ||
// RUN: %GPU_RUN_PLACEHOLDER CreateMultipleRootDevices=2 NEOReadDebugKeys=1 %t.out | ||
// REQUIRES: (opencl || level_zero) && gpu | ||
|
||
//==---------- kernel_program_cache.cpp --- KernelProgramCache test --------==// | ||
// | ||
// 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> | ||
using namespace sycl; | ||
|
||
class empty_functor { | ||
public: | ||
void operator()(cl::sycl::nd_item<1> item) const {} | ||
}; | ||
|
||
template <class kernel_name, typename Functor> | ||
void test(cl::sycl::queue &queue, Functor functor) { | ||
auto bundle = cl::sycl::get_kernel_bundle<sycl::bundle_state::input>( | ||
queue.get_context()); | ||
|
||
queue.submit([&](cl::sycl::handler &cgh) { | ||
cgh.parallel_for(cl::sycl::nd_range<1>(10, 10), functor); | ||
}); | ||
|
||
auto bundleObject = cl::sycl::build(bundle, bundle.get_devices()); | ||
auto kernelID = cl::sycl::get_kernel_id<kernel_name>(); | ||
auto kernel = bundleObject.get_kernel(kernelID); | ||
} | ||
|
||
int main() { | ||
std::vector<device> devices = device::get_devices(info::device_type::gpu); | ||
sycl::context context(devices); | ||
sycl::queue queue(context, devices[0]); | ||
assert(devices.size() == 2); | ||
test<empty_functor>(queue, empty_functor{}); | ||
} |
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.