88#pragma once
99
1010#include < CL/sycl/context.hpp>
11+ #include < CL/sycl/detail/common.hpp>
1112#include < CL/sycl/detail/export.hpp>
1213#include < CL/sycl/device.hpp>
1314#include < CL/sycl/exception.hpp>
@@ -24,8 +25,10 @@ namespace sycl {
2425__SYCL_EXPORT void *aligned_alloc (size_t alignment, size_t size,
2526 const device &dev, const context &ctxt,
2627 usm::alloc kind,
27- const property_list &propList);
28- __SYCL_EXPORT void free (void *ptr, const context &ctxt);
28+ const property_list &propList,
29+ const detail::code_location CL);
30+ __SYCL_EXPORT void free (void *ptr, const context &ctxt,
31+ const detail::code_location CL);
2932
3033template <typename T, usm::alloc AllocKind, size_t Alignment = alignof (T)>
3134class usm_allocator {
@@ -74,11 +77,12 @@ class usm_allocator {
7477 // / Allocates memory.
7578 // /
7679 // / \param NumberOfElements is a count of elements to allocate memory for.
77- T *allocate (size_t NumberOfElements) {
80+ T *allocate (size_t NumberOfElements, const detail::code_location CL =
81+ detail::code_location::current ()) {
7882
7983 auto Result = reinterpret_cast <T *>(
8084 aligned_alloc (getAlignment (), NumberOfElements * sizeof (value_type),
81- MDevice, MContext, AllocKind, MPropList));
85+ MDevice, MContext, AllocKind, MPropList, CL ));
8286 if (!Result) {
8387 throw memory_allocation_error ();
8488 }
@@ -89,9 +93,11 @@ class usm_allocator {
8993 // /
9094 // / \param Ptr is a pointer to memory being deallocated.
9195 // / \param Size is a number of elements previously passed to allocate.
92- void deallocate (T *Ptr, size_t ) {
96+ void deallocate (
97+ T *Ptr, size_t ,
98+ const detail::code_location CL = detail::code_location::current()) {
9399 if (Ptr) {
94- free (Ptr, MContext);
100+ free (Ptr, MContext, CL );
95101 }
96102 }
97103
0 commit comments