Skip to content

Commit 5685396

Browse files
committed
Merge from 'sycl' to 'sycl-web' (12 commits)
CONFLICT (content): Merge conflict in sycl/CMakeLists.txt
2 parents 9fe070a + 5c9450b commit 5685396

File tree

53 files changed

+911
-378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+911
-378
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4209,6 +4209,10 @@ def fsycl_remove_unused_external_funcs : Flag<["-"], "fsycl-remove-unused-extern
42094209
Group<sycl_Group>, HelpText<"Allow removal of unused `SYCL_EXTERNAL` functions (default)">;
42104210
def fno_sycl_remove_unused_external_funcs : Flag<["-"], "fno-sycl-remove-unused-external-funcs">,
42114211
Group<sycl_Group>, HelpText<"Prevent removal of unused `SYCL_EXTERNAL` functions">;
4212+
def fsycl_allow_device_dependencies : Flag<["-"], "fsycl-allow-device-dependencies">,
4213+
Group<sycl_Group>, HelpText<"Allow dependencies between device code images">;
4214+
def fno_sycl_allow_device_dependencies : Flag<["-"], "fno-sycl-allow-device-dependencies">,
4215+
Group<sycl_Group>, HelpText<"Do not allow dependencies between device code images (default)">;
42124216

42134217
def fsave_optimization_record : Flag<["-"], "fsave-optimization-record">,
42144218
Visibility<[ClangOption, FlangOption]>,

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10762,6 +10762,14 @@ static void addArgs(ArgStringList &DstArgs, const llvm::opt::ArgList &Alloc,
1076210762
}
1076310763
}
1076410764

10765+
static bool supportDynamicLinking(const llvm::opt::ArgList &TCArgs) {
10766+
if (TCArgs.hasFlag(options::OPT_fsycl_allow_device_dependencies,
10767+
options::OPT_fno_sycl_allow_device_dependencies,
10768+
false))
10769+
return true;
10770+
return false;
10771+
}
10772+
1076510773
static void getNonTripleBasedSYCLPostLinkOpts(const ToolChain &TC,
1076610774
const JobAction &JA,
1076710775
const llvm::opt::ArgList &TCArgs,
@@ -10788,6 +10796,9 @@ static void getNonTripleBasedSYCLPostLinkOpts(const ToolChain &TC,
1078810796
if (TCArgs.hasFlag(options::OPT_fno_sycl_esimd_force_stateless_mem,
1078910797
options::OPT_fsycl_esimd_force_stateless_mem, false))
1079010798
addArgs(PostLinkArgs, TCArgs, {"-lower-esimd-force-stateless-mem=false"});
10799+
10800+
if (supportDynamicLinking(TCArgs))
10801+
addArgs(PostLinkArgs, TCArgs, {"-support-dynamic-linking"});
1079110802
}
1079210803

1079310804
// Add any sycl-post-link options that rely on a specific Triple in addition
@@ -10835,6 +10846,8 @@ static void getTripleBasedSYCLPostLinkOpts(const ToolChain &TC,
1083510846
options::OPT_fsycl_remove_unused_external_funcs,
1083610847
false) &&
1083710848
!isSYCLNativeCPU(TC)) &&
10849+
// When supporting dynamic linking, non-kernels in a device image can be called
10850+
!supportDynamicLinking(TCArgs) &&
1083810851
!Triple.isNVPTX() && !Triple.isAMDGPU())
1083910852
addArgs(PostLinkArgs, TCArgs, {"-emit-only-kernels-as-entry-points"});
1084010853

clang/test/Driver/sycl-offload-old-model.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,12 @@
174174
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-targets=spir64_gen %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_OPT_PASS %s
175175
// CHECK_SYCL_POST_LINK_OPT_PASS: sycl-post-link{{.*}}emit-only-kernels-as-entry-points
176176
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-targets=spir64_gen -fno-sycl-remove-unused-external-funcs %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_OPT_NO_PASS %s
177+
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-targets=spir64_gen -fsycl-allow-device-dependencies %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_OPT_NO_PASS %s
177178
// CHECK_SYCL_POST_LINK_OPT_NO_PASS-NOT: sycl-post-link{{.*}}emit-only-kernels-as-entry-points
178179

179180
/// Check selective passing of -support-dynamic-linking to sycl-post-link tool
181+
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-targets=spir64_fpga -fsycl-allow-device-dependencies %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_SHARED_PASS %s
182+
// RUN: %clang -### -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-targets=spir64_gen -fsycl-allow-device-dependencies %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_SHARED_PASS %s
180183
// TODO: Enable when SYCL RT supports dynamic linking
181184
// RUNx: %clang -### -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-targets=spir64_fpga -shared %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_SHARED_PASS %s
182185
// RUNx: %clang -### -target x86_64-unknown-linux-gnu -fsycl --no-offload-new-driver -fsycl-targets=spir64_gen -shared %s 2>&1 | FileCheck -check-prefix=CHECK_SYCL_POST_LINK_SHARED_PASS %s

llvm/lib/SYCLLowerIR/ModuleSplitter.cpp

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,8 @@ class DependencyGraph {
182182
FuncTypeToFuncsMap[F.getFunctionType()].insert(&F);
183183
}
184184

185-
// We add every function into the graph except if
186-
// SupportDynamicLinking is true
187185
for (const auto &F : M.functions()) {
188-
189-
if (SupportDynamicLinking && canBeImportedFunction(F))
186+
if (canBeImportedFunction(F))
190187
continue;
191188

192189
// case (1), see comment above the class definition
@@ -1312,8 +1309,26 @@ splitSYCLModule(std::unique_ptr<Module> M, ModuleSplitterSettings Settings) {
13121309
}
13131310

13141311
bool canBeImportedFunction(const Function &F) {
1312+
// It may be theoretically possible to determine what is importable
1313+
// based solely on function F, but the "SYCL/imported symbols"
1314+
// property list MUST NOT have any imported symbols that are not supplied
1315+
// the exported symbols from another device image. This will lead to a
1316+
// runtime crash "No device image found for external symbol". Generating
1317+
// precise "SYCL/imported symbols" can be difficult because there exist
1318+
// functions that may look like they can be imported, but are supplied outside
1319+
// of user device code (e.g. _Z38__spirv_JointMatrixWorkItemLength...) In
1320+
// order to be safe and not require perfect name analysis just start with this
1321+
// simple check.
1322+
if (!SupportDynamicLinking)
1323+
return false;
1324+
1325+
// SYCL_EXTERNAL property is not recorded for a declaration
1326+
// in a header file. Thus SYCL IR that is a declaration
1327+
// will be considered as SYCL_EXTERNAL for the purposes of
1328+
// this function.
13151329
if (F.isIntrinsic() || F.getName().starts_with("__") ||
1316-
!llvm::sycl::utils::isSYCLExternalFunction(&F))
1330+
isSpirvSyclBuiltin(F.getName()) || isESIMDBuiltin(F.getName()) ||
1331+
(!F.isDeclaration() && !llvm::sycl::utils::isSYCLExternalFunction(&F)))
13171332
return false;
13181333

13191334
bool ReturnValue = true;

llvm/test/tools/sycl-post-link/emit_imported_symbols.ll

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
; This test checks that the -emit-imported-symbols option generates a list of imported symbols
22
; Function names were chosen so that no function with a 'inside' in their function name is imported
3-
;
3+
; Note that -emit-imported-symbols will not emit any imported symbols without -support-dynamic-linking.
44

55
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
66
; Test with -split=kernel
77
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
88

9-
; RUN: sycl-post-link -properties -symbols -emit-imported-symbols -split=kernel -S < %s -o %t_kernel.table
9+
; RUN: sycl-post-link -properties -symbols -support-dynamic-linking -emit-imported-symbols -split=kernel -S < %s -o %t_kernel.table
1010

1111
; RUN: FileCheck %s -input-file=%t_kernel_0.sym --check-prefixes CHECK-KERNEL-SYM-0
1212
; RUN: FileCheck %s -input-file=%t_kernel_1.sym --check-prefixes CHECK-KERNEL-SYM-1
@@ -23,29 +23,29 @@
2323

2424
; CHECK-KERNEL-SYM-1: foo
2525
; CHECK-KERNEL-IMPORTED-SYM-1: [SYCL/imported symbols]
26+
; CHECK-KERNEL-IMPORTED-SYM-1-NEXT: middle
2627
; CHECK-KERNEL-IMPORTED-SYM-1-NEXT: childA
2728
; CHECK-KERNEL-IMPORTED-SYM-1-NEXT: childC
28-
; CHECK-KERNEL-IMPORTED-SYM-1-NEXT: childD
2929
; CHECK-KERNEL-IMPORTED-SYM-1-EMPTY:
3030

3131

3232
; CHECK-KERNEL-SYM-2: bar
3333
; CHECK-KERNEL-IMPORTED-SYM-2: [SYCL/imported symbols]
34+
; CHECK-KERNEL-IMPORTED-SYM-2-NEXT: middle
3435
; CHECK-KERNEL-IMPORTED-SYM-2-NEXT: childB
3536
; CHECK-KERNEL-IMPORTED-SYM-2-NEXT: childC
36-
; CHECK-KERNEL-IMPORTED-SYM-2-NEXT: childD
3737
; CHECK-KERNEL-IMPORTED-SYM-2-NEXT: _Z7outsidev
3838
; CHECK-KERNEL-IMPORTED-SYM-2-EMPTY:
3939

4040
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4141
; Test with -split=source
4242
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4343

44-
; RUN: sycl-post-link -properties -symbols -emit-imported-symbols -split=source -S < %s -o %t_source.table
44+
; RUN: sycl-post-link -properties -symbols -support-dynamic-linking -emit-imported-symbols -split=source -S < %s -o %t_source.table
4545
; RUN: FileCheck %s -input-file=%t_source_0.sym --check-prefixes CHECK-SOURCE-SYM-0
4646
; RUN: FileCheck %s -input-file=%t_source_0.prop --check-prefixes CHECK-SOURCE-IMPORTED-SYM-0
4747

48-
; RUN: sycl-post-link -properties -symbols -emit-imported-symbols -split=source -S < %s -o %t_source.table -O0
48+
; RUN: sycl-post-link -properties -symbols -support-dynamic-linking -emit-imported-symbols -split=source -S < %s -o %t_source.table -O0
4949
; RUN: FileCheck %s -input-file=%t_source_0.sym --check-prefixes CHECK-SOURCE-SYM-0
5050
; RUN: FileCheck %s -input-file=%t_source_0.prop --check-prefixes CHECK-SOURCE-IMPORTED-SYM-0
5151

@@ -73,7 +73,7 @@ define weak_odr spir_kernel void @foo() #0 {
7373
}
7474

7575
define weak_odr spir_kernel void @bar() #0 {
76-
;; Functions that are not SYCL External (i.e. they have no sycl-module-id) cannot be imported
76+
;; Functions whose name start with '__' cannot be imported
7777
call spir_func void @__itt_offload_wi_start_wrapper()
7878

7979
call void @childB()

llvm/test/tools/sycl-post-link/internalize_functions.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; Test that when -support-dynamic-linking is used
2-
; non SYCL-EXTERNAL functions are internalized.
2+
; non SYCL_EXTERNAL functions are internalized.
33
; Variables must not be internalized.
44

55
; RUN: sycl-post-link -symbols -support-dynamic-linking -split=kernel -S < %s -o %t.table
@@ -8,8 +8,8 @@
88

99
; CHECK-SYM-0: foo0
1010

11-
; Non SYCL-EXTERNAL Functions are internalized
12-
; foo0 is a SYCL-EXTERNAL function
11+
; Non SYCL_EXTERNAL Functions are internalized
12+
; foo0 is a SYCL_EXTERNAL function
1313
; CHECK-LL-0-DAG: define weak_odr spir_kernel void @foo0() #0 {
1414
; Internalize does not change available_externally
1515
; CHECK-LL-0-DAG: define available_externally spir_func void @internalA() {

sycl/CMakeLists.txt

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,45 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
4242
include(AddSYCLExecutable)
4343
include(AddSYCL)
4444
include(SYCLUtils)
45+
46+
if(MSVC)
47+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
48+
# Skip asynchronous C++ exceptions catching and assume "extern C" functions
49+
# never throw C++ exceptions.
50+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
51+
52+
# Add PDB debug information
53+
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
54+
include(CheckLinkerFlag)
55+
check_linker_flag(CXX "/DEBUG" LINKER_SUPPORTS_DEBUG)
56+
if(LINKER_SUPPORTS_DEBUG)
57+
# sccache is not compatible with /Zi flag
58+
if (CMAKE_CXX_COMPILER_LAUNCHER STREQUAL "sccache")
59+
# CMake may put /Zi by default
60+
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
61+
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
62+
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
63+
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
64+
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
65+
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
66+
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
67+
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
68+
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
69+
endif()
70+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Z7")
71+
else()
72+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
73+
endif()
74+
add_link_options("/DEBUG")
75+
76+
# Enable unreferenced removal and ICF in Release mode.
77+
check_linker_flag(CXX "/OPT:REF /OPT:ICF" LINKER_SUPPORTS_OPTS)
78+
if (LINKER_SUPPORTS_OPTS AND uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
79+
add_link_options("/OPT:REF" "/OPT:ICF")
80+
endif()
81+
endif()
82+
endif()
83+
4584
include(FetchUnifiedRuntime)
4685

4786
# The change in SYCL_MAJOR_VERSION must be accompanied with the same update in
@@ -86,44 +125,6 @@ endif()
86125
# of the SYCL runtime and expect enabling
87126
option(SYCL_ENABLE_XPTI_TRACING "Enable tracing of SYCL constructs" OFF)
88127

89-
if(MSVC)
90-
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
91-
# Skip asynchronous C++ exceptions catching and assume "extern C" functions
92-
# never throw C++ exceptions.
93-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
94-
95-
# Add PDB debug information
96-
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
97-
include(CheckLinkerFlag)
98-
check_linker_flag(CXX "/DEBUG" LINKER_SUPPORTS_DEBUG)
99-
if(LINKER_SUPPORTS_DEBUG)
100-
# sccache is not compatible with /Zi flag
101-
if (CMAKE_CXX_COMPILER_LAUNCHER STREQUAL "sccache")
102-
# CMake may put /Zi by default
103-
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
104-
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
105-
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
106-
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
107-
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
108-
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
109-
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
110-
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
111-
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
112-
endif()
113-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Z7")
114-
else()
115-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
116-
endif()
117-
add_link_options("/DEBUG")
118-
119-
# Enable unreferenced removal and ICF in Release mode.
120-
check_linker_flag(CXX "/OPT:REF /OPT:ICF" LINKER_SUPPORTS_OPTS)
121-
if (LINKER_SUPPORTS_OPTS AND uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
122-
add_link_options("/OPT:REF" "/OPT:ICF")
123-
endif()
124-
endif()
125-
endif()
126-
127128
# Get clang's version
128129
include(VersionFromVCS)
129130
set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")

sycl/cmake/modules/FetchUnifiedRuntime.cmake

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ if(SYCL_PI_UR_USE_FETCH_CONTENT)
115115
CACHE PATH "Path to external '${name}' adapter source dir" FORCE)
116116
endfunction()
117117

118-
set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
119-
# commit 3e762e00bcf13d158fb58e8e8c2eabcfc8934b4e
120-
# Merge: c805a71a a2a053de
118+
set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
119+
# commit c5d2175b5823d5b74de1e7e0d6081ab6d885bc34
120+
# Merge: 99489ad4 c86beb60
121121
# Author: Omar Ahmed <[email protected]>
122-
# Date: Wed Jul 31 12:26:34 2024 +0100
123-
# Merge pull request #1884 from callumfare/callum/fix_printtrace
124-
# Enable PrintTrace when SYCL UR tracing is enabled
125-
set(UNIFIED_RUNTIME_TAG 3e762e00bcf13d158fb58e8e8c2eabcfc8934b4e)
122+
# Date: Wed Jul 31 14:52:26 2024 +0100
123+
# Merge pull request #1882 from przemektmalon/przemek/interop-map-memory
124+
# [Bindless][Exp] Add interop memory mapping to USM.
125+
set(UNIFIED_RUNTIME_TAG c5d2175b5823d5b74de1e7e0d6081ab6d885bc34)
126126

127127
set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES")
128128
# Due to the use of dependentloadflag and no installer for UMF and hwloc we need

sycl/doc/extensions/experimental/sycl_ext_oneapi_bindless_images.asciidoc

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,19 +1712,35 @@ image_mem_handle map_external_image_memory(
17121712
external_mem externalMemHandle,
17131713
const image_descriptor &imageDescriptor,
17141714
const sycl::queue &syclQueue);
1715+
1716+
void *map_external_linear_memory(
1717+
external_mem externalMemHandle,
1718+
uint64_t size, uint64_t offset,
1719+
const sycl::device &syclDevice,
1720+
const sycl::context &syclContext);
1721+
void *map_external_linear_memory(
1722+
external_mem externalMemHandle,
1723+
uint64_t size, uint64_t offset,
1724+
const sycl::queue &syclQueue);
17151725
}
17161726
```
17171727

17181728
The resulting `external_mem` can then be mapped, where the resulting type
1719-
is an `image_mem_handle`. This can be used to construct images in the same way
1720-
as memory allocated through `alloc_image_mem`. The `ext_oneapi_copy` operations
1721-
also work with imported memory mapped to `image_mem_handle` types.
1722-
1723-
When calling `create_image` with an `image_mem_handle` mapped from an external
1724-
memory object, the user must ensure that the image descriptor they pass to
1725-
`create_image` has members that match or map to those of the external API.
1726-
A mismatch between any of the `width`, `height`, `depth`, `image_channel_type`,
1727-
or `num_channels` members will result in undefined behavior.
1729+
is an `image_mem_handle` or a `void *`. This can be used to construct images in
1730+
the same way as memory allocated through `alloc_image_mem`,
1731+
`pitched_alloc_device`, or another USM allocation method. The `ext_oneapi_copy`
1732+
operations also work with imported memory mapped to `image_mem_handle` and
1733+
`void *` types.
1734+
1735+
When calling `create_image` with an `image_mem_handle` or `void *` mapped from
1736+
an external memory object, the user must ensure that the image descriptor they
1737+
pass to `create_image` has members that match or map to those of the external
1738+
API. A mismatch between any of the `width`, `height`, `depth`,
1739+
`image_channel_type`, or `num_channels` members will result in undefined
1740+
behavior. Likewise, if the image is mapped to a linear USM (`void *`) region,
1741+
the pitch value passed to `create_image` needs to match the pitch of the image
1742+
as defined by the external API. Note that when external memory is mapped to a
1743+
linear USM region, this is device-side USM, and not accessible on the host.
17281744

17291745
Additionally, the `image_type` describing the image must match to the image of
17301746
the external API. The current supported importable image types are `standard`
@@ -2866,4 +2882,6 @@ These features still need to be handled:
28662882
- Removed `handle` keyword from `interop_xxx_handle` to
28672883
clear up possible confusion between 3rd party interop
28682884
handles and the imported `interop_xxx_handle`.
2885+
|5.17|2024-07-30| - Add support for mapping external memory to linear USM using
2886+
`map_external_linear_memory`.
28692887
|======================

sycl/doc/extensions/proposed/sycl_ext_intel_cache_controls.asciidoc

100755100644
File mode changed.

sycl/include/sycl/builtins_esimd.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#pragma once
1010

11-
#include <sycl/detail/boolean.hpp>
1211
#include <sycl/detail/common.hpp>
1312
#include <sycl/detail/generic_type_traits.hpp>
1413
#include <sycl/ext/intel/esimd/detail/math_intrin.hpp>

sycl/include/sycl/builtins_utils_scalar.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#include <sycl/access/access.hpp> // for address_space, decorated
1212
#include <sycl/aliases.hpp> // for half
13-
#include <sycl/detail/boolean.hpp> // for Boolean
1413
#include <sycl/detail/defines_elementary.hpp> // for __SYCL_ALWAYS_INLINE
1514
#include <sycl/detail/generic_type_traits.hpp> // for is_svgenfloat, is_sge...
1615
#include <sycl/detail/type_list.hpp> // for is_contained, type_list

0 commit comments

Comments
 (0)