Skip to content

[SYCL] Add runtime and E2E tests for optional kernel features AOT #13284

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

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7e31668
[SYCL] Add support for multiple filtered outputs in sycl-post-link
jzc Feb 15, 2024
d3439ad
Merge remote-tracking branch 'intel/sycl' into sycl-post-link-filtering
jzc Feb 15, 2024
98c0387
Fix build after merge
jzc Feb 15, 2024
84f208d
Add some newlines
jzc Feb 15, 2024
ca6005a
Add a test description
jzc Feb 22, 2024
3d471e6
Update -o description
jzc Feb 22, 2024
296596c
Add comment for isTargetCompatibleWithModule
jzc Feb 22, 2024
a650294
Add missing message for assert
jzc Feb 22, 2024
35559c4
Ensure the specified target is a recognized target
jzc Feb 22, 2024
b79a8a3
Merge remote-tracking branch 'intel/sycl' into sycl-post-link-filtering
jzc Feb 22, 2024
88f2083
Merge remote-tracking branch 'intel/sycl' into sycl-post-link-filtering
jzc Mar 11, 2024
bf7e493
Update driver to pass architecture to sycl-post-link
jzc Mar 12, 2024
02949ea
Revert "Update driver to pass architecture to sycl-post-link"
jzc Mar 12, 2024
f088450
Use function instead of constructor
jzc Mar 12, 2024
6f10b42
Change unrecognized target handling
jzc Mar 12, 2024
fb25de6
Revert "Revert "Update driver to pass architecture to sycl-post-link""
jzc Mar 12, 2024
73dd265
Add unrecognized target test
jzc Mar 14, 2024
a3b45bc
Merge remote-tracking branch 'intel/sycl' into sycl-post-link-filtering
jzc Mar 14, 2024
4d2f88d
Address review comments
jzc Mar 22, 2024
837d8e0
Merge remote-tracking branch 'intel/sycl' into sycl-post-link-filtering
jzc Mar 22, 2024
035539c
Remove unnecessary flags from driver test
jzc Mar 22, 2024
40a8447
Simplify if statement
jzc Mar 22, 2024
456a22e
Fix up includes
jzc Mar 22, 2024
07fd45e
Move include
jzc Mar 25, 2024
28ceb84
Update comment
jzc Mar 25, 2024
e4d6c24
Update getSYCLDeviceRequirements name
jzc Mar 25, 2024
3dea0c6
Pass target info to sycl-post-link for CPU AOT
jzc Mar 28, 2024
2e3d46d
Merge remote-tracking branch 'intel/sycl' into sycl-post-link-filtering
jzc Apr 4, 2024
44723a4
Merge remote-tracking branch 'jzc/sycl-post-link-filtering' into e2e-…
jzc Apr 4, 2024
4c0f432
Merge remote-tracking branch 'intel/sycl' into e2e-optional-kernel-fe…
jzc Apr 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10634,6 +10634,8 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
std::string OutputArg = Output.getFilename();
if (T.getSubArch() == llvm::Triple::SPIRSubArch_gen && Device.data())
OutputArg = ("intel_gpu_" + Device + "," + OutputArg).str();
else if (T.getSubArch() == llvm::Triple::SPIRSubArch_x86_64)
OutputArg = "spir64_x86_64," + OutputArg;

addArgs(CmdArgs, TCArgs, {"-o", OutputArg});

Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/SYCLLowerIR/DeviceConfigFile.td
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def : TargetInfo<"__TestDeprecatedAspectList",

def : TargetInfo<"spir64", [], [], "", "", 1>;
def : TargetInfo<"spir64_gen", [], [], "", "", 1>;
def : TargetInfo<"spir64_x86_64", [], [], "", "", 1>;
def : TargetInfo<"spir64_x86_64", [AspectFp64, AspectAtomic64], [4, 8, 16, 32, 64], "", "", 1>;
def : TargetInfo<"spir64_fpga", [], [], "", "", 1>;
def : TargetInfo<"x86_64", [], [], "", "", 1>;
// Examples of how to use a combination of explicitly specified values + predefined lists
Expand Down
71 changes: 71 additions & 0 deletions sycl/test-e2e/OptionalKernelFeatures/sg-size-aot.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// REQUIRES: cpu
// RUN: %clangxx %s -fsycl -fsycl-targets=spir64_x86_64 -o %t.out
// RUN: %{run} %t.out
#include <cstdio>
#include <iostream>

#include <sycl/sycl.hpp>

using namespace sycl;

template <int N>
class kernel_name;

template <size_t... Ns>
struct SubgroupDispatcher {
std::vector<std::pair<size_t, size_t>> fails;
SubgroupDispatcher(queue &q) : q(q) {}

void operator()(const std::vector<size_t> &v) {
for (auto i : v)
(*this)(i);
}

void operator()(size_t n) {
(dispatch<Ns>(n), ...);
}

private:
queue &q;

template <size_t size>
void dispatch(size_t n) {
if (n == size) {
buffer<size_t, 1> buf(1);
q.submit([&](handler& cgh) {
accessor acc { buf, cgh };
cgh.parallel_for<kernel_name<size>>(nd_range<1>(1, 1), [=](auto item) [[intel::reqd_sub_group_size(size)]] {
acc[0] = item.get_sub_group().get_max_local_range()[0];
});
});
host_accessor ha { buf };
if (ha[0] != size)
fails.push_back({ha[0], size});
}
}
};

int main() {
queue q;
auto ctx = q.get_context();
auto dev = q.get_device();
auto sizes = dev.get_info<sycl::info::device::sub_group_sizes>();
std::cout << " sub-group sizes supported by the device: " << sizes[0];
for (int i = 1; i < sizes.size(); ++i) {
std::cout << ", " << sizes[i];
}
std::cout << '\n';

using dispatcher_t = SubgroupDispatcher<4, 8, 16, 32, 64, 128>;
dispatcher_t dispatcher(q);
dispatcher(sizes);
if (dispatcher.fails.size() > 0) {
for (auto [actual, expected] : dispatcher.fails) {
std::cout
<< "actual: " << actual << "\n"
<< "expected: " << expected << "\n";
}
} else {
std::cout << "pass\n";
}
}