Skip to content

Commit 134702b

Browse files
feature: introduce mechanism for detecting new vm bind flags support in xe path
intel/compute-runtime#717 Related-To: NEO-10958 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
1 parent 78bd3da commit 134702b

5 files changed

Lines changed: 39 additions & 4 deletions

File tree

shared/source/os_interface/linux/xe/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ set(NEO_CORE_OS_INTERFACE_LINUX_XE
1111
${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_xe.cpp
1212
${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_xe.h
1313
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/ioctl_helper_xe_query_hw_ip_version.cpp
14+
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/ioctl_helper_xe_vm_bind_flags.cpp
1415
)
1516

1617
if(NEO_ENABLE_XE_EU_DEBUG_SUPPORT)

shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ bool IoctlHelperXe::initialize() {
172172
tileIdToGtId[gt.tile_id] = gt.gt_id;
173173
}
174174
}
175+
querySupportedFeatures();
175176
return true;
176177
}
177178

@@ -784,6 +785,7 @@ uint64_t IoctlHelperXe::getFlagsForVmBind(bool bindCapture, bool bindImmediate,
784785
if (bindCapture) {
785786
ret |= DRM_XE_VM_BIND_FLAG_DUMPABLE;
786787
}
788+
ret |= getAdditionalFlagsForVmBind(bindImmediate, readOnlyResource);
787789
return ret;
788790
}
789791

shared/source/os_interface/linux/xe/ioctl_helper_xe.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,21 @@ class IoctlHelperXe : public IoctlHelper {
204204
uint64_t startOffset;
205205
uint32_t drmContextId;
206206
};
207+
208+
struct SupportedFeatures {
209+
union {
210+
struct {
211+
uint32_t vmBindReadOnly : 1;
212+
uint32_t vmBindImmediate : 1;
213+
uint32_t reserved : 30;
214+
} flags;
215+
uint32_t allFlags = 0;
216+
};
217+
} supportedFeatures{};
218+
static_assert(sizeof(SupportedFeatures::flags) == sizeof(SupportedFeatures::allFlags), "");
219+
220+
void querySupportedFeatures();
221+
uint64_t getAdditionalFlagsForVmBind(bool bindImmediate, bool readOnlyResource);
207222
};
208223

209224
template <typename... XeLogArgs>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (C) 2024 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#include "shared/source/os_interface/linux/xe/ioctl_helper_xe.h"
9+
10+
namespace NEO {
11+
void IoctlHelperXe::querySupportedFeatures(){};
12+
13+
uint64_t IoctlHelperXe::getAdditionalFlagsForVmBind(bool bindImmediate, bool readOnlyResource) {
14+
return 0;
15+
}
16+
} // namespace NEO

shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ struct MockIoctlHelperXe : IoctlHelperXe {
3838
using IoctlHelperXe::maxExecQueuePriority;
3939
using IoctlHelperXe::queryGtListData;
4040
using IoctlHelperXe::setContextProperties;
41+
using IoctlHelperXe::supportedFeatures;
4142
using IoctlHelperXe::UserFenceExtension;
4243
using IoctlHelperXe::xeGetBindFlagsName;
4344
using IoctlHelperXe::xeGetBindOperationName;
@@ -260,10 +261,10 @@ class DrmMockXe : public DrmMockCustom {
260261
auto vmBindInput = static_cast<drm_xe_vm_bind *>(arg);
261262
vmBindInputs.push_back(*vmBindInput);
262263

263-
EXPECT_EQ(1u, vmBindInput->num_syncs);
264-
265-
auto &syncInput = reinterpret_cast<drm_xe_sync *>(vmBindInput->syncs)[0];
266-
syncInputs.push_back(syncInput);
264+
if (vmBindInput->num_syncs == 1) {
265+
auto &syncInput = reinterpret_cast<drm_xe_sync *>(vmBindInput->syncs)[0];
266+
syncInputs.push_back(syncInput);
267+
}
267268
} break;
268269

269270
case DrmIoctl::gemWaitUserFence: {

0 commit comments

Comments
 (0)