-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1501 from RossBrunton/ross/kerneltests
[Testing] Spec clarifications and testing updates for kernel
- Loading branch information
Showing
21 changed files
with
347 additions
and
10 deletions.
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
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
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
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
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,27 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See LICENSE.TXT | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
struct KernelFunctor { | ||
void operator()(sycl::nd_item<3>) const {} | ||
void operator()(sycl::item<3>) const {} | ||
|
||
auto get(sycl::ext::oneapi::experimental::properties_tag) { | ||
return sycl::ext::oneapi::experimental::properties{ | ||
sycl::ext::oneapi::experimental::work_group_size<4, 4, 4>}; | ||
} | ||
}; | ||
|
||
int main() { | ||
sycl::queue myQueue; | ||
myQueue.submit([&](sycl::handler &cgh) { | ||
cgh.parallel_for<class FixedWgSize>(sycl::range<3>(8, 8, 8), | ||
KernelFunctor{}); | ||
}); | ||
|
||
myQueue.wait(); | ||
return 0; | ||
} |
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,42 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See LICENSE.TXT | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#include <stdint.h> | ||
#include <sycl/sycl.hpp> | ||
|
||
struct Struct { | ||
uint32_t a; | ||
uint32_t b; | ||
}; | ||
|
||
int main() { | ||
sycl::queue deviceQueue; | ||
sycl::range<1> numOfItems{1}; | ||
|
||
uint32_t output = 0; | ||
|
||
volatile bool test_bool = true; | ||
volatile uint8_t test_u8 = 2; | ||
volatile uint32_t test_u32 = 3; | ||
volatile uint64_t test_u64 = 5; | ||
Struct test_struct{7, 5}; | ||
volatile float test_float = 11; | ||
|
||
{ | ||
sycl::buffer output_buff(&output, sycl::range(1)); | ||
deviceQueue.submit([&](sycl::handler &cgh) { | ||
sycl::accessor acc{output_buff, cgh, sycl::read_write}; | ||
auto kern = [=](sycl::id<1> id) { | ||
acc[id] = 100 + (test_bool ? 1 : 0) * test_u8 * test_u32 * | ||
test_u64 * test_struct.a * | ||
static_cast<uint32_t>(test_float); | ||
}; | ||
cgh.parallel_for<class Foo>(numOfItems, kern); | ||
}); | ||
deviceQueue.wait(); | ||
} | ||
|
||
return output == 2410; | ||
} |
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,35 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See LICENSE.TXT | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
struct KernelFunctor { | ||
sycl::accessor<size_t, 1, sycl::access_mode::write> Acc; | ||
|
||
KernelFunctor(sycl::accessor<size_t, 1, sycl::access_mode::write> Acc) | ||
: Acc(Acc) {} | ||
|
||
void operator()(sycl::nd_item<1> NdItem) const { | ||
auto SG = NdItem.get_sub_group(); | ||
if (NdItem.get_global_linear_id() == 0) { | ||
Acc[0] = SG.get_local_linear_range(); | ||
} | ||
} | ||
}; | ||
|
||
int main() { | ||
sycl::queue myQueue; | ||
size_t output = 0; | ||
sycl::buffer output_buff(&output, sycl::range(1)); | ||
|
||
myQueue.submit([&](sycl::handler &cgh) { | ||
sycl::accessor acc{output_buff, cgh, sycl::write_only, sycl::no_init}; | ||
cgh.parallel_for<class FixedSgSize>(sycl::nd_range<1>(8, 2), | ||
KernelFunctor{acc}); | ||
}); | ||
|
||
myQueue.wait(); | ||
return 0; | ||
} |
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
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
Oops, something went wrong.