Skip to content

Commit 58f6851

Browse files
Merge branch 'main' into steffen/composite_devices_not_supported_and_empty
2 parents e5baa6f + 3077fd4 commit 58f6851

Some content is hidden

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

60 files changed

+1699
-757
lines changed

.github/workflows/e2e_core.yml

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -178,20 +178,23 @@ jobs:
178178
id: tests
179179
run: ninja -C build-e2e check-sycl-e2e
180180

181-
- name: Add comment to PR
182-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
183-
if: ${{ always() }}
184-
with:
185-
script: |
186-
const adapter = '${{ matrix.adapter.name }}';
187-
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
188-
const test_status = '${{ steps.tests.outcome }}';
189-
const job_status = '${{ job.status }}';
190-
const body = `E2E ${adapter} build:\n${url}\nJob status: ${job_status}. Test status: ${test_status}`;
191-
192-
github.rest.issues.createComment({
193-
issue_number: context.issue.number,
194-
owner: context.repo.owner,
195-
repo: context.repo.repo,
196-
body: body
197-
})
181+
# FIXME: Requires pull-request: write permissions but this is only granted
182+
# on pull requests from forks if using pull_request_target workflow
183+
# trigger but not the pull_request trigger..
184+
# - name: Add comment to PR
185+
# uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
186+
# if: ${{ always() }}
187+
# with:
188+
# script: |
189+
# const adapter = '${{ matrix.adapter.name }}';
190+
# const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
191+
# const test_status = '${{ steps.tests.outcome }}';
192+
# const job_status = '${{ job.status }}';
193+
# const body = `E2E ${adapter} build:\n${url}\nJob status: ${job_status}. Test status: ${test_status}`;
194+
195+
# github.rest.issues.createComment({
196+
# issue_number: context.issue.number,
197+
# owner: context.repo.owner,
198+
# repo: context.repo.repo,
199+
# body: body
200+
# })

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ set(CMAKE_CXX_STANDARD 17)
2525
set(CMAKE_CXX_STANDARD_REQUIRED YES)
2626

2727
# Build Options
28+
option(UR_BUILD_EXAMPLES "Build example applications." ON)
2829
option(UR_BUILD_TESTS "Build unit tests." ON)
2930
option(UR_BUILD_TOOLS "build ur tools" ON)
3031
option(UR_FORMAT_CPP_STYLE "format code style of C++ sources" OFF)
@@ -258,7 +259,9 @@ install(
258259
EXPORT ${PROJECT_NAME}-targets)
259260

260261
add_subdirectory(source)
261-
add_subdirectory(examples)
262+
if(UR_BUILD_EXAMPLES)
263+
add_subdirectory(examples)
264+
endif()
262265
if(UR_BUILD_TESTS)
263266
add_subdirectory(test)
264267
endif()

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ List of options provided by CMake:
118118

119119
| Name | Description | Values | Default |
120120
| - | - | - | - |
121+
| UR_BUILD_EXAMPLES | Build example applications | ON/OFF | ON |
121122
| UR_BUILD_TESTS | Build the tests | ON/OFF | ON |
122123
| UR_BUILD_TOOLS | Build tools | ON/OFF | ON |
123124
| UR_FORMAT_CPP_STYLE | Format code style | ON/OFF | OFF |

include/ur_api.h

Lines changed: 72 additions & 53 deletions
Large diffs are not rendered by default.

include/ur_print.hpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,9 +1454,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_result_t value) {
14541454
case UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR:
14551455
os << "UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR";
14561456
break;
1457-
case UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED:
1458-
os << "UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED";
1459-
break;
14601457
case UR_RESULT_ERROR_MEM_OBJECT_ALLOCATION_FAILURE:
14611458
os << "UR_RESULT_ERROR_MEM_OBJECT_ALLOCATION_FAILURE";
14621459
break;
@@ -5466,9 +5463,6 @@ inline ur_result_t printFlag<ur_mem_flag_t>(std::ostream &os, uint32_t flag) {
54665463
/// std::ostream &
54675464
inline std::ostream &operator<<(std::ostream &os, enum ur_mem_type_t value) {
54685465
switch (value) {
5469-
case UR_MEM_TYPE_BUFFER:
5470-
os << "UR_MEM_TYPE_BUFFER";
5471-
break;
54725466
case UR_MEM_TYPE_IMAGE2D:
54735467
os << "UR_MEM_TYPE_IMAGE2D";
54745468
break;
@@ -5484,9 +5478,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_mem_type_t value) {
54845478
case UR_MEM_TYPE_IMAGE1D_ARRAY:
54855479
os << "UR_MEM_TYPE_IMAGE1D_ARRAY";
54865480
break;
5487-
case UR_MEM_TYPE_IMAGE1D_BUFFER:
5488-
os << "UR_MEM_TYPE_IMAGE1D_BUFFER";
5489-
break;
54905481
case UR_MEM_TYPE_IMAGE_CUBEMAP_EXP:
54915482
os << "UR_MEM_TYPE_IMAGE_CUBEMAP_EXP";
54925483
break;

scripts/core/EXP-BINDLESS-IMAGES.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Runtime:
5050
* Sampled images
5151
* Unsampled images
5252
* Mipmaps
53+
* Image arrays
5354
* Cubemaps
5455
* USM backed images
5556

@@ -207,6 +208,8 @@ Changelog
207208
+------------------------------------------------------------------------+
208209
| 11.0 | Added device queries for sampled image fetch capabilities. |
209210
+----------+-------------------------------------------------------------+
211+
| 12.0 | Added image arrays to list of supported bindless images |
212+
+----------+-------------------------------------------------------------+
210213

211214
Contributors
212215
--------------------------------------------------------------------------------

scripts/core/PROG.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,39 @@ native handle to a driver handle. For example, OpenCL platform
277277
may expose an extension ${x}ProgramCreateWithNativeHandle to retrieve
278278
a cl_program.
279279

280+
Memory
281+
======
282+
283+
UR Mem Handles
284+
--------------
285+
286+
A ${x}_mem_handle_t can represent an untyped memory buffer object, created by
287+
${x}MemBufferCreate, or a memory image object, created by ${x}MemImageCreate.
288+
A ${x}_mem_handle_t manages the internal allocation and deallocation of native
289+
memory objects across all devices in a ${x}_context_handle_t. A
290+
${x}_mem_handle_t may only be used by queues that share the same
291+
${x}_context_handle_t.
292+
293+
If multiple queues in the same ${x}_context_handle_t use the same
294+
${x}_mem_handle_t across dependent commands, a dependency must be defined by the
295+
user using the enqueue entry point's phEventWaitList parameter. Provided that
296+
dependencies are explicitly passed to UR entry points, a UR adapter will manage
297+
memory migration of native memory objects across all devices in a context, if
298+
memory migration is indeed necessary in the backend API.
299+
300+
.. parsed-literal::
301+
302+
// Q1 and Q2 are both in hContext
303+
${x}_mem_handle_t hBuffer;
304+
${x}MemBufferCreate(hContext,,,,&hBuffer);
305+
${x}EnqueueMemBufferWrite(Q1, hBuffer,,,,,,, &outEv);
306+
${x}EnqueueMemBufferRead(Q2, hBuffer,,,,, 1, &outEv /*phEventWaitList*/, );
307+
308+
As such, the buffer written to in ${x}EnqueueMemBufferWrite can be
309+
successfully read using ${x}EnqueueMemBufferRead from another queue in the same
310+
context, since the event associated with the write operation has been passed as
311+
a dependency to the read operation.
312+
280313
Memory Pooling
281314
----------------------------------
282315

scripts/core/common.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,6 @@ etors:
205205
desc: "Invalid image size"
206206
- name: ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR
207207
desc: "Invalid image format descriptor"
208-
- name: ERROR_IMAGE_FORMAT_NOT_SUPPORTED
209-
desc: "Image format not supported"
210208
- name: ERROR_MEM_OBJECT_ALLOCATION_FAILURE
211209
desc: "Memory object allocation failure"
212210
- name: ERROR_INVALID_PROGRAM_EXECUTABLE

scripts/core/exp-bindless-images.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ returns:
387387
- $X_RESULT_ERROR_INVALID_CONTEXT
388388
- $X_RESULT_ERROR_INVALID_VALUE
389389
- $X_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR:
390-
- "`pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type`"
390+
- "`pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type`"
391391
- $X_RESULT_ERROR_INVALID_IMAGE_SIZE
392392
- $X_RESULT_ERROR_INVALID_OPERATION
393393
--- #--------------------------------------------------------------------------
@@ -442,7 +442,7 @@ returns:
442442
- $X_RESULT_ERROR_INVALID_CONTEXT
443443
- $X_RESULT_ERROR_INVALID_VALUE
444444
- $X_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR:
445-
- "`pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type`"
445+
- "`pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type`"
446446
- $X_RESULT_ERROR_INVALID_IMAGE_SIZE
447447
- $X_RESULT_ERROR_INVALID_OPERATION
448448
--- #--------------------------------------------------------------------------
@@ -479,7 +479,7 @@ returns:
479479
- $X_RESULT_ERROR_INVALID_CONTEXT
480480
- $X_RESULT_ERROR_INVALID_VALUE
481481
- $X_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR:
482-
- "`pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type`"
482+
- "`pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type`"
483483
- $X_RESULT_ERROR_INVALID_IMAGE_SIZE
484484
- $X_RESULT_ERROR_INVALID_SAMPLER
485485
- $X_RESULT_ERROR_INVALID_OPERATION
@@ -542,7 +542,7 @@ returns:
542542
- $X_RESULT_ERROR_INVALID_QUEUE
543543
- $X_RESULT_ERROR_INVALID_VALUE
544544
- $X_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR:
545-
- "`pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type`"
545+
- "`pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type`"
546546
- $X_RESULT_ERROR_INVALID_IMAGE_SIZE
547547
- $X_RESULT_ERROR_INVALID_OPERATION
548548
--- #--------------------------------------------------------------------------
@@ -679,7 +679,7 @@ returns:
679679
- $X_RESULT_ERROR_INVALID_CONTEXT
680680
- $X_RESULT_ERROR_INVALID_VALUE
681681
- $X_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR:
682-
- "`pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type`"
682+
- "`pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type`"
683683
- $X_RESULT_ERROR_INVALID_IMAGE_SIZE
684684
- $X_RESULT_ERROR_INVALID_OPERATION
685685
- $X_RESULT_ERROR_OUT_OF_RESOURCES

scripts/core/exp-command-buffer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ returns:
900900
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
901901
--- #--------------------------------------------------------------------------
902902
type: function
903-
desc: "Update a kernel launch command in a finalized command-buffer."
903+
desc: "Update a kernel launch command in a finalized command-buffer. This entry-point is synchronous and may block if the command-buffer is executing when the entry-point is called."
904904
class: $xCommandBuffer
905905
name: UpdateKernelLaunchExp
906906
params:

scripts/core/memory.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ desc: "Memory types"
4141
class: $xMem
4242
name: $x_mem_type_t
4343
etors:
44-
- name: BUFFER
45-
desc: "Buffer object"
4644
- name: IMAGE2D
4745
desc: "2D image object"
4846
- name: IMAGE3D
@@ -53,8 +51,6 @@ etors:
5351
desc: "1D image object"
5452
- name: IMAGE1D_ARRAY
5553
desc: "1D image array object"
56-
- name: IMAGE1D_BUFFER
57-
desc: "1D image buffer object"
5854
--- #--------------------------------------------------------------------------
5955
type: enum
6056
desc: "Memory Information type"
@@ -213,6 +209,15 @@ name: ImageCreate
213209
ordinal: "0"
214210
analogue:
215211
- "**clCreateImage**"
212+
details:
213+
- |
214+
The primary $x_image_format_t that must be supported by all the adapters are {UR_IMAGE_CHANNEL_ORDER_RGBA, UR_IMAGE_CHANNEL_TYPE_UNORM_INT8},
215+
{UR_IMAGE_CHANNEL_ORDER_RGBA, UR_IMAGE_CHANNEL_TYPE_UNORM_INT16}, {UR_IMAGE_CHANNEL_ORDER_RGBA, UR_IMAGE_CHANNEL_TYPE_SNORM_INT8},
216+
{UR_IMAGE_CHANNEL_ORDER_RGBA, UR_IMAGE_CHANNEL_TYPE_SNORM_INT16}, {UR_IMAGE_CHANNEL_ORDER_RGBA, UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8},
217+
{UR_IMAGE_CHANNEL_ORDER_RGBA, UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16}, {UR_IMAGE_CHANNEL_ORDER_RGBA, UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32},
218+
{UR_IMAGE_CHANNEL_ORDER_RGBA, UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8}, {UR_IMAGE_CHANNEL_ORDER_RGBA, UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16},
219+
{UR_IMAGE_CHANNEL_ORDER_RGBA, UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32}, {UR_IMAGE_CHANNEL_ORDER_RGBA, UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT},
220+
{UR_IMAGE_CHANNEL_ORDER_RGBA, UR_IMAGE_CHANNEL_TYPE_FLOAT}.
216221
params:
217222
- type: $x_context_handle_t
218223
name: hContext
@@ -236,12 +241,13 @@ returns:
236241
- $X_RESULT_ERROR_INVALID_CONTEXT
237242
- $X_RESULT_ERROR_INVALID_VALUE
238243
- $X_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR:
239-
- "`pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type`"
244+
- "`pImageDesc && UR_MEM_TYPE_IMAGE1D_ARRAY < pImageDesc->type`"
240245
- $X_RESULT_ERROR_INVALID_IMAGE_SIZE
241246
- $X_RESULT_ERROR_INVALID_OPERATION
242247
- $X_RESULT_ERROR_INVALID_HOST_PTR:
243248
- "`pHost == NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) != 0`"
244249
- "`pHost != NULL && (flags & (UR_MEM_FLAG_USE_HOST_POINTER | UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER)) == 0`"
250+
- $X_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT
245251
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
246252
- $X_RESULT_ERROR_OUT_OF_RESOURCES
247253
--- #--------------------------------------------------------------------------

scripts/core/queue.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ etors:
3232
The reference count returned should be considered immediately stale.
3333
It is unsuitable for general use in applications. This feature is provided for identifying memory leaks.
3434
- name: SIZE
35-
desc: "[uint32_t] The size of the queue"
35+
desc: |
36+
[uint32_t] The size of the queue on the device. Only a valid query
37+
if the queue was created with the `ON_DEVICE` queue flag, otherwise
38+
`$xQueueGetInfo` will return `$X_RESULT_ERROR_INVALID_QUEUE`.
3639
- name: EMPTY
3740
desc: "[$x_bool_t] return true if the queue was empty at the time of the query"
3841
--- #--------------------------------------------------------------------------
@@ -49,7 +52,7 @@ etors:
4952
desc: "Enable/disable profiling"
5053
- name: ON_DEVICE
5154
value: "$X_BIT(2)"
52-
desc: "Is a device queue"
55+
desc: "Is a device queue. If this is enabled `OUT_OF_ORDER_EXEC_MODE_ENABLE` must also be enabled."
5356
- name: ON_DEVICE_DEFAULT
5457
value: "$X_BIT(3)"
5558
desc: "Is the default queue for a device"
@@ -108,6 +111,7 @@ returns:
108111
- "`propSize != 0 && pPropValue == NULL`"
109112
- "`pPropValue == NULL && pPropSizeRet == NULL`"
110113
- $X_RESULT_ERROR_INVALID_QUEUE
114+
- "If `hQueue` isn't a valid queue handle or if `propName` isn't supported by `hQueue`."
111115
- $X_RESULT_ERROR_OUT_OF_HOST_MEMORY
112116
- $X_RESULT_ERROR_OUT_OF_RESOURCES
113117
--- #--------------------------------------------------------------------------

source/adapters/cuda/device.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
215215
int Major = 0;
216216
UR_CHECK_ERROR(cuDeviceGetAttribute(
217217
&Major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, hDevice->get()));
218-
uint64_t Capabilities =
218+
ur_memory_scope_capability_flags_t Capabilities =
219219
(Major >= 7) ? UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM |
220220
UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP |
221221
UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP |
@@ -270,7 +270,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
270270
int WarpSize = 0;
271271
UR_CHECK_ERROR(cuDeviceGetAttribute(
272272
&WarpSize, CU_DEVICE_ATTRIBUTE_WARP_SIZE, hDevice->get()));
273-
size_t Sizes[1] = {static_cast<size_t>(WarpSize)};
273+
uint32_t Sizes[1] = {static_cast<uint32_t>(WarpSize)};
274274
return ReturnValue(Sizes, 1);
275275
}
276276
case UR_DEVICE_INFO_MAX_CLOCK_FREQUENCY: {
@@ -569,10 +569,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
569569
ur_queue_flag_t(UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE |
570570
UR_QUEUE_FLAG_PROFILING_ENABLE));
571571
case UR_DEVICE_INFO_QUEUE_ON_DEVICE_PROPERTIES: {
572-
// The mandated minimum capability:
573-
ur_queue_flags_t Capability = UR_QUEUE_FLAG_PROFILING_ENABLE |
574-
UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE;
575-
return ReturnValue(Capability);
572+
return ReturnValue(0);
576573
}
577574
case UR_DEVICE_INFO_QUEUE_ON_HOST_PROPERTIES: {
578575
// The mandated minimum capability:

0 commit comments

Comments
 (0)