Skip to content

Commit 862170c

Browse files
authored
FPGA: Update host_ptr and device_ptr to appropriate namespace (#2343)
Raw host_prt and device_ptr are to be deprecated. Their replacements are sycl::ext::intel::host_ptr and sycl::ext::intel::device_ptr. This PR updates the code samples that relied on these constructs.
1 parent 16d6034 commit 862170c

File tree

7 files changed

+14
-12
lines changed

7 files changed

+14
-12
lines changed

DirectProgramming/C++SYCL_FPGA/ReferenceDesigns/merge_sort/src/main.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,9 @@ int main(int argc, char *argv[]) {
233233
// the pointer type for the kernel depends on whether data is coming from
234234
// USM host or device allocations
235235
using KernelPtrType =
236-
typename std::conditional_t<kUseUSMHostAllocation, host_ptr<ValueT>,
237-
device_ptr<ValueT>>;
236+
typename std::conditional_t<kUseUSMHostAllocation,
237+
sycl::ext::intel::host_ptr<ValueT>,
238+
sycl::ext::intel::device_ptr<ValueT>>;
238239

239240
// run the sort multiple times to increase the accuracy of the timing
240241
for (int i = 0; i < runs; i++) {

DirectProgramming/C++SYCL_FPGA/ReferenceDesigns/mvdr_beamforming/src/FakeIOPipes.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ProducerConsumerBaseImpl {
3030
// use some fancy C++ metaprogramming to get the correct pointer type
3131
// based on the template variable
3232
typedef
33-
typename std::conditional_t<use_host_alloc, host_ptr<T>, device_ptr<T>>
33+
typename std::conditional_t<use_host_alloc, sycl::ext::intel::host_ptr<T>, sycl::ext::intel::device_ptr<T>>
3434
kernel_ptr_type;
3535

3636
// private constructor so users cannot make an object

DirectProgramming/C++SYCL_FPGA/Tutorials/DesignPatterns/buffered_host_streaming/src/HostStreamer.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ class HostStreamer {
667667
// synthesized into FPGA kernels.
668668
static event LaunchProducerKernel(ProducerType *usm_ptr, size_t count) {
669669
return sycl_q_->single_task<ProducerKernelId<Id>>([=] {
670-
host_ptr<ProducerType> ptr(usm_ptr);
670+
sycl::ext::intel::host_ptr<ProducerType> ptr(usm_ptr);
671671
for (size_t i = 0; i < count; i++) {
672672
// host->device: read from USM and write to the ProducerPipe
673673
auto val = *(ptr + i);
@@ -678,7 +678,7 @@ class HostStreamer {
678678

679679
static event LaunchConsumerKernel(ConsumerType *usm_ptr, size_t count) {
680680
return sycl_q_->single_task<ConsumerKernelId<Id>>([=] {
681-
host_ptr<ConsumerType> ptr(usm_ptr);
681+
sycl::ext::intel::host_ptr<ConsumerType> ptr(usm_ptr);
682682
for (size_t i = 0; i < count; i++) {
683683
// device->host: read from the ConsumerPipe and write to USM
684684
auto val = ConsumerPipe::read();

DirectProgramming/C++SYCL_FPGA/Tutorials/DesignPatterns/buffered_host_streaming/src/streaming_without_api.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,8 @@ event SubmitKernel(queue &q, T *in_ptr, size_t count, T *out_ptr) {
328328
return q.single_task<Kernel>([=]() [[intel::kernel_args_restrict]] {
329329
// using a host_ptr class tells the compiler that this pointer lives in
330330
// the host's address space
331-
host_ptr<T> in(in_ptr);
332-
host_ptr<T> out(out_ptr);
331+
sycl::ext::intel::host_ptr<T> in(in_ptr);
332+
sycl::ext::intel::host_ptr<T> out(out_ptr);
333333

334334
for (size_t i = 0; i < count; i++) {
335335
T data = *(in + i);

DirectProgramming/C++SYCL_FPGA/Tutorials/DesignPatterns/io_streaming/src/FakeIOPipes.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class ProducerConsumerBaseImpl {
3030
// use some fancy C++ metaprogramming to get the correct pointer type
3131
// based on the template variable
3232
typedef
33-
typename std::conditional_t<use_host_alloc, host_ptr<T>, device_ptr<T>>
33+
typename std::conditional_t<use_host_alloc, sycl::ext::intel::host_ptr<T>,
34+
sycl::ext::intel::device_ptr<T>>
3435
kernel_ptr_type;
3536

3637
// private constructor so users cannot make an object

DirectProgramming/C++SYCL_FPGA/Tutorials/DesignPatterns/simple_host_streaming/src/multi_kernel.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class C;
3131
template<typename T, typename InPipe>
3232
event SubmitProducer(queue &q, T* in_ptr, size_t size) {
3333
return q.single_task<P>([=]() [[intel::kernel_args_restrict]] {
34-
host_ptr<T> in(in_ptr);
34+
sycl::ext::intel::host_ptr<T> in(in_ptr);
3535
for (size_t i = 0; i < size; i++) {
3636
auto data = in[i];
3737
InPipe::write(data);
@@ -53,7 +53,7 @@ event SubmitProducer(queue &q, T* in_ptr, size_t size) {
5353
template<typename T, typename OutPipe>
5454
event SubmitConsumer(queue &q, T* out_ptr, size_t size) {
5555
return q.single_task<C>([=]() [[intel::kernel_args_restrict]] {
56-
host_ptr<T> out(out_ptr);
56+
sycl::ext::intel::host_ptr<T> out(out_ptr);
5757
for (size_t i = 0; i < size; i++) {
5858
auto data = OutPipe::read();
5959
*(out + i) = data;

DirectProgramming/C++SYCL_FPGA/Tutorials/DesignPatterns/simple_host_streaming/src/single_kernel.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ event SubmitSingleWorker(queue &q, T *in_ptr, T *out_ptr, size_t count) {
1919
return q.single_task<K>([=]() [[intel::kernel_args_restrict]] {
2020
// using a host_ptr class tells the compiler that this pointer lives in
2121
// the hosts address space
22-
host_ptr<T> in(in_ptr);
23-
host_ptr<T> out(out_ptr);
22+
sycl::ext::intel::host_ptr<T> in(in_ptr);
23+
sycl::ext::intel::host_ptr<T> out(out_ptr);
2424

2525
for (size_t i = 0; i < count; i++) {
2626
// do a simple copy - more complex computation can go here

0 commit comments

Comments
 (0)