-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL] Support standard library functions for AOT compilation #2012
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
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 |
---|---|---|
|
@@ -22,6 +22,16 @@ or, in case of Windows: | |
clang++ -fsycl -c main.cpp -o main.obj | ||
clang++ -fsycl main.obj %SYCL_INSTALL%/lib/libsycl-msvc.o -o a.exe | ||
|
||
For Ahead-Of-Time compilation (AOT), fallback libraries (object files) | ||
must be linked as well: | ||
|
||
.. code: | ||
clang++ -fsycl -c -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice \ | ||
main.cpp -o main.o | ||
clang++ -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice \ | ||
main.o $(SYCL_INSTALL)/lib/libsycl-glibc.o \ | ||
$(SYCL_INSTALL)/lib/libsycl-fallback-cassert.o -o a.out | ||
|
||
List of supported functions from C standard library: | ||
- assert macro (from <assert.h> or <cassert>) | ||
- logf, log (from <math.h> or <cmath>) | ||
|
@@ -270,6 +280,6 @@ Every set of functions is implemented in a separate fallback | |
library. For example, a fallback for `cl_intel_devicelib_cassert` | ||
extension is provided as `libsycl-fallback-cassert.spv` | ||
|
||
NOTE that AOT compilation is not yet supported. Driver will have to | ||
check for extension support and link the corresponding SPIR-V fallback | ||
implementation, but this is not implemented yet. | ||
For AOT compilation, fallback libraries are also provided as object | ||
files (e.g. `libsycl-fallback-cassert.o`). Device code in these object | ||
files is identical to the the `*.spv` files. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd expect the device code in .o files to be llvm IR bitcode, if it is produced with '-fsycl -c'. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess Andrew meant that the device code in the object files is identical to the device code in the SPV files, but the format is unspecified. It should be LLVM IR bitcode, not SPIR-V, inside the fallback object files. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vzakhari is correct. I will reword this section. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. Please check if it is OK now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM, thanks |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// REQUIRES: opencl-aot, cpu, linux | ||
|
||
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice %S/assert.cpp %sycl_libs_dir/libsycl-glibc.o %sycl_libs_dir/libsycl-fallback-cassert.o -o %t.aot.out | ||
// RUN: %CPU_RUN_PLACEHOLDER %t.aot.out >%t.aot.msg | ||
// RUN: FileCheck %S/assert.cpp --input-file %t.aot.msg --check-prefixes=CHECK-MESSAGE |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// REQUIRES: opencl-aot, cpu | ||
// UNSUPPORTED: windows | ||
|
||
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice %S/cmath_test.cpp %sycl_libs_dir/libsycl-cmath.o %sycl_libs_dir/libsycl-fallback-cmath.o -o %t.cmath.out | ||
// RUN: %CPU_RUN_PLACEHOLDER %t.cmath.out | ||
|
||
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice %S/cmath_fp64_test.cpp %sycl_libs_dir/libsycl-cmath-fp64.o %sycl_libs_dir/libsycl-fallback-cmath-fp64.o -o %t.cmath.fp64.out | ||
// RUN: %CPU_RUN_PLACEHOLDER %t.cmath.fp64.out | ||
|
||
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice %S/std_complex_math_test.cpp %sycl_libs_dir/libsycl-complex.o %sycl_libs_dir/libsycl-cmath.o %sycl_libs_dir/libsycl-fallback-complex.o %sycl_libs_dir/libsycl-fallback-cmath.o -o %t.complex.out | ||
// RUN: %CPU_RUN_PLACEHOLDER %t.complex.out | ||
|
||
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice %S/std_complex_math_fp64_test.cpp %sycl_libs_dir/libsycl-complex-fp64.o %sycl_libs_dir/libsycl-cmath-fp64.o %sycl_libs_dir/libsycl-fallback-complex-fp64.o %sycl_libs_dir/libsycl-fallback-cmath-fp64.o -o %t.complex.fp64.out | ||
// RUN: %CPU_RUN_PLACEHOLDER %t.complex.fp64.out |
Uh oh!
There was an error while loading. Please reload this page.