-
Notifications
You must be signed in to change notification settings - Fork 754
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add checks to detect use of local_accessor and slm_init
- Loading branch information
Showing
4 changed files
with
146 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// RUN: not %clangxx -O0 -fsycl %s 2>&1 | FileCheck %s | ||
|
||
// This test verifies usage of slm_init and local_accessor triggers an error. | ||
|
||
#include <iostream> | ||
#include <sycl/ext/intel/esimd.hpp> | ||
#include <sycl/sycl.hpp> | ||
|
||
using namespace sycl; | ||
using namespace sycl::ext::intel::esimd; | ||
|
||
int main() { | ||
queue Q; | ||
nd_range<1> NDR{range<1>{2}, range<1>{2}}; | ||
Q.submit([&](handler &CGH) { | ||
CGH.parallel_for(NDR, [=](nd_item<1> NDI) SYCL_ESIMD_KERNEL { | ||
auto InAcc = local_accessor<int, 1>(); | ||
slm_init(1024); | ||
}); | ||
}).wait(); | ||
// CHECK: error: slm_init can not be used with local_accessor. | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// RUN: not %clangxx -fsycl %s 2>&1 | FileCheck %s | ||
|
||
// This test verifies usage of slm_init and local_accessor triggers an error. | ||
|
||
#include <iostream> | ||
#include <sycl/ext/intel/esimd.hpp> | ||
#include <sycl/sycl.hpp> | ||
|
||
using namespace sycl; | ||
using namespace sycl::ext::intel::esimd; | ||
|
||
int main() { | ||
queue Q; | ||
nd_range<1> NDR{range<1>{2}, range<1>{2}}; | ||
Q.submit([&](handler &CGH) { | ||
auto InAcc = local_accessor<int, 1>(5, CGH); | ||
CGH.parallel_for(NDR, [=](nd_item<1> NDI) SYCL_ESIMD_KERNEL { | ||
slm_init(1024); | ||
scalar_load<int>(InAcc, 0); | ||
}); | ||
}).wait(); | ||
// CHECK: error: slm_init can not be used with local_accessor. | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// RUN: not %clangxx -fsycl %s 2>&1 | FileCheck %s | ||
|
||
// This test verifies usage of slm_init and local_accessor triggers an error. | ||
|
||
#include <iostream> | ||
#include <sycl/ext/intel/esimd.hpp> | ||
#include <sycl/sycl.hpp> | ||
|
||
using namespace sycl; | ||
using namespace sycl::ext::intel::esimd; | ||
|
||
int main() { | ||
queue Q; | ||
nd_range<1> NDR{range<1>{2}, range<1>{2}}; | ||
Q.submit([&](handler &CGH) { | ||
auto InAcc = local_accessor<int, 1>(5, CGH); | ||
CGH.parallel_for(NDR, [=](nd_item<1> NDI) SYCL_ESIMD_KERNEL { | ||
slm_init(1024); | ||
InAcc[0] = 5; | ||
}); | ||
}).wait(); | ||
// CHECK: error: slm_init can not be used with local_accessor. | ||
|
||
return 0; | ||
} |