Skip to content

Commit e168c96

Browse files
committed
Merge from 'sycl' to 'sycl-web' (5 commits)
CONFLICT (content): Merge conflict in sycl/source/detail/sycl_mem_obj_t.hpp
2 parents 52284db + 1b2b9dd commit e168c96

File tree

8 files changed

+1731
-23
lines changed

8 files changed

+1731
-23
lines changed

sycl/doc/extensions/proposed/sycl_ext_oneapi_graph.asciidoc

Lines changed: 1666 additions & 0 deletions
Large diffs are not rendered by default.

sycl/include/sycl/ext/oneapi/annotated_arg/annotated_arg.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ __SYCL_TYPE(annotated_arg) annotated_arg<T, detail::properties_t<Props...>> {
180180
"Property list is invalid.");
181181
static_assert(check_property_list<T, Props...>::value,
182182
"The property list contains invalid property.");
183+
// check the set if FPGA specificed properties are used
184+
static_assert(detail::checkValidFPGAPropertySet<Props...>::value,
185+
"FPGA Interface properties (i.e. awidth, dwidth, etc.)"
186+
"can only be set with BufferLocation together.");
183187

184188
annotated_arg() noexcept = default;
185189
annotated_arg(const annotated_arg &) = default;

sycl/include/sycl/ext/oneapi/annotated_arg/annotated_ptr.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ __SYCL_TYPE(annotated_ptr) annotated_ptr<T, detail::properties_t<Props...>> {
121121
public:
122122
static_assert(is_property_list<property_list_t>::value,
123123
"Property list is invalid.");
124+
static_assert(check_property_list<T *, Props...>::value,
125+
"The property list contains invalid property.");
126+
// check the set if FPGA specificed properties are used
127+
static_assert(detail::checkValidFPGAPropertySet<Props...>::value,
128+
"FPGA Interface properties (i.e. awidth, dwidth, etc.)"
129+
"can only be set with BufferLocation together.");
124130

125131
annotated_ptr() noexcept = default;
126132
annotated_ptr(const annotated_ptr &) = default;

sycl/include/sycl/ext/oneapi/annotated_arg/properties.hpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,10 @@ struct alignment_key {
348348

349349
template <int K> inline constexpr alignment_key::value_t<K> alignment;
350350

351+
template <typename T, int W>
352+
struct is_valid_property<T, alignment_key::value_t<W>>
353+
: std::bool_constant<std::is_pointer<T>::value> {};
354+
351355
template <> struct is_property_key<alignment_key> : std::true_type {};
352356

353357
template <typename T, typename PropertyListT>
@@ -385,6 +389,23 @@ template <typename... Args>
385389
struct DeducedProperties<detail::properties_t<Args...>> {
386390
using type = detail::properties_t<Args...>;
387391
};
392+
393+
template <typename... Args> struct checkValidFPGAPropertySet {
394+
using list = std::tuple<Args...>;
395+
static constexpr bool has_BufferLocation =
396+
ContainsProperty<buffer_location_key, list>::value;
397+
398+
static constexpr bool has_InterfaceConfig =
399+
ContainsProperty<awidth_key, list>::value &&
400+
ContainsProperty<dwidth_key, list>::value &&
401+
ContainsProperty<latency_key, list>::value &&
402+
ContainsProperty<read_write_mode_key, list>::value &&
403+
ContainsProperty<maxburst_key, list>::value &&
404+
ContainsProperty<wait_request_key, list>::value &&
405+
ContainsProperty<alignment_key, list>::value;
406+
407+
static constexpr bool value = !(!has_BufferLocation && has_InterfaceConfig);
408+
};
388409
} // namespace detail
389410

390411
} // namespace experimental

sycl/plugins/unified_runtime/ur/adapters/cuda/device.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceCreateWithNativeHandle(
11761176
// We can't cast between ur_native_handle_t and CUdevice, so memcpy the bits
11771177
// instead
11781178
CUdevice CuDevice = 0;
1179-
memcpy(&CuDevice, hNativeDevice, sizeof(CUdevice));
1179+
memcpy(&CuDevice, &hNativeDevice, sizeof(CUdevice));
11801180

11811181
auto IsDevice = [=](std::unique_ptr<ur_device_handle_t_> &Dev) {
11821182
return Dev->get() == CuDevice;

sycl/plugins/unified_runtime/ur/adapters/cuda/image.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ cudaToUrImageChannelFormat(CUarray_format cuda_format,
131131
}
132132
}
133133

134-
ur_result_t urTextureCreate(ur_context_handle_t hContext,
135-
ur_sampler_handle_t hSampler,
134+
ur_result_t urTextureCreate(ur_sampler_handle_t hSampler,
136135
const ur_image_desc_t *pImageDesc,
137136
CUDA_RESOURCE_DESC ResourceDesc,
138137
ur_exp_image_handle_t *phRetImage) {
@@ -147,7 +146,7 @@ ur_result_t urTextureCreate(ur_context_handle_t hContext,
147146
/// | 1 | filter mode
148147
/// | 0 | normalize coords
149148
CUDA_TEXTURE_DESC ImageTexDesc = {};
150-
CUaddress_mode AddrMode;
149+
CUaddress_mode AddrMode = {};
151150
ur_sampler_addressing_mode_t AddrModeProp = hSampler->getAddressingMode();
152151
if (AddrModeProp == (UR_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE -
153152
UR_SAMPLER_ADDRESSING_MODE_NONE)) {
@@ -465,8 +464,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urBindlessImagesSampledImageCreateExp(
465464
return UR_RESULT_ERROR_INVALID_VALUE;
466465
}
467466

468-
UR_CHECK_ERROR(urTextureCreate(hContext, hSampler, pImageDesc,
469-
image_res_desc, phImage));
467+
UR_CHECK_ERROR(
468+
urTextureCreate(hSampler, pImageDesc, image_res_desc, phImage));
470469

471470
auto urMemObj = std::unique_ptr<ur_mem_handle_t_>(new ur_mem_handle_t_{
472471
hContext, (CUarray)hImageMem, (CUtexObject)*phImage, hSampler,

sycl/source/detail/sycl_mem_obj_t.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ class __SYCL_EXPORT SYCLMemObjT : public SYCLMemObjI {
185185
F(HostPtr);
186186
});
187187
}
188-
if(HostPtr){
188+
189+
if (HostPtr) {
189190
if (canReuseHostPtr(HostPtr, RequiredAlign)) {
190191
MUserPtr = HostPtr;
191192
} else {

sycl/test/extensions/annotated_arg/annotated_ptr.cpp

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,20 @@ using namespace sycl;
1212
using namespace ext::oneapi::experimental;
1313

1414
using annotated_ptr_t1 =
15-
annotated_ptr<int, decltype(properties(awidth<32>, dwidth<32>))>;
15+
annotated_ptr<int, decltype(properties(buffer_location<0>, awidth<32>,
16+
dwidth<32>))>;
1617

1718
using annotated_ptr_t2 =
18-
annotated_ptr<int,
19-
decltype(properties(conduit, register_map, alignment<8>))>;
19+
annotated_ptr<int, decltype(properties(buffer_location<0>, conduit,
20+
register_map, alignment<8>))>;
2021

21-
using annotated_ptr_t3 = annotated_ptr<int, decltype(properties(awidth<32>))>;
22+
using annotated_ptr_t3 =
23+
annotated_ptr<int, decltype(properties(buffer_location<0>, awidth<32>))>;
2224

2325
struct MyIP {
24-
annotated_ptr<int, decltype(properties(awidth<32>, dwidth<32>))> a;
26+
annotated_ptr<int, decltype(properties(buffer_location<0>, awidth<32>,
27+
dwidth<32>))>
28+
a;
2529

2630
int b;
2731

@@ -38,7 +42,7 @@ struct MyIP {
3842

3943
template <typename T> T foo() {
4044
auto raw = new int;
41-
return annotated_ptr(raw, awidth<32>);
45+
return annotated_ptr(raw, buffer_location<0>, awidth<32>);
4246
}
4347

4448
void TestVectorAddWithAnnotatedMMHosts() {
@@ -60,33 +64,40 @@ void TestVectorAddWithAnnotatedMMHosts() {
6064
// Construct from raw pointers
6165
auto tmp11 = annotated_ptr(raw); // empty property list
6266
// Construct from raw pointers and a property list
63-
auto tmp12 = annotated_ptr<int, decltype(properties{awidth<32>})>(
64-
raw, properties{awidth<32>});
65-
auto tmp14 = annotated_ptr(raw, properties{awidth<32>}); // deduction guide
67+
auto tmp12 =
68+
annotated_ptr<int, decltype(properties{buffer_location<0>, awidth<32>})>(
69+
raw, properties{buffer_location<0>, awidth<32>});
70+
auto tmp14 = annotated_ptr(
71+
raw, properties{buffer_location<0>, awidth<32>}); // deduction guide
6672
static_assert(std::is_same<decltype(tmp14), annotated_ptr_t3>::value,
6773
"deduction guide failed 1");
6874
// Construct from raw pointers and variadic properties
69-
auto tmp13 = annotated_ptr(raw, dwidth<32>, awidth<32>); // deduction guide
75+
auto tmp13 = annotated_ptr(raw, buffer_location<0>, dwidth<32>,
76+
awidth<32>); // deduction guide
7077
static_assert(std::is_same<decltype(tmp13), annotated_ptr_t1>::value,
7178
"deduction guide failed 2");
72-
auto tmp15 = annotated_ptr(raw, awidth<32>);
79+
auto tmp15 = annotated_ptr(raw, buffer_location<0>, awidth<32>);
7380
static_assert(std::is_same<decltype(tmp15), annotated_ptr_t3>::value,
7481
"deduction guide failed 1");
7582

7683
// Construct from another annotated_ptr
7784
// templated copy constructor
78-
annotated_ptr<int, decltype(properties{awidth<32>, dwidth<32>})> arg11(tmp11);
85+
annotated_ptr<int, decltype(properties{buffer_location<0>, awidth<32>,
86+
dwidth<32>})>
87+
arg11(tmp11);
7988
auto arg12 =
80-
annotated_ptr<int, decltype(properties{dwidth<32>, awidth<32>})>(tmp11);
89+
annotated_ptr<int, decltype(properties{buffer_location<0>, dwidth<32>,
90+
awidth<32>})>(tmp11);
8191

8292
// default copy constructor
8393
auto arg13 = annotated_ptr(tmp12);
8494
static_assert(std::is_same<decltype(arg13), annotated_ptr_t3>::value,
8595
"deduction guide failed 3");
8696

8797
// Construct from another annotated_ptr and a property list
88-
annotated_ptr<int, decltype(properties{awidth<32>, dwidth<32>})> arg22(
89-
tmp12, properties{dwidth<32>});
98+
annotated_ptr<int, decltype(properties{buffer_location<0>, awidth<32>,
99+
dwidth<32>})>
100+
arg22(tmp12, properties{dwidth<32>});
90101
auto arg23 = annotated_ptr(tmp12, properties{dwidth<32>}); // deduction guide
91102
static_assert(std::is_same<decltype(arg22), annotated_ptr_t1>::value,
92103
"deduction guide failed 4");
@@ -99,7 +110,7 @@ void TestVectorAddWithAnnotatedMMHosts() {
99110
// properties{dwidth<32>}); // ERR
100111

101112
// Property merge
102-
auto arg31 = annotated_ptr_t3(raw, awidth<32>); // OK
113+
auto arg31 = annotated_ptr_t3(raw, buffer_location<0>, awidth<32>); // OK
103114
auto arg32 = annotated_ptr(arg31, properties{dwidth<32>}); // OK
104115
auto arg33 = annotated_ptr(arg32, properties{dwidth<32>, awidth<32>}); // OK
105116
auto arg34 = annotated_ptr(arg32, properties{awidth<32>, latency<22>}); // OK

0 commit comments

Comments
 (0)