Skip to content

Commit d3f8312

Browse files
joeatoddAlcpz
andauthored
Apply suggestions from code review
Co-authored-by: Alberto Cabrera Pérez <[email protected]>
1 parent 9951ec0 commit d3f8312

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

sycl/doc/syclcompat/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ If available, the following extensions extend SYCLcompat functionality:
6161

6262
### Hardware Requirements
6363

64-
Some of the functionality provided by SYCLcompat relies on Unified Shared Memory (`aspect::usm_device_allocations`), though most of the USM-like memory APIs (malloc*, memcpy*, memset*) support hardware with only buffer/accessor support. See section [Buffer Support](#buffer-support) below.
64+
Some of the functionalities provided by SYCLcompat rely on Unified Shared Memory (`aspect::usm_device_allocations`), though most of the USM-like memory APIs (malloc*, memcpy*, memset*) support hardware with only buffer/accessor support. See section [Buffer Support](#buffer-support) below.
6565

6666
## Usage
6767

@@ -847,6 +847,7 @@ public:
847847

848848
} // syclcompat
849849
```
850+
850851
#### Buffer Support
851852
852853
Although SYCLcompat is primarily designed around the Unified Shared Memory

sycl/include/syclcompat/memory.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class mem_mgr {
225225
std::lock_guard<std::mutex> lock(m_mutex);
226226
if (next_free + size > mapped_address_space + mapped_region_size) {
227227
throw std::runtime_error(
228-
"syclcompat malloc: out of memory for virtual memory pool");
228+
"[SYCLcompat] malloc: out of memory for virtual memory pool");
229229
}
230230
// Allocation
231231
sycl::range<1> r(size);
@@ -284,14 +284,14 @@ class mem_mgr {
284284
auto it = m_map.upper_bound((byte_t *)ptr);
285285
if (it == m_map.end()) {
286286
// Not a virtual pointer.
287-
throw std::runtime_error("can not get buffer from non-virtual pointer");
287+
throw std::runtime_error("[SYCLcompat] can not get buffer from non-virtual pointer");
288288
}
289289
const allocation &alloc = it->second;
290290
if (ptr < alloc.alloc_ptr) {
291291
// Out of bound.
292292
// This may happen if there's a gap between allocations due to alignment
293293
// or extra padding and pointer points to this gap.
294-
throw std::runtime_error("invalid virtual pointer");
294+
throw std::runtime_error("[SYCLcompat] invalid virtual pointer");
295295
}
296296
return it;
297297
}
@@ -558,7 +558,7 @@ static sycl::event memcpy(sycl::queue q, void *to_ptr, const void *from_ptr,
558558
});
559559
}
560560
default:
561-
throw std::runtime_error("syclcompat memcpy: invalid direction value");
561+
throw std::runtime_error("[SYCLcompat] memcpy: invalid direction value");
562562
}
563563
#else
564564
return q.memcpy(to_ptr, from_ptr, size, dep_events);
@@ -778,7 +778,7 @@ static std::pair<buffer_t, size_t> get_buffer_and_offset(const void *ptr) {
778778
return std::make_pair(alloc.buffer, offset);
779779
} else {
780780
throw std::runtime_error(
781-
"NULL pointer argument in get_buffer_and_offset function is invalid");
781+
"[SYCLcompat] NULL pointer argument in get_buffer_and_offset function is invalid");
782782
}
783783
}
784784

@@ -846,7 +846,7 @@ static sycl::accessor<byte_t, 1, accessMode> get_access(const void *ptr,
846846
return alloc.buffer.get_access<accessMode>(cgh);
847847
} else {
848848
throw std::runtime_error(
849-
"NULL pointer argument in get_access function is invalid");
849+
"[SYCLcompat] NULL pointer argument in get_access function is invalid");
850850
}
851851
}
852852

@@ -1727,7 +1727,7 @@ class pointer_attributes {
17271727
void init(const void *ptr, sycl::queue q = get_default_queue()) {
17281728
#ifdef COMPAT_USM_LEVEL_NONE
17291729
throw std::runtime_error(
1730-
"syclcompat::pointer_attributes: only works for USM pointer.");
1730+
"[SYCLcompat] pointer_attributes: only works for USM pointer.");
17311731
#else
17321732
memory_type = sycl::get_pointer_type(ptr, q.get_context());
17331733
device_pointer = (memory_type != sycl::usm::alloc::unknown) ? ptr : nullptr;

sycl/test-e2e/syclcompat/memory/global_memory_usmnone.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ syclcompat::constant_memory<int, 1> c_1d(sycl::range<1>(15),
5656
{0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100,
5757
110, 120, 130, 140});
5858

59-
bool verify_init(int *data) {
59+
bool verify_init(int *data) {
6060
for(auto i = 0; i < 15; ++i) {
6161
if (data[i] != i * 10)
6262
return false;

0 commit comments

Comments
 (0)