17 inline namespace _V1 {
23 namespace experimental {
39 typename propertyListB =
40 typename detail::GetCompileTimeProperties<propertyListA>::type>
42 detail::CheckTAndPropLists<void, propertyListA, propertyListB>::value,
43 annotated_ptr<void, propertyListB>>
47 const propertyListA &propList =
properties{}) {
48 detail::ValidAllocPropertyList<void, propertyListA>::value;
53 static_cast<void>(propList);
55 constexpr
size_t alignFromPropList =
56 detail::GetAlignFromPropList<propertyListA>::value;
57 const property_list &usmPropList = get_usm_property_list<propertyListA>();
59 if constexpr (detail::HasUsmKind<propertyListA>::value) {
61 detail::GetUsmKindFromPropList<propertyListA>::value;
62 if (usmKind != kind) {
65 "Input property list of USM allocation function contains usm_kind "
66 "property that conflicts with the usm kind argument");
70 if (kind == sycl::usm::alloc::unknown)
72 "Unknown USM allocation kind was specified.");
76 syclDevice, syclContext, kind, usmPropList);
77 return annotated_ptr<void, propertyListB>(rawPtr);
81 typename propertyListB =
82 typename detail::GetCompileTimeProperties<propertyListA>::type>
84 detail::CheckTAndPropLists<T, propertyListA, propertyListB>::value,
85 annotated_ptr<T, propertyListB>>
89 const propertyListA &propList =
properties{}) {
90 detail::ValidAllocPropertyList<T, propertyListA>::value;
95 static_cast<void>(propList);
97 constexpr
size_t alignFromPropList =
98 detail::GetAlignFromPropList<propertyListA>::value;
99 const property_list &usmPropList = get_usm_property_list<propertyListA>();
101 if constexpr (detail::HasUsmKind<propertyListA>::value) {
103 detail::GetUsmKindFromPropList<propertyListA>::value;
104 if (usmKind != kind) {
107 "Input property list of USM allocation function contains usm_kind "
108 "property that conflicts with the usm kind argument");
112 if (kind == sycl::usm::alloc::unknown)
114 "Unknown USM allocation kind was specified.");
117 T *rawPtr = sycl::aligned_alloc<T>(combinedAlign, count, syclDevice,
118 syclContext, kind, usmPropList);
119 return annotated_ptr<T, propertyListB>(rawPtr);
123 typename propertyListB =
124 typename detail::GetCompileTimeProperties<propertyListA>::type>
126 detail::CheckTAndPropLists<void, propertyListA, propertyListB>::value,
127 annotated_ptr<void, propertyListB>>
130 const propertyListA &propList =
properties{}) {
136 typename propertyListB =
137 typename detail::GetCompileTimeProperties<propertyListA>::type>
139 detail::CheckTAndPropLists<T, propertyListA, propertyListB>::value,
140 annotated_ptr<T, propertyListB>>
143 const propertyListA &propList =
properties{}) {
149 typename propertyListB =
150 typename detail::GetCompileTimeProperties<propertyListA>::type>
152 detail::CheckTAndPropLists<void, propertyListA, propertyListB>::value,
153 annotated_ptr<void, propertyListB>>
156 const propertyListA &propList =
properties{}) {
162 typename propertyListB =
163 typename detail::GetCompileTimeProperties<propertyListA>::type>
165 detail::CheckTAndPropLists<T, propertyListA, propertyListB>::value,
166 annotated_ptr<T, propertyListB>>
169 const propertyListA &propList =
properties{}) {
170 return aligned_alloc_annotated<T>(0, count, syclDevice, syclContext, kind,
175 typename propertyListB =
176 typename detail::GetCompileTimeProperties<propertyListA>::type>
178 detail::CheckTAndPropLists<void, propertyListA, propertyListB>::value,
179 annotated_ptr<void, propertyListB>>
181 const propertyListA &propList =
properties{}) {
187 typename propertyListB =
188 typename detail::GetCompileTimeProperties<propertyListA>::type>
190 detail::CheckTAndPropLists<T, propertyListA, propertyListB>::value,
191 annotated_ptr<T, propertyListB>>
193 const propertyListA &propList =
properties{}) {
194 return malloc_annotated<T>(count, syclQueue.
get_device(),
206 template <
typename propertyListA,
207 typename propertyListB =
208 typename detail::GetCompileTimeProperties<propertyListA>::type>
210 detail::CheckTAndPropLists<void, propertyListA, propertyListB>::value,
211 annotated_ptr<void, propertyListB>>
213 const context &syclContext,
const propertyListA &propList) {
216 static_assert(usmKind != sycl::usm::alloc::unknown,
217 "USM kind is not specified. Please specify it as an argument "
218 "or in the input property list.");
219 return malloc_annotated(numBytes, syclDevice, syclContext, usmKind, propList);
222 template <
typename T,
typename propertyListA,
223 typename propertyListB =
224 typename detail::GetCompileTimeProperties<propertyListA>::type>
226 detail::CheckTAndPropLists<T, propertyListA, propertyListB>::value,
227 annotated_ptr<T, propertyListB>>
229 const context &syclContext,
const propertyListA &propList) {
232 static_assert(usmKind != sycl::usm::alloc::unknown,
233 "USM kind is not specified. Please specify it as an argument "
234 "or in the input property list.");
235 return malloc_annotated<T>(count, syclDevice, syclContext, usmKind, propList);
238 template <
typename propertyListA,
239 typename propertyListB =
240 typename detail::GetCompileTimeProperties<propertyListA>::type>
242 detail::CheckTAndPropLists<void, propertyListA, propertyListB>::value,
243 annotated_ptr<void, propertyListB>>
245 const propertyListA &propList) {
250 template <
typename T,
typename propertyListA,
251 typename propertyListB =
252 typename detail::GetCompileTimeProperties<propertyListA>::type>
254 detail::CheckTAndPropLists<T, propertyListA, propertyListB>::value,
255 annotated_ptr<T, propertyListB>>
257 const propertyListA &propList) {
258 return malloc_annotated<T>(count, syclQueue.
get_device(),
The context class represents a SYCL context on which kernel functions may be executed.
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Objects of the property_list class are containers for the SYCL properties.
Encapsulates a single SYCL queue which schedules kernels on a SYCL device.
device get_device() const
context get_context() const
properties< std::tuple<> > empty_properties_t
constexpr alignment_key::value_t< K > alignment
size_t combine_align(size_t alignA, size_t alignB)
std::enable_if_t< detail::CheckTAndPropLists< void, propertyListA, propertyListB >::value, annotated_ptr< void, propertyListB > > aligned_alloc_annotated(size_t alignment, size_t numBytes, const device &syclDevice, const context &syclContext, sycl::usm::alloc kind, const propertyListA &propList=properties{})
std::enable_if_t< detail::CheckTAndPropLists< void, propertyListA, propertyListB >::value, annotated_ptr< void, propertyListB > > malloc_annotated(size_t numBytes, const device &syclDevice, const context &syclContext, sycl::usm::alloc kind, const propertyListA &propList=properties{})
void * aligned_alloc(size_t alignment, size_t size, const device &dev, const context &ctxt, usm::alloc kind, const detail::code_location &CodeLoc=detail::code_location::current())
std::error_code make_error_code(sycl::errc E) noexcept
Constructs an error code using e and sycl_category()