Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: System Allocator support for Level Zero #782

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

johntfalk
Copy link
Contributor

Related-To: NEO-12988

Signed-off-by: John Falkowski [email protected]

Related-To: NEO-12988

Signed-off-by: John Falkowski [email protected]
auto alloc = allocData->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex());
commandContainer.addToResidencyContainer(alloc);

if (allocData) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should only be allowed if system shared USM is enabled

@@ -1140,6 +1144,16 @@ bool Drm::hasPageFaultSupport() const {
return pageFaultSupported;
}

void Drm::checkSystemAllocEnabled() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change the name to clearly indicate that this is for Shared System USM

@@ -210,6 +210,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, ForceExtendedUSMBufferSize, -1, "-1: default, 0:
DECLARE_DEBUG_VARIABLE(int32_t, ForceExtendedKernelIsaSize, -1, "-1: default, 0: disabled, >=1: Forces extended kernel isa size by specified pageSize number")
DECLARE_DEBUG_VARIABLE(int32_t, ForceSimdMessageSizeInWalker, -1, "-1: default, >=0 Program given value in Walker command for SIMD size")
DECLARE_DEBUG_VARIABLE(int32_t, EnableRecoverablePageFaults, -1, "-1: default - ignore, 0: disable, 1: enable recoverable page faults on all VMs (on faultable hardware)")
DECLARE_DEBUG_VARIABLE(int32_t, EnableSystemAllocator, -1, "-1: default - ignore, 0: disable, 1: enable use of system-allocated memory for GPU access")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please make sure that System Shared USM terminology is used

return ZE_RESULT_ERROR_INVALID_ARGUMENT;
DeviceImp *deviceImp = static_cast<DeviceImp *>(device);
if (!deviceImp->isSystemAllocEnabled()) {
NEO::SvmAllocationData *allocData = nullptr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this code is skipped for Shared System USM ?

vmBind.vmId = static_cast<uint32_t>(ctl.vmId);
vmBind.flags = DRM_XE_VM_BIND_FLAG_SYSTEM_ALLOCATOR;
vmBind.handle = 0;
vmBind.length = (0x1ull << 48);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be dependant on CPU VA range

@@ -1317,6 +1320,37 @@ int IoctlHelperXe::xeVmBind(const VmBindParams &vmBindParams, bool isBind) {
const char *operation = isBind ? "bind" : "unbind";
int index = invalidIndex;

if (this->drm.isVmBindSystemAlloc()) {
drm_xe_vm_bind bind = {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this path is taken for all vm_binds?
this overwrites other ioctl calls, please unify the logic so we have a single ioctl calling point

@@ -152,6 +152,12 @@ class Drm : public DriverModel {
void setDirectSubmissionActive(bool value) { this->directSubmissionActive = value; }
bool isDirectSubmissionActive() const { return this->directSubmissionActive; }

void setVmBindSystemAlloc(bool value) { this->vmBindSystemAlloc = value; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove, this needs to be passed via arguments and not by modyfing global drm state.

@@ -152,6 +152,12 @@ class Drm : public DriverModel {
void setDirectSubmissionActive(bool value) { this->directSubmissionActive = value; }
bool isDirectSubmissionActive() const { return this->directSubmissionActive; }

void setVmBindSystemAlloc(bool value) { this->vmBindSystemAlloc = value; }
bool isVmBindSystemAlloc() const { return this->vmBindSystemAlloc; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove and pass via arguments

}
bind.bind.obj = 0;
//if (bindInfo[index].userptr) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove commented code

Related-To: NEO-12988

Signed-off-by: John Falkowski [email protected]
Signed-off-by: Falkowski, John <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants