Skip to content

Commit a1f8358

Browse files
committed
Merge branch 'sycl' into review/yang/restructure_asan_msan
2 parents 6b1084c + 6a9de65 commit a1f8358

28 files changed

+268
-122
lines changed

devops/containers/ubuntu2204_base.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ COPY actions/cleanup /actions/cleanup
2929
COPY scripts/docker_entrypoint.sh /docker_entrypoint.sh
3030
COPY scripts/install_drivers.sh /opt/install_drivers.sh
3131

32+
USER sycl
33+
3234
ENTRYPOINT ["/docker_entrypoint.sh"]

devops/containers/ubuntu2204_build.Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ gpg --dearmor | tee /etc/apt/keyrings/rocm.gpg > /dev/null && \
2424
# Add rocm repo
2525
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/6.1.1 jammy main" \
2626
| tee --append /etc/apt/sources.list.d/rocm.list && \
27-
printf 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' | tee /etc/apt/preferences.d/rocm-pin-600 && \
28-
apt update
27+
printf 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' | tee /etc/apt/preferences.d/rocm-pin-600
2928
# Install the kernel driver
30-
RUN apt install -yqq rocm-dev && \
29+
RUN apt update && apt install -yqq rocm-dev && \
3130
apt-get clean && \
3231
rm -rf /var/lib/apt/lists/*
3332

@@ -42,5 +41,7 @@ RUN usermod -aG irc sycl
4241

4342
COPY scripts/docker_entrypoint.sh /docker_entrypoint.sh
4443

44+
USER sycl
45+
4546
ENTRYPOINT ["/docker_entrypoint.sh"]
4647

devops/containers/ubuntu2204_intel_drivers.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,7 @@ RUN --mount=type=secret,id=github_token \
2525

2626
COPY scripts/drivers_entrypoint.sh /drivers_entrypoint.sh
2727

28+
USER sycl
29+
2830
ENTRYPOINT ["/bin/bash", "/drivers_entrypoint.sh"]
2931

devops/containers/ubuntu2204_preinstalled.Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,16 @@ ADD sycl_linux.tar.gz /opt/sycl/
1010
ENV PATH /opt/sycl/bin:$PATH
1111
ENV LD_LIBRARY_PATH /opt/sycl/lib:$LD_LIBRARY_PATH
1212

13+
# By default Ubuntu sets an arbitrary UID value, that is different from host
14+
# system. When CI passes default UID value of 1001, some of LLVM tools fail to
15+
# discover user home directory and fail a few LIT tests. Fixes UID and GID to
16+
# 1001, that is used as default by GitHub Actions.
17+
RUN groupadd -g 1001 sycl && useradd sycl -u 1001 -g 1001 -m -s /bin/bash
18+
# Add sycl user to video/irc groups so that it can access GPU
19+
RUN usermod -aG video sycl
20+
RUN usermod -aG irc sycl
21+
22+
USER sycl
23+
1324
ENTRYPOINT ["/bin/bash", "/drivers_entrypoint.sh"]
1425

devops/containers/ubuntu2404_base.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ COPY actions/cleanup /actions/cleanup
2929
COPY scripts/docker_entrypoint.sh /docker_entrypoint.sh
3030
COPY scripts/install_drivers.sh /opt/install_drivers.sh
3131

32+
USER sycl
33+
3234
ENTRYPOINT ["/docker_entrypoint.sh"]

devops/containers/ubuntu2404_intel_drivers.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,7 @@ RUN --mount=type=secret,id=github_token \
2525

2626
COPY scripts/drivers_entrypoint.sh /drivers_entrypoint.sh
2727

28+
USER sycl
29+
2830
ENTRYPOINT ["/bin/bash", "/drivers_entrypoint.sh"]
2931

devops/containers/ubuntu2404_intel_drivers_igc_dev.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,7 @@ RUN --mount=type=secret,id=github_token \
2020

2121
COPY scripts/drivers_entrypoint.sh /drivers_entrypoint.sh
2222

23+
USER sycl
24+
2325
ENTRYPOINT ["/bin/bash", "/drivers_entrypoint.sh"]
2426

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/bin/bash
22

33
if [ -d "$GITHUB_WORKSPACE" ]; then
4-
chown -R sycl:sycl $GITHUB_WORKSPACE
5-
su sycl
4+
sudo chown -R sycl:sycl $GITHUB_WORKSPACE
65
fi
76

87
exec "$@"

sycl/include/sycl/ext/oneapi/experimental/graph.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <sycl/context.hpp> // for context
1313
#include <sycl/detail/export.hpp> // for __SYCL_EXPORT
1414
#include <sycl/detail/kernel_desc.hpp> // for kernel_param_kind_t
15+
#include <sycl/detail/owner_less_base.hpp> // for OwnerLessBase
1516
#include <sycl/detail/property_helper.hpp> // for DataLessPropKind, PropWith...
1617
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
1718
#include <sycl/detail/string_view.hpp>
@@ -239,7 +240,8 @@ class __SYCL_EXPORT dynamic_command_group {
239240

240241
namespace detail {
241242
// Templateless modifiable command-graph base class.
242-
class __SYCL_EXPORT modifiable_command_graph {
243+
class __SYCL_EXPORT modifiable_command_graph
244+
: public sycl::detail::OwnerLessBase<modifiable_command_graph> {
243245
public:
244246
/// Constructor.
245247
/// @param SyclContext Context to use for graph.
@@ -401,7 +403,8 @@ inline
401403
}
402404

403405
// Templateless executable command-graph base class.
404-
class __SYCL_EXPORT executable_command_graph {
406+
class __SYCL_EXPORT executable_command_graph
407+
: public sycl::detail::OwnerLessBase<executable_command_graph> {
405408
public:
406409
/// An executable command-graph is not user constructable.
407410
executable_command_graph() = delete;

sycl/include/sycl/ext/oneapi/experimental/reduction_properties.hpp

Lines changed: 66 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,20 @@ struct initialize_to_identity_key
3232
};
3333
inline constexpr initialize_to_identity_key::value_t initialize_to_identity;
3434

35+
namespace detail {
36+
struct reduction_property_check_anchor {};
37+
} // namespace detail
38+
39+
template <>
40+
struct is_property_key_of<deterministic_key,
41+
detail::reduction_property_check_anchor>
42+
: std::true_type {};
43+
44+
template <>
45+
struct is_property_key_of<initialize_to_identity_key,
46+
detail::reduction_property_check_anchor>
47+
: std::true_type {};
48+
3549
} // namespace experimental
3650
} // namespace oneapi
3751
} // namespace ext
@@ -83,60 +97,88 @@ template <typename BinaryOperation>
8397
struct IsDeterministicOperator<DeterministicOperatorWrapper<BinaryOperation>>
8498
: std::true_type {};
8599

100+
template <typename PropertyList>
101+
inline constexpr bool is_valid_reduction_prop_list =
102+
ext::oneapi::experimental::detail::all_are_properties_of_v<
103+
ext::oneapi::experimental::detail::reduction_property_check_anchor,
104+
PropertyList>;
105+
106+
template <typename BinaryOperation, typename PropertyList, typename... Args>
107+
auto convert_reduction_properties(BinaryOperation combiner,
108+
PropertyList properties, Args &&...args) {
109+
if constexpr (is_valid_reduction_prop_list<PropertyList>) {
110+
auto WrappedOp = WrapOp(combiner, properties);
111+
auto RuntimeProps = GetReductionPropertyList(properties);
112+
return sycl::reduction(std::forward<Args>(args)..., WrappedOp,
113+
RuntimeProps);
114+
} else {
115+
// Invalid, will be disabled by SFINAE at the caller side. Make sure no hard
116+
// error is emitted from here.
117+
}
118+
}
86119
} // namespace detail
87120

88121
template <typename BufferT, typename BinaryOperation, typename PropertyList>
89122
auto reduction(BufferT vars, handler &cgh, BinaryOperation combiner,
90-
PropertyList properties) {
123+
PropertyList properties)
124+
-> std::enable_if_t<detail::is_valid_reduction_prop_list<PropertyList>,
125+
decltype(detail::convert_reduction_properties(
126+
combiner, properties, vars, cgh))> {
91127
detail::CheckReductionIdentity<typename BufferT::value_type, BinaryOperation>(
92128
properties);
93-
auto WrappedOp = detail::WrapOp(combiner, properties);
94-
auto RuntimeProps = detail::GetReductionPropertyList(properties);
95-
return reduction(vars, cgh, WrappedOp, RuntimeProps);
129+
return detail::convert_reduction_properties(combiner, properties, vars, cgh);
96130
}
97131

98132
template <typename T, typename BinaryOperation, typename PropertyList>
99-
auto reduction(T *var, BinaryOperation combiner, PropertyList properties) {
133+
auto reduction(T *var, BinaryOperation combiner, PropertyList properties)
134+
-> std::enable_if_t<detail::is_valid_reduction_prop_list<PropertyList>,
135+
decltype(detail::convert_reduction_properties(
136+
combiner, properties, var))> {
100137
detail::CheckReductionIdentity<T, BinaryOperation>(properties);
101-
auto WrappedOp = detail::WrapOp(combiner, properties);
102-
auto RuntimeProps = detail::GetReductionPropertyList(properties);
103-
return reduction(var, WrappedOp, RuntimeProps);
138+
return detail::convert_reduction_properties(combiner, properties, var);
104139
}
105140

106141
template <typename T, size_t Extent, typename BinaryOperation,
107142
typename PropertyList>
108143
auto reduction(span<T, Extent> vars, BinaryOperation combiner,
109-
PropertyList properties) {
144+
PropertyList properties)
145+
-> std::enable_if_t<detail::is_valid_reduction_prop_list<PropertyList>,
146+
decltype(detail::convert_reduction_properties(
147+
combiner, properties, vars))> {
110148
detail::CheckReductionIdentity<T, BinaryOperation>(properties);
111-
auto WrappedOp = detail::WrapOp(combiner, properties);
112-
auto RuntimeProps = detail::GetReductionPropertyList(properties);
113-
return reduction(vars, WrappedOp, RuntimeProps);
149+
return detail::convert_reduction_properties(combiner, properties, vars);
114150
}
115151

116152
template <typename BufferT, typename BinaryOperation, typename PropertyList>
117153
auto reduction(BufferT vars, handler &cgh,
118154
const typename BufferT::value_type &identity,
119-
BinaryOperation combiner, PropertyList properties) {
120-
auto WrappedOp = detail::WrapOp(combiner, properties);
121-
auto RuntimeProps = detail::GetReductionPropertyList(properties);
122-
return reduction(vars, cgh, identity, WrappedOp, RuntimeProps);
155+
BinaryOperation combiner, PropertyList properties)
156+
-> std::enable_if_t<detail::is_valid_reduction_prop_list<PropertyList>,
157+
decltype(detail::convert_reduction_properties(
158+
combiner, properties, vars, cgh, identity))> {
159+
return detail::convert_reduction_properties(combiner, properties, vars, cgh,
160+
identity);
123161
}
124162

125163
template <typename T, typename BinaryOperation, typename PropertyList>
126164
auto reduction(T *var, const T &identity, BinaryOperation combiner,
127-
PropertyList properties) {
128-
auto WrappedOp = detail::WrapOp(combiner, properties);
129-
auto RuntimeProps = detail::GetReductionPropertyList(properties);
130-
return reduction(var, identity, WrappedOp, RuntimeProps);
165+
PropertyList properties)
166+
-> std::enable_if_t<detail::is_valid_reduction_prop_list<PropertyList>,
167+
decltype(detail::convert_reduction_properties(
168+
combiner, properties, var, identity))> {
169+
return detail::convert_reduction_properties(combiner, properties, var,
170+
identity);
131171
}
132172

133173
template <typename T, size_t Extent, typename BinaryOperation,
134174
typename PropertyList>
135175
auto reduction(span<T, Extent> vars, const T &identity,
136-
BinaryOperation combiner, PropertyList properties) {
137-
auto WrappedOp = detail::WrapOp(combiner, properties);
138-
auto RuntimeProps = detail::GetReductionPropertyList(properties);
139-
return reduction(vars, identity, WrappedOp, RuntimeProps);
176+
BinaryOperation combiner, PropertyList properties)
177+
-> std::enable_if_t<detail::is_valid_reduction_prop_list<PropertyList>,
178+
decltype(detail::convert_reduction_properties(
179+
combiner, properties, vars, identity))> {
180+
return detail::convert_reduction_properties(combiner, properties, vars,
181+
identity);
140182
}
141183

142184
} // namespace _V1

0 commit comments

Comments
 (0)