Skip to content

Commit a26b643

Browse files
committed
Merge remote-tracking branch 'origin/sycl' into llvmspirv_pulldown
2 parents dce52b4 + 70f911b commit a26b643

File tree

33 files changed

+413
-256
lines changed

33 files changed

+413
-256
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ sycl/include/sycl/ext/oneapi/experimental/graph.hpp @intel/sycl-graphs-reviewers
121121
sycl/source/detail/graph_impl.cpp @intel/sycl-graphs-reviewers
122122
sycl/source/detail/graph_impl.hpp @intel/sycl-graphs-reviewers
123123
sycl/unittests/Extensions/CommandGraph.cpp @intel/sycl-graphs-reviewers
124+
sycl/doc/design/CommandGraph.md @intel/sycl-graphs-reviewers
125+
sycl/test-e2e/Graph @intel/sycl-graphs-reviewers
126+
sycl/doc/extensions/**/sycl_ext_oneapi_graph.asciidoc @intel/sycl-graphs-reviewers
124127

125128
# syclcompat library
126129
sycl/**/syclcompat/ @intel/syclcompat-lib-reviewers

libclc/amdgcn-amdhsa/libspirv/group/collectives.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ __CLC_SUBGROUP_COLLECTIVE(FMax, __CLC_MAX, float, f, -INFINITY)
150150
__CLC_SUBGROUP_COLLECTIVE(FMax, __CLC_MAX, double, d, -INFINITY)
151151

152152
__CLC_SUBGROUP_COLLECTIVE(All, __CLC_AND, bool, a, true)
153-
__CLC_SUBGROUP_COLLECTIVE(Any, __CLC_OR, bool, a, true)
153+
__CLC_SUBGROUP_COLLECTIVE(Any, __CLC_OR, bool, a, false)
154154

155155
#undef __CLC_SUBGROUP_COLLECTIVE_BODY
156156
#undef __CLC_SUBGROUP_COLLECTIVE

llvm/utils/git/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ deprecated==1.2.13
1414
# via pygithub
1515
gitdb==4.0.9
1616
# via gitpython
17-
gitpython==3.1.30
17+
gitpython==3.1.32
1818
# via -r requirements.txt.in
1919
idna==3.4
2020
# via requests

sycl/cmake/modules/AddSYCLLibraryUnitTest.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
set(SYCL_COMPATH_UNITTEST_GCC_TOOLCHAIN "" CACHE PATH "Path to GCC installation")
12
# add_sycl_library_unittest(test_suite_name sycl_extra_flags
23
# file1.cpp file2.cpp ...)
34
#
@@ -26,6 +27,12 @@ macro(add_sycl_library_unittest test_suite_name)
2627
set(_LLVM_TARGET_DEPENDENCIES
2728
"llvm_gtest_main;llvm_gtest;LLVMTestingSupport;LLVMSupport;LLVMDemangle")
2829

30+
if (NOT SYCL_COMPAT_UNITTEST_GCC_TOOLCHAIN STREQUAL "")
31+
set(_GCC_TOOLCHAIN "--gcc-toolchain=${SYCL_COMPAT_UNITTEST_GCC_TOOLCHAIN}")
32+
else()
33+
set(_GCC_TOOLCHAIN "")
34+
endif()
35+
2936
foreach(_lib ${_LLVM_TARGET_DEPENDENCIES})
3037
list(APPEND _LIBRARIES $<TARGET_LINKER_FILE:${_lib}>)
3138
endforeach()
@@ -53,6 +60,7 @@ macro(add_sycl_library_unittest test_suite_name)
5360

5461
add_custom_target(${_BIN_TARGET}
5562
COMMAND ${DEVICE_COMPILER_EXECUTABLE} -fsycl ${ARG_SOURCES}
63+
${_GCC_TOOLCHAIN}
5664
-o ${_OUTPUT_BIN}
5765
${ARG_SYCL_EXTRA_FLAGS}
5866
${_INTERNAL_EXTRA_FLAGS}

sycl/doc/extensions/experimental/sycl_ext_oneapi_annotated_ptr.asciidoc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ class annotated_ref {
566566
annotated_ref(const annotated_ref&) = default;
567567
operator T() const;
568568
annotated_ref& operator=(const T &);
569-
annotated_ref& operator=(const annotated_ref&) = default;
569+
annotated_ref& operator=(const annotated_ref&);
570570
};
571571
} // namespace sycl::ext::oneapi::experimental
572572
```
@@ -610,10 +610,11 @@ applying the annotations when the object is stored to memory.
610610
a|
611611
[source,c++]
612612
----
613-
annotated_ref& operator=(const annotated_ref&) = default;
613+
annotated_ref& operator=(const annotated_ref&);
614614
----
615615
|
616-
Assign from another `annotated_ref` object.
616+
Copy an object of type `T` from another `annotated_ref<T, ...>` object.
617+
Applying the annotations when the object is loaded from and stored to memory.
617618

618619
|===
619620

sycl/include/sycl/detail/common.hpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -371,15 +371,6 @@ size_t getLinearIndex(const T<Dims> &Index, const U<Dims> &Range) {
371371
return LinearIndex;
372372
}
373373

374-
// Kernel set ID, used to group kernels (represented by OSModule & kernel name
375-
// pairs) into disjoint sets based on the kernel distribution among device
376-
// images.
377-
using KernelSetId = size_t;
378-
// Kernel set ID for kernels contained within the SPIR-V file specified via
379-
// environment.
380-
constexpr KernelSetId SpvFileKSId = 0;
381-
constexpr KernelSetId LastKSId = SpvFileKSId;
382-
383374
template <typename T> struct InlineVariableHelper {
384375
static constexpr T value{};
385376
};

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ class annotated_ref {
107107
template <typename T, typename... Props>
108108
class annotated_ref<T, detail::properties_t<Props...>> {
109109
using property_list_t = detail::properties_t<Props...>;
110+
using this_t = annotated_ref<T, detail::properties_t<Props...>>;
110111

111112
private:
112113
T *m_Ptr;
@@ -125,7 +126,7 @@ class annotated_ref<T, detail::properties_t<Props...>> {
125126
#endif
126127
}
127128

128-
annotated_ref &operator=(const T &Obj) {
129+
this_t &operator=(const T &Obj) {
129130
#ifdef __SYCL_DEVICE_ONLY__
130131
*__builtin_intel_sycl_ptr_annotation(
131132
m_Ptr, detail::PropertyMetaInfo<Props>::name...,
@@ -136,7 +137,19 @@ class annotated_ref<T, detail::properties_t<Props...>> {
136137
return *this;
137138
}
138139

139-
annotated_ref &operator=(const annotated_ref &) = default;
140+
this_t &operator=(const this_t &Obj) {
141+
const T &t = Obj;
142+
this->operator=(t);
143+
return *this;
144+
}
145+
146+
template <typename... OtherProperties>
147+
this_t &operator=(
148+
const annotated_ref<T, detail::properties_t<OtherProperties...>> &Obj) {
149+
const T &t = Obj;
150+
this->operator=(t);
151+
return *this;
152+
}
140153

141154
PROPAGATE_OP(+=)
142155
PROPAGATE_OP(-=)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urContextGetInfo(
4646
size_t propSize, void *pContextInfo, size_t *pPropSizeRet) {
4747
UrReturnHelper ReturnValue(propSize, pContextInfo, pPropSizeRet);
4848

49-
switch (uint32_t{ContextInfoType}) {
49+
switch (static_cast<uint32_t>(ContextInfoType)) {
5050
case UR_CONTEXT_INFO_NUM_DEVICES:
5151
return ReturnValue(1);
5252
case UR_CONTEXT_INFO_DEVICES:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77
//===-----------------------------------------------------------------===//
88

9+
#include <array>
910
#include <cassert>
1011
#include <sstream>
1112

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,13 @@ urToCudaImageChannelFormat(ur_image_channel_type_t image_channel_type,
7171
PixelTypeSizeBytes = SIZE; \
7272
break; \
7373
}
74+
// These new formats were brought in in CUDA 11.5
75+
#if CUDA_VERSION >= 11050
7476
CASE(UR_IMAGE_CHANNEL_TYPE_UNORM_INT8, CU_AD_FORMAT_UNORM_INT8X1, 1)
77+
CASE(UR_IMAGE_CHANNEL_TYPE_UNORM_INT16, CU_AD_FORMAT_UNORM_INT16X1, 2)
78+
#endif
7579
CASE(UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8, CU_AD_FORMAT_UNSIGNED_INT8, 1)
7680
CASE(UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8, CU_AD_FORMAT_SIGNED_INT8, 1)
77-
CASE(UR_IMAGE_CHANNEL_TYPE_UNORM_INT16, CU_AD_FORMAT_UNORM_INT16X1, 2)
7881
CASE(UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16, CU_AD_FORMAT_UNSIGNED_INT16, 2)
7982
CASE(UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16, CU_AD_FORMAT_SIGNED_INT16, 2)
8083
CASE(UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT, CU_AD_FORMAT_HALF, 2)

sycl/plugins/unified_runtime/ur/adapters/cuda/kernel.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <cuda.h>
1111
#include <ur_api.h>
1212

13+
#include <array>
1314
#include <atomic>
1415
#include <cassert>
1516
#include <numeric>

sycl/plugins/unified_runtime/ur/adapters/cuda/queue.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <ur/ur.hpp>
1111

12+
#include <algorithm>
1213
#include <cuda.h>
1314
#include <vector>
1415

sycl/source/detail/device_global_map_entry.hpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <mutex>
1515
#include <optional>
1616
#include <set>
17+
#include <unordered_set>
1718

1819
#include <detail/pi_utils.hpp>
1920
#include <sycl/detail/defines_elementary.hpp>
@@ -51,11 +52,11 @@ struct DeviceGlobalMapEntry {
5152
std::string MUniqueId;
5253
// Pointer to the device_global on host.
5354
const void *MDeviceGlobalPtr = nullptr;
55+
// Images device_global are used by.
56+
std::unordered_set<RTDeviceBinaryImage *> MImages;
5457
// The image identifiers for the images using the device_global used by in the
5558
// cache.
5659
std::set<std::uintptr_t> MImageIdentifiers;
57-
// The kernel-set IDs for the images using the device_global.
58-
std::set<KernelSetId> MKSIds;
5960
// Size of the underlying type in the device_global.
6061
std::uint32_t MDeviceGlobalTSize = 0;
6162
// True if the device_global has been decorated with device_image_scope.
@@ -68,10 +69,11 @@ struct DeviceGlobalMapEntry {
6869

6970
// Constructor for only initializing ID, type size, and device image scope
7071
// flag. The pointer to the device global will be initialized later.
71-
DeviceGlobalMapEntry(std::string UniqueId, std::uintptr_t ImgId,
72-
KernelSetId KSId, std::uint32_t DeviceGlobalTSize,
72+
DeviceGlobalMapEntry(std::string UniqueId, RTDeviceBinaryImage *Img,
73+
std::uint32_t DeviceGlobalTSize,
7374
bool IsDeviceImageScopeDecorated)
74-
: MUniqueId(UniqueId), MImageIdentifiers{ImgId}, MKSIds{KSId},
75+
: MUniqueId(UniqueId), MImages{Img},
76+
MImageIdentifiers{reinterpret_cast<uintptr_t>(Img)},
7577
MDeviceGlobalTSize(DeviceGlobalTSize),
7678
MIsDeviceImageScopeDecorated(IsDeviceImageScopeDecorated) {}
7779

@@ -85,8 +87,7 @@ struct DeviceGlobalMapEntry {
8587

8688
// Initialize the device_global's element type size and the flag signalling
8789
// if the device_global has the device_image_scope property.
88-
void initialize(std::uintptr_t ImgId, KernelSetId KSId,
89-
std::uint32_t DeviceGlobalTSize,
90+
void initialize(RTDeviceBinaryImage *Img, std::uint32_t DeviceGlobalTSize,
9091
bool IsDeviceImageScopeDecorated) {
9192
if (MDeviceGlobalTSize != 0) {
9293
// The device global entry has already been initialized. This can happen
@@ -99,8 +100,8 @@ struct DeviceGlobalMapEntry {
99100
"Device global intializations disagree on image scope decoration.");
100101
return;
101102
}
102-
MImageIdentifiers.insert(ImgId);
103-
MKSIds.insert(KSId);
103+
MImages.insert(Img);
104+
MImageIdentifiers.insert(reinterpret_cast<uintptr_t>(Img));
104105
MDeviceGlobalTSize = DeviceGlobalTSize;
105106
MIsDeviceImageScopeDecorated = IsDeviceImageScopeDecorated;
106107
}

sycl/source/detail/memory_manager.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,13 +1133,13 @@ getOrBuildProgramForDeviceGlobal(QueueImplPtr Queue,
11331133
assert(DeviceGlobalEntry->MIsDeviceImageScopeDecorated &&
11341134
"device_global is not device image scope decorated.");
11351135

1136-
// If the device global is used in multiple kernel sets we cannot proceed.
1137-
if (DeviceGlobalEntry->MKSIds.size() > 1)
1136+
// If the device global is used in multiple device images we cannot proceed.
1137+
if (DeviceGlobalEntry->MImageIdentifiers.size() > 1)
11381138
throw sycl::exception(make_error_code(errc::invalid),
11391139
"More than one image exists with the device_global.");
11401140

11411141
// If there are no kernels using the device_global we cannot proceed.
1142-
if (DeviceGlobalEntry->MKSIds.size() == 0)
1142+
if (DeviceGlobalEntry->MImageIdentifiers.size() == 0)
11431143
throw sycl::exception(make_error_code(errc::invalid),
11441144
"No image exists with the device_global.");
11451145

@@ -1153,9 +1153,9 @@ getOrBuildProgramForDeviceGlobal(QueueImplPtr Queue,
11531153

11541154
// If there was no cached program, build one.
11551155
auto Context = createSyclObjFromImpl<context>(ContextImpl);
1156-
KernelSetId KSId = *DeviceGlobalEntry->MKSIds.begin();
11571156
ProgramManager &PM = ProgramManager::getInstance();
1158-
RTDeviceBinaryImage &Img = PM.getDeviceImage(KSId, Context, Device);
1157+
RTDeviceBinaryImage &Img =
1158+
PM.getDeviceImage(DeviceGlobalEntry->MImages, Context, Device);
11591159
device_image_plain DeviceImage =
11601160
PM.getDeviceImageFromBinaryImage(&Img, Context, Device);
11611161
device_image_plain BuiltImage = PM.build(DeviceImage, {Device}, {});

0 commit comments

Comments
 (0)