|
12 | 12 |
|
13 | 13 | namespace syclext = sycl::ext::oneapi::experimental; |
14 | 14 |
|
15 | | -template<typename... ArgsT> |
| 15 | +template <typename... ArgsT> |
16 | 16 | int CheckReturnedGranularitySize(std::string_view TestName, ArgsT... Args) { |
17 | | - if (syclext::get_mem_granularity(Args...) == 0){ |
18 | | - std::cout << "Failed check: " << TestName << std::endl; |
19 | | - return 1; |
20 | | - } |
21 | | - return 0; |
| 17 | + if (syclext::get_mem_granularity(Args...) == 0) { |
| 18 | + std::cout << "Failed check: " << TestName << std::endl; |
| 19 | + return 1; |
| 20 | + } |
| 21 | + return 0; |
22 | 22 | } |
23 | 23 |
|
24 | 24 | int main() { |
25 | 25 | int Failed = 0; |
26 | 26 | sycl::queue Q; |
27 | 27 | sycl::context Context = Q.get_context(); |
28 | | - sycl::device Device = Q.get_device(); |
| 28 | + sycl::device Device = Q.get_device(); |
29 | 29 |
|
30 | | - Failed += CheckReturnedGranularitySize("returned granularity size must be greater then 0 for device and granularity_mode::recommended", Device, Context, syclext::granularity_mode::recommended); |
31 | | - Failed += CheckReturnedGranularitySize("returned granularity size must be greater then 0 for device and granularity_mode::minimum", Device, Context, syclext::granularity_mode::minimum); |
32 | | - Failed += CheckReturnedGranularitySize("returned granularity size must be greater then 0 for context and granularity_mode::recommended", Context, syclext::granularity_mode::recommended); |
33 | | - Failed += CheckReturnedGranularitySize("returned granularity size must be greater then 0 for context and granularity_mode::minimum", Context, syclext::granularity_mode::minimum); |
| 30 | + Failed += CheckReturnedGranularitySize( |
| 31 | + "returned granularity size must be greater then 0 for device and " |
| 32 | + "granularity_mode::recommended", |
| 33 | + Device, Context, syclext::granularity_mode::recommended); |
| 34 | + Failed += CheckReturnedGranularitySize( |
| 35 | + "returned granularity size must be greater then 0 for device and " |
| 36 | + "granularity_mode::minimum", |
| 37 | + Device, Context, syclext::granularity_mode::minimum); |
| 38 | + Failed += CheckReturnedGranularitySize( |
| 39 | + "returned granularity size must be greater then 0 for context and " |
| 40 | + "granularity_mode::recommended", |
| 41 | + Context, syclext::granularity_mode::recommended); |
| 42 | + Failed += CheckReturnedGranularitySize( |
| 43 | + "returned granularity size must be greater then 0 for context and " |
| 44 | + "granularity_mode::minimum", |
| 45 | + Context, syclext::granularity_mode::minimum); |
34 | 46 |
|
35 | 47 | constexpr size_t NumberOfElements = 2; |
36 | | - std::array<size_t, NumberOfElements> RecommendedGranularities = {syclext::get_mem_granularity(Device, Context, syclext::granularity_mode::recommended), |
37 | | - syclext::get_mem_granularity(Context, syclext::granularity_mode::recommended)}; |
| 48 | + std::array<size_t, NumberOfElements> RecommendedGranularities = { |
| 49 | + syclext::get_mem_granularity(Device, Context, |
| 50 | + syclext::granularity_mode::recommended), |
| 51 | + syclext::get_mem_granularity(Context, |
| 52 | + syclext::granularity_mode::recommended)}; |
38 | 53 |
|
39 | | - std::array<size_t, NumberOfElements> MinimumGranularities = {syclext::get_mem_granularity(Device, Context, syclext::granularity_mode::minimum), |
40 | | - syclext::get_mem_granularity(Context, syclext::granularity_mode::minimum)}; |
| 54 | + std::array<size_t, NumberOfElements> MinimumGranularities = { |
| 55 | + syclext::get_mem_granularity(Device, Context, |
| 56 | + syclext::granularity_mode::minimum), |
| 57 | + syclext::get_mem_granularity(Context, |
| 58 | + syclext::granularity_mode::minimum)}; |
41 | 59 |
|
42 | 60 | std::array<std::string_view, NumberOfElements> TestNames = { |
43 | | - "Failed check: granularity_mode::recommended size must be at least granularity_mode::minimum for device", |
44 | | - "Failed check: granularity_mode::recommended size must be at least granularity_mode::minimum for context" |
45 | | - }; |
| 61 | + "Failed check: granularity_mode::recommended size must be at least " |
| 62 | + "granularity_mode::minimum for device", |
| 63 | + "Failed check: granularity_mode::recommended size must be at least " |
| 64 | + "granularity_mode::minimum for context"}; |
46 | 65 |
|
47 | | - for (size_t Index=0; Index<NumberOfElements;++Index) { |
48 | | - if(RecommendedGranularities[Index]<MinimumGranularities[Index]){ |
49 | | - std::cout << TestNames[Index]<<std::endl; |
| 66 | + for (size_t Index = 0; Index < NumberOfElements; ++Index) { |
| 67 | + if (RecommendedGranularities[Index] < MinimumGranularities[Index]) { |
| 68 | + std::cout << TestNames[Index] << std::endl; |
50 | 69 | ++Failed; |
51 | 70 | } |
52 | 71 | } |
|
0 commit comments