Skip to content

Commit 225106d

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web' (4 commits)
2 parents b6109e2 + 47d3937 commit 225106d

File tree

28 files changed

+253
-141
lines changed

28 files changed

+253
-141
lines changed

libdevice/include/sanitizer_defs.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ extern SYCL_EXTERNAL __attribute__((convergent)) void
6161
__spirv_ControlBarrier(int32_t Execution, int32_t Memory,
6262
int32_t Semantics) noexcept;
6363

64-
template <typename T>
65-
extern SYCL_EXTERNAL T __spirv_SpecConstant(int ID, T default_value) noexcept;
66-
6764
extern "C" SYCL_EXTERNAL void __devicelib_exit();
6865

6966
#endif // __SPIR__ || __SPIRV__

libdevice/include/sanitizer_utils.hpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
//===----------------------------------------------------------------------===//
88
#pragma once
99

10-
#include "sanitizer_common/sanitizer_libdevice.hpp"
1110
#include "sanitizer_defs.hpp"
11+
#include "spirv_vars.h"
1212

1313
#if defined(__SPIR__) || defined(__SPIRV__)
1414

@@ -49,11 +49,6 @@ inline __SYCL_PRIVATE__ void *ToPrivate(void *ptr) {
4949
return __spirv_GenericCastToPtrExplicit_ToPrivate(ptr, 7);
5050
}
5151

52-
inline DeviceType GetDeviceTy() {
53-
return static_cast<DeviceType>(
54-
__spirv_SpecConstant(SPEC_CONSTANT_DEVICE_TYPE_ID, 0));
55-
}
56-
5752
template <typename T> T Memset(T ptr, int value, size_t size) {
5853
for (size_t i = 0; i < size; i++) {
5954
ptr[i] = value;

libdevice/sanitizer/asan_rtl.cpp

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -264,15 +264,16 @@ inline uptr MemToShadow(uptr addr, uint32_t as,
264264
#elif defined(__LIBDEVICE_DG2__)
265265
shadow_ptr = MemToShadow_DG2(addr, as, debug);
266266
#else
267-
if (GetDeviceTy() == DeviceType::CPU) {
267+
auto launch_info = (__SYCL_GLOBAL__ const AsanRuntimeData *)__AsanLaunchInfo;
268+
if (launch_info->DeviceTy == DeviceType::CPU) {
268269
shadow_ptr = MemToShadow_CPU(addr);
269-
} else if (GetDeviceTy() == DeviceType::GPU_PVC) {
270+
} else if (launch_info->DeviceTy == DeviceType::GPU_PVC) {
270271
shadow_ptr = MemToShadow_PVC(addr, as, debug);
271-
} else if (GetDeviceTy() == DeviceType::GPU_DG2) {
272+
} else if (launch_info->DeviceTy == DeviceType::GPU_DG2) {
272273
shadow_ptr = MemToShadow_DG2(addr, as, debug);
273274
} else {
274275
ASAN_DEBUG(__spirv_ocl_printf(__asan_print_unsupport_device_type,
275-
(int)GetDeviceTy()));
276+
(int)launch_info->DeviceTy));
276277
ReportUnknownDevice(debug);
277278
return 0;
278279
}
@@ -888,7 +889,8 @@ DEVICE_EXTERN_C_NOINLINE void __asan_set_shadow_private(uptr shadow, uptr size,
888889
static __SYCL_CONSTANT__ const char __asan_print_private_base[] =
889890
"[kernel] set_private_base: %llu -> %p\n";
890891

891-
inline void SetPrivateBaseImpl(__SYCL_PRIVATE__ void *ptr) {
892+
DEVICE_EXTERN_C_NOINLINE void
893+
__asan_set_private_base(__SYCL_PRIVATE__ void *ptr) {
892894
auto launch_info = (__SYCL_GLOBAL__ const AsanRuntimeData *)__AsanLaunchInfo;
893895
const size_t sid = SubGroupLinearId();
894896
if (!launch_info || sid >= ASAN_MAX_SG_PRIVATE ||
@@ -902,17 +904,4 @@ inline void SetPrivateBaseImpl(__SYCL_PRIVATE__ void *ptr) {
902904
SubGroupBarrier();
903905
}
904906

905-
DEVICE_EXTERN_C_NOINLINE void
906-
__asan_set_private_base(__SYCL_PRIVATE__ void *ptr) {
907-
#if defined(__LIBDEVICE_CPU__)
908-
return;
909-
#elif defined(__LIBDEVICE_DG2__) || defined(__LIBDEVICE_PVC__)
910-
SetPrivateBaseImpl(ptr);
911-
#else
912-
if (GetDeviceTy() == DeviceType::CPU)
913-
return;
914-
SetPrivateBaseImpl(ptr);
915-
#endif
916-
}
917-
918907
#endif // __SPIR__ || __SPIRV__

libdevice/sanitizer/msan_rtl.cpp

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,16 @@ inline uptr MemToShadow(uptr addr, uint32_t as) {
216216
#elif defined(__LIBDEVICE_CPU__)
217217
shadow_ptr = MemToShadow_CPU(addr);
218218
#else
219-
if (GetDeviceTy() == DeviceType::CPU) {
219+
if (LIKELY(GetMsanLaunchInfo->DeviceTy == DeviceType::CPU)) {
220220
shadow_ptr = MemToShadow_CPU(addr);
221-
} else if (GetDeviceTy() == DeviceType::GPU_PVC) {
221+
} else if (GetMsanLaunchInfo->DeviceTy == DeviceType::GPU_PVC) {
222222
shadow_ptr = MemToShadow_PVC(addr, as);
223-
} else if (GetDeviceTy() == DeviceType::GPU_DG2) {
223+
} else if (GetMsanLaunchInfo->DeviceTy == DeviceType::GPU_DG2) {
224224
shadow_ptr = MemToShadow_DG2(addr, as);
225225
} else {
226226
shadow_ptr = GetMsanLaunchInfo->CleanShadow;
227-
MSAN_DEBUG(
228-
__spirv_ocl_printf(__msan_print_unsupport_device_type, GetDeviceTy()));
227+
MSAN_DEBUG(__spirv_ocl_printf(__msan_print_unsupport_device_type,
228+
GetMsanLaunchInfo->DeviceTy));
229229
}
230230
#endif
231231

@@ -273,17 +273,17 @@ inline uptr MemToOrigin(uptr addr, uint32_t as) {
273273
#elif defined(__LIBDEVICE_CPU__)
274274
origin_ptr = MemToOrigin_CPU(addr);
275275
#else
276-
if (GetDeviceTy() == DeviceType::CPU) {
276+
if (LIKELY(GetMsanLaunchInfo->DeviceTy == DeviceType::CPU)) {
277277
origin_ptr = MemToOrigin_CPU(aligned_addr);
278-
} else if (GetDeviceTy() == DeviceType::GPU_PVC) {
278+
} else if (GetMsanLaunchInfo->DeviceTy == DeviceType::GPU_PVC) {
279279
origin_ptr = MemToOrigin_PVC(aligned_addr, as);
280-
} else if (GetDeviceTy() == DeviceType::GPU_DG2) {
280+
} else if (GetMsanLaunchInfo->DeviceTy == DeviceType::GPU_DG2) {
281281
origin_ptr = MemToOrigin_DG2(aligned_addr, as);
282282
} else {
283283
// Return clean shadow (0s) by default
284284
origin_ptr = GetMsanLaunchInfo->CleanShadow;
285-
MSAN_DEBUG(
286-
__spirv_ocl_printf(__msan_print_unsupport_device_type, GetDeviceTy()));
285+
MSAN_DEBUG(__spirv_ocl_printf(__msan_print_unsupport_device_type,
286+
GetMsanLaunchInfo->DeviceTy));
287287
}
288288
#endif
289289

@@ -743,7 +743,8 @@ DEVICE_EXTERN_C_NOINLINE void __msan_unpoison_shadow(uptr ptr, uint32_t as,
743743
static __SYCL_CONSTANT__ const char __msan_print_private_base[] =
744744
"[kernel] __msan_set_private_base(sid=%llu): %p\n";
745745

746-
inline void SetPrivateBaseImpl(__SYCL_PRIVATE__ void *ptr) {
746+
DEVICE_EXTERN_C_NOINLINE void
747+
__msan_set_private_base(__SYCL_PRIVATE__ void *ptr) {
747748
const size_t sid = SubGroupLinearId();
748749
if (!GetMsanLaunchInfo || sid >= MSAN_MAX_SG_PRIVATE ||
749750
GetMsanLaunchInfo->PrivateShadowOffset == 0 ||
@@ -757,19 +758,6 @@ inline void SetPrivateBaseImpl(__SYCL_PRIVATE__ void *ptr) {
757758
SubGroupBarrier();
758759
}
759760

760-
DEVICE_EXTERN_C_NOINLINE void
761-
__msan_set_private_base(__SYCL_PRIVATE__ void *ptr) {
762-
#if defined(__LIBDEVICE_CPU__)
763-
return;
764-
#elif defined(__LIBDEVICE_DG2__) || defined(__LIBDEVICE_PVC__)
765-
SetPrivateBaseImpl(ptr);
766-
#else
767-
if (GetDeviceTy() == DeviceType::CPU)
768-
return;
769-
SetPrivateBaseImpl(ptr);
770-
#endif
771-
}
772-
773761
static __SYCL_CONSTANT__ const char __msan_print_strided_copy_unsupport_type[] =
774762
"[kernel] __msan_unpoison_strided_copy: unsupported type(%d)\n";
775763

libdevice/sanitizer/tsan_rtl.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@ inline __SYCL_GLOBAL__ RawShadow *MemToShadow(uptr addr, uint32_t as) {
127127
#elif defined(__LIBDEVICE_PVC__)
128128
shadow_ptr = MemToShadow_PVC(addr, as);
129129
#else
130-
if (GetDeviceTy() == DeviceType::CPU) {
130+
if (TsanLaunchInfo->DeviceTy == DeviceType::CPU) {
131131
shadow_ptr = MemToShadow_CPU(addr, as);
132-
} else if (GetDeviceTy() == DeviceType::GPU_PVC) {
132+
} else if (TsanLaunchInfo->DeviceTy == DeviceType::GPU_PVC) {
133133
shadow_ptr = MemToShadow_PVC(addr, as);
134134
} else {
135135
TSAN_DEBUG(__spirv_ocl_printf(__tsan_print_unsupport_device_type,
136-
(int)GetDeviceTy()));
136+
(int)TsanLaunchInfo->DeviceTy));
137137
return nullptr;
138138
}
139139
#endif
@@ -186,16 +186,10 @@ inline void DoReportRace(__SYCL_GLOBAL__ RawShadow *s, AccessType type,
186186
return;
187187
}
188188

189-
#if defined(__LIBDEVICE_CPU__)
190-
#elif defined(__LIBDEVICE_DG2__) || defined(__LIBDEVICE_PVC__)
191-
if (as == ADDRESS_SPACE_GENERIC) {
189+
if (as == ADDRESS_SPACE_GENERIC &&
190+
TsanLaunchInfo->DeviceTy != DeviceType::CPU) {
192191
ConvertGenericPointer(addr, as);
193192
}
194-
#else
195-
if (as == ADDRESS_SPACE_GENERIC && GetDeviceTy() != DeviceType::CPU) {
196-
ConvertGenericPointer(addr, as);
197-
}
198-
#endif
199193

200194
// Check if current address already being recorded before.
201195
for (uint32_t i = 0; i < TsanLaunchInfo->RecordedReportCount; i++) {
@@ -473,7 +467,7 @@ DEVICE_EXTERN_C_NOINLINE void __tsan_cleanup_private(uptr addr, size_t size) {
473467
#elif defined(__LIBDEVICE_PVC__)
474468
return;
475469
#else
476-
if (GetDeviceTy() != DeviceType::CPU)
470+
if (TsanLaunchInfo->DeviceTy != DeviceType::CPU)
477471
return;
478472

479473
__tsan_cleanup_private_cpu_impl(addr, size);

sycl/doc/extensions/proposed/sycl_ext_oneapi_free_function_kernels.asciidoc

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ https://github.com/intel/llvm/issues
3737

3838
== Dependencies
3939

40-
This extension is written against the SYCL 2020 revision 8 specification.
40+
This extension is written against the SYCL 2020 revision 10 specification.
4141
All references below to the "core SYCL specification" or to section numbers in
4242
the SYCL specification refer to that revision.
4343

@@ -941,6 +941,27 @@ bytes) of the device local memory that is represented by the
941941
The pointer passed to `zeKernelSetArgumentValue` or `clSetKernelArg` must be
942942
NULL in this case.
943943

944+
Some kernel features are disallowed when submitting a kernel using Level Zero or
945+
OpenCL.
946+
Other features require the kernel to be invoked in some special way.
947+
These features are detailed below:
948+
949+
* When a kernel's static call tree contains a call to
950+
`get_work_group_scratch_memory` from
951+
link:../experimental/sycl_ext_oneapi_work_group_scratch_memory.asciidoc[
952+
sycl_ext_oneapi_work_group_scratch_memory], the kernel has an additional
953+
"hidden" argument whose value must be set when the kernel is invoked.
954+
This argument appears after all other kernel arguments.
955+
The value corresponds to the `work_group_scratch_size` launch property, which
956+
specifies the size of the dynamic device local memory that is available via
957+
`get_work_group_scratch_memory`.
958+
The kernel argument's size specifies the size (in bytes) of the dynamic device
959+
local memory.
960+
The kernel argument's pointer must be NULL.
961+
962+
* Kernels must not use specialization constants as defined in section 4.9.5
963+
"Specialization constants" of the core SYCL specification.
964+
944965

945966
== Implementation notes
946967

unified-runtime/include/ur_api.h

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unified-runtime/scripts/core/kernel.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,8 @@ params:
421421
desc: "[in] handle of Sampler object."
422422
returns:
423423
- $X_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX
424+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
425+
- "Device `$X_DEVICE_INFO_IMAGE_SUPPORT` is false"
424426
--- #--------------------------------------------------------------------------
425427
type: struct
426428
desc: "Properties for for $xKernelSetArgMemObj."

unified-runtime/scripts/core/memory.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ returns:
258258
- "`pImageDesc && pImageDesc->numSamples != 0`"
259259
- "`pImageDesc && pImageDesc->rowPitch != 0 && pHost == nullptr`"
260260
- "`pImageDesc && pImageDesc->slicePitch != 0 && pHost == nullptr`"
261+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
262+
- "Device `$X_DEVICE_INFO_IMAGE_SUPPORT` is false"
261263
- $X_RESULT_ERROR_INVALID_IMAGE_SIZE
262264
- $X_RESULT_ERROR_INVALID_OPERATION
263265
- $X_RESULT_ERROR_INVALID_HOST_PTR:
@@ -627,6 +629,8 @@ returns:
627629
- $X_RESULT_ERROR_INVALID_NULL_POINTER:
628630
- "`propSize != 0 && pPropValue == NULL`"
629631
- "`pPropValue == NULL && pPropSizeRet == NULL`"
632+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
633+
- "Device `$X_DEVICE_INFO_IMAGE_SUPPORT` is false"
630634
- $X_RESULT_ERROR_INVALID_MEM_OBJECT
631635
- $X_RESULT_ERROR_OUT_OF_RESOURCES
632636
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY

unified-runtime/scripts/core/sampler.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ returns:
105105
- $X_RESULT_ERROR_INVALID_OPERATION
106106
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
107107
- $X_RESULT_ERROR_OUT_OF_RESOURCES
108+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
109+
- "Device `$X_DEVICE_INFO_IMAGE_SUPPORT` is false"
108110
--- #--------------------------------------------------------------------------
109111
type: function
110112
desc: "Get a reference to the sampler object handle. Increment its reference count"
@@ -121,6 +123,8 @@ returns:
121123
- $X_RESULT_ERROR_INVALID_SAMPLER
122124
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
123125
- $X_RESULT_ERROR_OUT_OF_RESOURCES
126+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
127+
- "Device `$X_DEVICE_INFO_IMAGE_SUPPORT` is false"
124128
--- #--------------------------------------------------------------------------
125129
type: function
126130
desc: "Decrement the sampler's reference count and delete the sampler if the reference count becomes zero."
@@ -137,6 +141,8 @@ returns:
137141
- $X_RESULT_ERROR_INVALID_SAMPLER
138142
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
139143
- $X_RESULT_ERROR_OUT_OF_RESOURCES
144+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
145+
- "Device `$X_DEVICE_INFO_IMAGE_SUPPORT` is false"
140146
--- #--------------------------------------------------------------------------
141147
type: function
142148
desc: "Query information about a sampler object"
@@ -173,6 +179,8 @@ returns:
173179
- $X_RESULT_ERROR_INVALID_SAMPLER
174180
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
175181
- $X_RESULT_ERROR_OUT_OF_RESOURCES
182+
- $X_RESULT_ERROR_UNSUPPORTED_FEATURE:
183+
- "Device `$X_DEVICE_INFO_IMAGE_SUPPORT` is false"
176184
--- #--------------------------------------------------------------------------
177185
type: function
178186
desc: "Return sampler native sampler handle."

0 commit comments

Comments
 (0)