From 690963e334c114c76e8434ebec19413b0e39cf39 Mon Sep 17 00:00:00 2001 From: Nuno Nobre Date: Sun, 6 Oct 2024 13:05:43 +0100 Subject: [PATCH 1/3] Fix return types for memset/memcpy in Figure 2-19 (#138) --- samples/Ch02_where_code_runs/fig_2_19.hpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/samples/Ch02_where_code_runs/fig_2_19.hpp b/samples/Ch02_where_code_runs/fig_2_19.hpp index 70ac23d..fac14f8 100644 --- a/samples/Ch02_where_code_runs/fig_2_19.hpp +++ b/samples/Ch02_where_code_runs/fig_2_19.hpp @@ -18,12 +18,10 @@ class handler { // Submit a memset operation writing // to the specified pointer. - // Return an event representing this operation. - event memset(void *ptr, int value, size_t count); + void memset(void *ptr, int value, size_t count); // Submit a memcpy operation copying from src to dest. - // Return an event representing this operation. - event memcpy(void *dest, const void *src, size_t count); + void memcpy(void *dest, const void *src, size_t count); // Copy to/from an accessor and host memory. // Accessors are required to have appropriate correct From 251e8290294ceb6c1d5b1bd1e70e9daddf52a5bb Mon Sep 17 00:00:00 2001 From: Nuno Nobre Date: Sun, 6 Oct 2024 13:14:52 +0100 Subject: [PATCH 2/3] Fix parameter name and indentation in Figure 3-17 (#138) --- samples/Ch03_data_management/fig_3_17.hpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/samples/Ch03_data_management/fig_3_17.hpp b/samples/Ch03_data_management/fig_3_17.hpp index 3ca5cdc..b9a961a 100644 --- a/samples/Ch03_data_management/fig_3_17.hpp +++ b/samples/Ch03_data_management/fig_3_17.hpp @@ -7,9 +7,9 @@ class handler { ... - // Specifies event(s) that must be complete before the - // action defined in this command group executes. - void depends_on({event / std::vector & }); + // Specifies event(s) that must be complete before the + // action defined in this command group executes. + void depends_on({event / std::vector & }); // Enqueues a memcpy from Src to Dest. // Count bytes are copied. @@ -24,20 +24,20 @@ class handler { // Writes the first byte of Value into Count bytes. void memset(void* Ptr, int Value, size_t Count) - // Enques a fill operation on the specified pointer. - // Fills Pattern into Ptr Count times. - template - void fill(void* Ptr, const T& Pattern, size_t Count); + // Enques a fill operation on the specified pointer. + // Fills Pattern into Ptr Count times. + template + void fill(void* Ptr, const T& Pattern, size_t Count); // Submits a kernel of one work-item for execution. template void single_task(KernelType KernelFunc); - // Submits a kernel with NumWork-items work-items for + // Submits a kernel with NumWorkItems work-items for // execution. template - void parallel_for(range NumWork - items, + void parallel_for(range NumWorkItems, KernelType KernelFunc); // Submits a kernel for execution over the supplied From e06fe80ad14c75bba625996e56209db6a1291b3b Mon Sep 17 00:00:00 2001 From: Nuno Nobre Date: Sun, 6 Oct 2024 13:30:20 +0100 Subject: [PATCH 3/3] Added errata entries for Figures 2-19 and 3-17 (#138) --- second_edition_errata.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/second_edition_errata.txt b/second_edition_errata.txt index 6569979..8700bf4 100644 --- a/second_edition_errata.txt +++ b/second_edition_errata.txt @@ -4,9 +4,16 @@ The following are known issues contained in the book Data Parallel C++: Programming Accelerated Systems using C++ and SYCL by James Reinders, Ben Ashbaugh, James Brodman, Michael Kinsner, John Pennycook, Xinmin Tian (Apress, 2023/2024). +p.57 - Figure 2-19: The return type for the member functions memset and memcpy +of the handler class is void, not event. + p.79 - Figure 3-6: The comments in the code incorrectly refer to the names myBuffer and myData instead of my_buffer and my_data. +p.94 - Figure 3-17: The member functions depends_on and fill are declared with +inconsistent indentation. The first parameter of the range parallel_for is not +a valid C++ identifier, need to replace with, e.g., NumWorkItems. + p.252 - Figure 10-3: Because this is an nd_range parallel_for, the argument to the kernel lambda expression must be an nd_item, not an id.