Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit d937a80

Browse files
authored
[SYCL] Test build options processing (#302)
Disable checks for JIT compile/link due to intel/llvm#3862 "Build options are ignored when JIT compile/link is done as separate commands"
1 parent f069e0f commit d937a80

6 files changed

+175
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: %clangxx -fsycl %s -o %t.out %debug_option
2+
// RUN: %GPU_RUN_PLACEHOLDER SYCL_PI_TRACE=-1 SYCL_PROGRAM_COMPILE_OPTIONS=-DENV_COMPILE_OPTS SYCL_PROGRAM_LINK_OPTIONS=-DENV_LINK_OPTS %t.out %GPU_CHECK_PLACEHOLDER
3+
// REQUIRES: gpu
4+
// UNSUPPORTED: cuda
5+
#include "kernel-bundle-merge-options.hpp"
6+
7+
// CHECK: piProgramBuild
8+
// CHECK-NEXT: <unknown>
9+
// CHECK-NEXT: <unknown>
10+
// CHECK-NEXT: <unknown>
11+
// CHECK-NEXT: <const char *>: -DENV_COMPILE_OPTS -vc-codegen
12+
13+
// TODO: Uncomment when build options are properly passed to compile and link
14+
// commands for kernel_bundle
15+
// xCHECK: piProgramCompile(
16+
// xCHECK-NEXT: <unknown>
17+
// xCHECK-NEXT: <unknown>
18+
// xCHECK-NEXT: <unknown>
19+
// xCHECK-NEXT: <const char *>: -DENV_COMPILE_OPTS -vc-codegen
20+
21+
// xCHECK: piProgramLink(
22+
// xCHECK-NEXT: <unknown>
23+
// xCHECK-NEXT: <unknown>
24+
// xCHECK-NEXT: <unknown>
25+
// xCHECK-NEXT: <const char *>: -DENV_LINK_OPTS -vc-codegen
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// RUN: %clangxx -fsycl %s -o %t.out %debug_option
2+
// RUN: %GPU_RUN_PLACEHOLDER SYCL_PI_TRACE=-1 %t.out %GPU_CHECK_PLACEHOLDER
3+
// REQUIRES: gpu
4+
// UNSUPPORTED: cuda
5+
6+
// Debug option -g is not passed to device code compiler when CL-style driver
7+
// is used and /DEBUG options is passed.
8+
// XFAIL: cl_options
9+
#include "kernel-bundle-merge-options.hpp"
10+
11+
// CHECK: piProgramBuild
12+
// CHECK-NEXT: <unknown>
13+
// CHECK-NEXT: <unknown>
14+
// CHECK-NEXT: <unknown>
15+
// CHECK-NEXT: <const char *>: -g -vc-codegen
16+
17+
// TODO: Uncomment when build options are properly passed to compile and link
18+
// commands for kernel_bundle
19+
// xCHECK: piProgramCompile(
20+
// xCHECK-NEXT: <unknown>
21+
// xCHECK-NEXT: <unknown>
22+
// xCHECK-NEXT: <unknown>
23+
// xCHECK-NEXT: <const char *>: -g -vc-codegen
24+
// xCHECK: piProgramLink(
25+
// xCHECK-NEXT: <unknown>
26+
// xCHECK-NEXT: <unknown>
27+
// xCHECK-NEXT: <unknown>
28+
// xCHECK-NEXT: <const char *>: -g -vc-codegen
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#define SYCL2020_DISABLE_DEPRECATION_WARNINGS
2+
#include <CL/sycl.hpp>
3+
#include <sycl/ext/intel/experimental/esimd.hpp>
4+
5+
class KernelName;
6+
7+
int main() {
8+
sycl::queue Queue;
9+
10+
sycl::device Dev = Queue.get_device();
11+
12+
sycl::context Ctx = Queue.get_context();
13+
14+
sycl::kernel_bundle KernelBundle =
15+
sycl::get_kernel_bundle<sycl::bundle_state::input>(Ctx, {Dev});
16+
17+
if (0)
18+
Queue.submit([&](sycl::handler &CGH) {
19+
CGH.single_task<KernelName>(
20+
[=]() SYCL_ESIMD_KERNEL {}); // Actual kernel does not matter
21+
});
22+
23+
try {
24+
auto ExecBundle = sycl::build(KernelBundle);
25+
} catch (...) {
26+
// Ignore all exceptions
27+
}
28+
29+
try {
30+
auto KernelBundleObject =
31+
sycl::compile(KernelBundle, KernelBundle.get_devices());
32+
33+
auto KernelBundleExecutable =
34+
sycl::link({KernelBundleObject}, KernelBundleObject.get_devices());
35+
} catch (...) {
36+
// Ignore all exceptions
37+
}
38+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: %clangxx -fsycl %s -o %t.out %debug_option
2+
// RUN: env SYCL_PI_TRACE=-1 SYCL_PROGRAM_COMPILE_OPTIONS=-DENV_COMPILE_OPTS SYCL_PROGRAM_LINK_OPTIONS=-DENV_LINK_OPTS SYCL_DEVICE_FILTER=%sycl_be %t.out | FileCheck %s
3+
// REQUIRES: gpu
4+
// UNSUPPORTED: cuda
5+
#include "program-merge-options.hpp"
6+
7+
// CHECK: piProgramBuild
8+
// CHECK-NEXT: <unknown>
9+
// CHECK-NEXT: <unknown>
10+
// CHECK-NEXT: <unknown>
11+
// CHECK-NEXT: <const char *>: -DENV_COMPILE_OPTS -vc-codegen
12+
13+
// TODO: Uncomment when build options are properly passed to compile and link
14+
// commands for program
15+
// xCHECK: piProgramCompile(
16+
// xCHECK-NEXT: <unknown>
17+
// xCHECK-NEXT: <unknown>
18+
// xCHECK-NEXT: <unknown>
19+
// xCHECK-NEXT: <const char *>: -DENV_COMPILE_OPTS -vc-codegen
20+
// xCHECK: piProgramLink(
21+
// xCHECK-NEXT: <unknown>
22+
// xCHECK-NEXT: <unknown>
23+
// xCHECK-NEXT: <unknown>
24+
// xCHECK-NEXT: <const char *>: -DENV_LINK_OPTS -vc-codegen
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// RUN: %clangxx -fsycl %s -o %t.out %debug_option
2+
// RUN: env SYCL_PI_TRACE=-1 SYCL_DEVICE_FILTER=%sycl_be %t.out | FileCheck %s
3+
// REQUIRES: gpu
4+
// UNSUPPORTED: cuda
5+
6+
// Debug option -g is not passed to device code compiler when CL-style driver
7+
// is used and /DEBUG options is passed.
8+
// XFAIL: cl_options
9+
#include "program-merge-options.hpp"
10+
11+
// CHECK: piProgramBuild
12+
// CHECK-NEXT: <unknown>
13+
// CHECK-NEXT: <unknown>
14+
// CHECK-NEXT: <unknown>
15+
// CHECK-NEXT: <const char *>: -DBUILD_OPTS -g -vc-codegen
16+
17+
// TODO: Uncomment when build options are properly passed to compile and link
18+
// commands for program
19+
// xCHECK: piProgramCompile(
20+
// xCHECK-NEXT: <unknown>
21+
// xCHECK-NEXT: <unknown>
22+
// xCHECK-NEXT: <unknown>
23+
// xCHECK-NEXT: <const char *>: -DCOMPILE_OPTS -vc-codegen
24+
// xCHECK: piProgramLink(
25+
// xCHECK-NEXT: <unknown>
26+
// xCHECK-NEXT: <unknown>
27+
// xCHECK-NEXT: <unknown>
28+
// xCHECK-NEXT: <const char *>: -cl-fast-relaxed-math -vc-codegen
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#define SYCL2020_DISABLE_DEPRECATION_WARNINGS
2+
3+
#include <CL/sycl.hpp>
4+
#include <sycl/ext/intel/experimental/esimd.hpp>
5+
6+
class KernelName;
7+
void submitKernel() {
8+
cl::sycl::queue q;
9+
q.submit([&](cl::sycl::handler &cgh) {
10+
cgh.single_task<KernelName>([]() SYCL_ESIMD_KERNEL {});
11+
});
12+
}
13+
14+
int main() {
15+
const cl::sycl::string_class CompileOpts{"-DCOMPILE_OPTS"};
16+
const cl::sycl::string_class LinkOpts{"-cl-fast-relaxed-math"};
17+
const cl::sycl::string_class BuildOpts{"-DBUILD_OPTS"};
18+
19+
try {
20+
cl::sycl::context Ctx;
21+
cl::sycl::program PrgA{Ctx};
22+
23+
PrgA.build_with_kernel_type<KernelName>(BuildOpts);
24+
25+
cl::sycl::program PrgB{Ctx};
26+
PrgB.compile_with_kernel_type<KernelName>(CompileOpts);
27+
28+
PrgB.link(LinkOpts);
29+
} catch (...) {
30+
// Ignore all exceptions
31+
}
32+
}

0 commit comments

Comments
 (0)