-
Notifications
You must be signed in to change notification settings - Fork 772
[SYCL][NFC] Use -fsyntax-only more extensively in LIT tests #8144
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 all commits
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 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,10 +1,10 @@ | ||||||||||
// REQUIRES: cuda | ||||||||||
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s -o %t.out | ||||||||||
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note -D__SYCL_INTERNAL_API %s -o %t.out | ||||||||||
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s | ||||||||||
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note -D__SYCL_INTERNAL_API %s | ||||||||||
// | ||||||||||
/// Also test the experimental CUDA interop interface | ||||||||||
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note -DSYCL_EXT_ONEAPI_BACKEND_CUDA_EXPERIMENTAL %s -o %t.out | ||||||||||
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note -D__SYCL_INTERNAL_API -DSYCL_EXT_ONEAPI_BACKEND_CUDA_EXPERIMENTAL %s -o %t.out | ||||||||||
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note -DSYCL_EXT_ONEAPI_BACKEND_CUDA_EXPERIMENTAL %s | ||||||||||
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note -D__SYCL_INTERNAL_API -DSYCL_EXT_ONEAPI_BACKEND_CUDA_EXPERIMENTAL %s | ||||||||||
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. Not related to this particular file, it's just when I realized it... What if a mistake is done inside the 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. If I understand correctly, it is likely that SYCL RT (or unit-tests) won't be built at all. For example, if you add something new into llvm/sycl/include/sycl/detail/pi.h Lines 1982 to 1985 in e833806
|
||||||||||
// expected-no-diagnostics | ||||||||||
|
||||||||||
// Test for legacy and experimental CUDA interop API | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// RUN: %clangxx -fsycl %s -o %t.out | ||
// RUN: %clangxx -fsycl -fsyntax-only %s | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
// This test checks presence of macros for available extensions. | ||
// RUN: %clangxx -fsycl %s -o %t.out | ||
// RUN: %t.out | ||
// RUN: %clangxx -fsycl -fsyntax-only %s | ||
|
||
#include <iostream> | ||
#include <sycl/sycl.hpp> | ||
int main() { | ||
|
||
#if SYCL_BACKEND_OPENCL == 1 | ||
std::cout << "SYCL_BACKEND_OPENCL=1" << std::endl; | ||
constexpr bool backend_opencl_macro_defined = true; | ||
#else | ||
std::cerr << "SYCL_BACKEND_OPENCL!=1" << std::endl; | ||
exit(1); | ||
constexpr bool backend_opencl_macro_defined = false; | ||
#endif | ||
|
||
#if SYCL_EXT_ONEAPI_SUB_GROUP_MASK == 1 | ||
std::cout << "SYCL_EXT_ONEAPI_SUB_GROUP_MASK=1" << std::endl; | ||
constexpr bool sub_group_mask_macro_defined = true; | ||
#else | ||
std::cerr << "SYCL_EXT_ONEAPI_SUB_GROUP_MASK!=1" << std::endl; | ||
exit(1); | ||
constexpr bool sub_group_mask_macro_defined = false; | ||
#endif | ||
|
||
#if SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO == 3 | ||
std::cout << "SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO=3" << std::endl; | ||
constexpr bool backend_level_zero_macro_defined = true; | ||
#else | ||
std::cerr << "SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO!=3" << std::endl; | ||
exit(1); | ||
constexpr bool backend_level_zero_macro_defined = false; | ||
#endif | ||
exit(0); | ||
|
||
int main() { | ||
static_assert(backend_opencl_macro_defined); | ||
static_assert(sub_group_mask_macro_defined); | ||
static_assert(backend_level_zero_macro_defined); | ||
|
||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
// This test checks presence of macros for available extensions. | ||
// RUN: %clangxx -fsycl %s -o %t.out | ||
// RUN: %t.out | ||
// RUN: %clangxx -fsycl -fsyntax-only %s | ||
// REQUIRES: cuda_be | ||
#include <iostream> | ||
|
||
#include <sycl/sycl.hpp> | ||
int main() { | ||
|
||
#if SYCL_EXT_ONEAPI_BACKEND_CUDA == 1 | ||
std::cout << "SYCL_EXT_ONEAPI_BACKEND_CUDA=1" << std::endl; | ||
constexpr bool macro_defined = true; | ||
#else | ||
std::cerr << "SYCL_EXT_ONEAPI_BACKEND_CUDA!=1" << std::endl; | ||
exit(1); | ||
constexpr bool macro_defined = false; | ||
#endif | ||
exit(0); | ||
|
||
int main() { | ||
static_assert(macro_defined); | ||
|
||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
// This test checks presence of macros for available extensions. | ||
// RUN: %clangxx -fsycl %s -o %t.out | ||
// RUN: %t.out | ||
// RUN: %clangxx -fsycl -fsyntax-only %s | ||
// REQUIRES: esimd_emulator_be | ||
#include <iostream> | ||
|
||
#include <sycl/sycl.hpp> | ||
int main() { | ||
|
||
#if SYCL_EXT_INTEL_BACKEND_ESIMD_EMULATOR == 1 | ||
std::cout << "SYCL_EXT_INTEL_BACKEND_ESIMD_EMULATOR=1" << std::endl; | ||
constexpr bool macro_defined = true; | ||
#else | ||
std::cerr << "SYCL_EXT_INTEL_BACKEND_ESIMD_EMULATOR!=1" << std::endl; | ||
exit(1); | ||
constexpr bool macro_defined = false; | ||
#endif | ||
exit(0); | ||
|
||
int main() { | ||
static_assert(macro_defined); | ||
|
||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
// This test checks presence of macros for available extensions. | ||
// RUN: %clangxx -fsycl %s -o %t.out | ||
// RUN: %t.out | ||
// RUN: %clangxx -fsycl -fsyntax-only %s | ||
// REQUIRES: hip_be | ||
#include <iostream> | ||
|
||
#include <sycl/sycl.hpp> | ||
int main() { | ||
|
||
#if SYCL_EXT_ONEAPI_BACKEND_HIP == 1 | ||
std::cout << "SYCL_EXT_ONEAPI_BACKEND_HIP=1" << std::endl; | ||
constexpr bool macro_defined = true; | ||
#else | ||
std::cerr << "SYCL_EXT_ONEAPI_BACKEND_HIP!=1" << std::endl; | ||
exit(1); | ||
constexpr bool macro_defined = false; | ||
#endif | ||
exit(0); | ||
|
||
int main() { | ||
static_assert(macro_defined); | ||
|
||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
// RUN: %clangxx -fsycl -c %s -o %t.out -Wno-deprecated -fno-operator-names | ||
// RUN: %clangxx -fsycl -fsyntax-only %s -Wno-deprecated -fno-operator-names | ||
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. Line 7? 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.
What does it mean? Modified test passes. I suggest we a use of operator name in the test itself and add --verify option with checks that operator names are used in the test, but no detected in the headers. BTW, I suppose DPC++ extensions, which are not implicitly included by @Pennycook, FYI. 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. It seems like the comment on line 7 is not correct. From my local experiments:
UPD: 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. Removed the comment in b29ae74 |
||
// | ||
//===----------------------------------------------------------------------===// | ||
// This test checks if any SYCL header files use C++ operator name keywords | ||
// e.g. and, or, not | ||
// | ||
// This test does not use -fsyntax-only because it does not appear to respect | ||
// the -fno-operator-names option | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include <sycl/sycl.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised to see dynamic
asserts
in this test (lines 56/57). Unrelated to this PR though.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test was added like this in #4458. We should probably be more careful when reviewing tests and perhaps we should do another round of tests review to refactor them, i.e.:
-fsyntax-only
tests to simplify and cleanup them