Skip to content

[SYCL][L0] Report root- vs sub- device free memory differently #7789

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

Merged
merged 3 commits into from
Dec 16, 2022

Conversation

smaslov-intel
Copy link
Contributor

@smaslov-intel smaslov-intel commented Dec 15, 2022

E2E test: intel/llvm-test-suite#1453
Signed-off-by: Sergey V Maslov [email protected]

Signed-off-by: Sergey V Maslov <[email protected]>
Signed-off-by: Sergey V Maslov <[email protected]>
@smaslov-intel smaslov-intel requested a review from a team as a code owner December 15, 2022 18:48
(*Device->ZeDeviceMemoryProperties.operator->())[I].totalSize;
for (const auto &ZeDeviceMemoryExtProperty :
Device->ZeDeviceMemoryProperties->second) {
GlobalMemSize += ZeDeviceMemoryExtProperty.physicalSize;
Copy link
Contributor

Choose a reason for hiding this comment

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

@smaslov-intel : I guess we are adding here because ZeDevice from line 810 is a a subdevice, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, Device/ZeDevice may be either sub-device or root- device here.
We are adding because that's what we were doing before and I only change where we take the "total" size from.
So, should we be adding or not?

I assume today there is only one memory, so it's probably not important at the moment.

Copy link
Contributor

Choose a reason for hiding this comment

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

physicalSize reported by Core properties for a root device already is the aggregation of the sub-devices. could you confirm whether you are getting the correct numbers here?

Copy link
Contributor

Choose a reason for hiding this comment

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

discussed with @smaslov-intel : code is good.

zes_mem_handle_t ZesMemHandle;
ZE_CALL(zesDeviceEnumMemoryModules, (ZeDevice, &MemCount, &ZesMemHandle));
uint32_t MemCount = 0;
ZE_CALL(zesDeviceEnumMemoryModules, (ZeDevice, &MemCount, nullptr));
Copy link
Contributor

Choose a reason for hiding this comment

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

If ZeDevice is sub-device then isn't zesDeviceEnumMemoryModules supposed to return memory modules/handes only for that subdevice? I am trying to understand why we need this if:
https://github.com/intel/llvm/pull/7789/files#diff-15dd1eb076d2164bd9e87d9057f05f652a716498e8cdf5975e564c65309a0985R3195-R3196

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps you are right, so maybe check for subdeviceID is redundant in the loop (but not wrong).
@jandres742 : would you comment?

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct. For a sub-device, we have only one memory module currently, but logic below is scalable if that changes in future.

Line 3189 traverses over the memory modules in the ZexMemHandles vector (it would be N for a parent device with N sub-devices, and 1 for a sub-device that is not further partitioned by L0).

Line 3200 is executed several times only for a root device. For a sub-device, it is executed only if the memory module has the same sub-device id, and currently that would be only once.

Copy link
Contributor

@againull againull left a comment

Choose a reason for hiding this comment

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

Looks good to me. But this should be merged after @jandres742 approval.

@jandres742
Copy link
Contributor

+1

@againull againull requested review from againull and removed request for jandres742 December 16, 2022 02:38
@againull againull merged commit 9dc14a2 into intel:sycl Dec 16, 2022
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.

3 participants