Skip to content

Commit df2f889

Browse files
committed
Merge branch 'sycl' into oneapins
2 parents 3231a75 + 852d05a commit df2f889

File tree

6 files changed

+66
-9
lines changed

6 files changed

+66
-9
lines changed

buildbot/dependency.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ ocl_cpu_rt_ver=2020.10.7.0.15
44
# https://github.com/intel/llvm/releases/download/2020-WW31/win-oclcpuexp-2020.10.7.0.15_rel.zip
55
ocl_cpu_rt_ver_win=2020.10.7.0.15
66
# Same GPU driver supports Level Zero and OpenCL:
7-
# https://github.com/intel/compute-runtime/releases/tag/20.25.17111
7+
# https://github.com/intel/compute-runtime/releases/tag/20.29.17408
88
ocl_gpu_rt_ver=20.29.17408
99
# Same GPU driver supports Level Zero and OpenCL:
1010
# https://downloadmirror.intel.com/29674/a08/igfx_win10_100.8336.zip
1111
ocl_gpu_rt_ver_win=27.20.100.8336
1212
intel_sycl_ver=build
13-
# https://github.com/oneapi-src/oneTBB/releases/download/v2020.2/tbb-2020.2-lin.tgz
13+
# TODO provide URL for Linux TBB driver
1414
tbb_ver=2021.1.8.515
15-
# https://github.com/oneapi-src/oneTBB/releases/download/v2020.2/tbb-2020.2-win.zip
15+
# TODO provide URL for Windows TBB driver
1616
tbb_ver_win=2021.1.8.514
1717
# https://github.com/intel/llvm/releases/download/2020-WW31/fpgaemu-2020.10.7.0.15_rel.tar.gz
1818
ocl_fpga_emu_ver=2020.10.7.0.15

llvm-spirv/lib/SPIRV/SPIRVWriter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,10 +563,11 @@ SPIRVFunction *LLVMToSPIRV::transFunctionDecl(Function *F) {
563563
// Order of integer numbers in MD node follows the order of function
564564
// parameters on which we shall attach the appropriate decoration. Add
565565
// decoration only if MD value is not negative.
566-
BM->addCapability(CapabilityFPGABufferLocationINTEL);
567566
int LocID = getMDOperandAsInt(BufferLocation, ArgNo);
568-
if (LocID >= 0)
567+
if (LocID >= 0) {
568+
BM->addCapability(CapabilityFPGABufferLocationINTEL);
569569
BA->addDecorate(DecorationBufferLocationINTEL, LocID);
570+
}
570571
}
571572
}
572573
if (Attrs.hasAttribute(AttributeList::ReturnIndex, Attribute::ZExt))

sycl/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ if( NOT OpenCL_INCLUDE_DIRS )
107107
INSTALL_COMMAND ""
108108
STEP_TARGETS build
109109
COMMENT "Downloading OpenCL headers."
110+
LOG_DOWNLOAD 1
111+
LOG_UPDATE 1
112+
LOG_BUILD 1
110113
)
111114
add_definitions(-DCL_TARGET_OPENCL_VERSION=220)
112115
else()
@@ -154,6 +157,11 @@ if( NOT OpenCL_LIBRARIES )
154157
STEP_TARGETS configure,build,install
155158
DEPENDS ocl-headers
156159
BUILD_BYPRODUCTS ${OpenCL_LIBRARIES}
160+
LOG_DOWNLOAD 1
161+
LOG_UPDATE 1
162+
LOG_CONFIGURE 1
163+
LOG_BUILD 1
164+
LOG_INSTALL 1
157165
)
158166
ExternalProject_Add_Step(ocl-icd llvminstall
159167
COMMAND ${CMAKE_COMMAND} -E copy_directory <INSTALL_DIR>/ ${LLVM_BINARY_DIR}

sycl/plugins/level_zero/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ if (NOT DEFINED LEVEL_ZERO_LIBRARY OR NOT DEFINED LEVEL_ZERO_INCLUDE_DIR)
3333
-DOpenCL_INCLUDE_DIR=${OpenCL_INCLUDE_DIRS}
3434
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
3535
-DCMAKE_INSTALL_LIBDIR:PATH=lib${LLVM_LIBDIR_SUFFIX}
36+
LOG_DOWNLOAD 1
37+
LOG_UPDATE 1
38+
LOG_CONFIGURE 1
39+
LOG_BUILD 1
40+
LOG_INSTALL 1
3641
${AUX_CMAKE_FLAGS}
3742
STEP_TARGETS configure,build,install
3843
DEPENDS ocl-headers

sycl/plugins/level_zero/pi_level_zero.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,20 @@ pi_result getInfoArray(size_t array_length, size_t param_value_size,
114114
array_length * sizeof(T), memcpy);
115115
}
116116

117+
template <typename T, typename RetType>
118+
pi_result getInfoArray(size_t array_length, size_t param_value_size,
119+
void *param_value, size_t *param_value_size_ret,
120+
T *value) {
121+
if (param_value) {
122+
memset(param_value, 0, param_value_size);
123+
for (uint32_t I = 0; I < array_length; I++)
124+
((RetType *)param_value)[I] = (RetType)value[I];
125+
}
126+
if (param_value_size_ret)
127+
*param_value_size_ret = array_length * sizeof(RetType);
128+
return PI_SUCCESS;
129+
}
130+
117131
template <>
118132
pi_result getInfo<const char *>(size_t param_value_size, void *param_value,
119133
size_t *param_value_size_ret,
@@ -1061,9 +1075,10 @@ pi_result piDeviceGetInfo(pi_device Device, pi_device_info ParamName,
10611075
case PI_DEVICE_INFO_SUB_GROUP_SIZES_INTEL: {
10621076
// ze_device_compute_properties.subGroupSizes is in uint32_t whereas the
10631077
// expected return is size_t datatype. size_t can be 8 bytes of data.
1064-
return getInfoArray(Device->ZeDeviceComputeProperties.numSubGroupSizes,
1065-
ParamValueSize, ParamValue, ParamValueSizeRet,
1066-
Device->ZeDeviceComputeProperties.subGroupSizes);
1078+
return getInfoArray<uint32_t, size_t>(
1079+
Device->ZeDeviceComputeProperties.numSubGroupSizes, ParamValueSize,
1080+
ParamValue, ParamValueSizeRet,
1081+
Device->ZeDeviceComputeProperties.subGroupSizes);
10671082
}
10681083
case PI_DEVICE_INFO_IL_VERSION: {
10691084
// Set to a space separated list of IL version strings of the form
@@ -3108,7 +3123,8 @@ pi_result piEnqueueMemUnmap(pi_queue Queue, pi_mem MemObj, void *MappedPtr,
31083123
// piEnqueueMemBufferMap, but can only do so after the above copy
31093124
// is completed. Instead of waiting for It here (blocking), we shall
31103125
// do so in piEventRelease called for the pi_event tracking the unmap.
3111-
(*Event)->CommandData = MemObj->MapHostPtr ? nullptr : MappedPtr;
3126+
if (Event)
3127+
(*Event)->CommandData = MemObj->MapHostPtr ? nullptr : MappedPtr;
31123128

31133129
// Execute command list asynchronously, as the event will be used
31143130
// to track down its completion.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
2+
// RUN: %GPU_RUN_PLACEHOLDER %t.out
3+
4+
//==-- get_subgroup_sizes.cpp - Test for bug fix in subgroup sizes query --==//
5+
//
6+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
7+
// See https://llvm.org/LICENSE.txt for license information.
8+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9+
//
10+
//===----------------------------------------------------------------------===//
11+
12+
#include <CL/sycl.hpp>
13+
14+
using namespace cl::sycl;
15+
16+
int main() {
17+
queue Q;
18+
auto Dev = Q.get_device();
19+
if (Dev.has_extension("cl_intel_required_subgroup_size")) {
20+
cl::sycl::vector_class<size_t> SubGroupSizes =
21+
Dev.get_info<cl::sycl::info::device::sub_group_sizes>();
22+
cl::sycl::vector_class<size_t>::const_iterator MaxIter =
23+
std::max_element(SubGroupSizes.begin(), SubGroupSizes.end());
24+
int MaxSubGroup_size = *MaxIter;
25+
}
26+
return 0;
27+
}

0 commit comments

Comments
 (0)