Skip to content

Allow querying free/total memory for SYCL - #1225

Merged
lucbv merged 3 commits into
kokkos:developfrom
masterleinad:query_memory_sycl
Jan 19, 2022
Merged

lucbv merged 3 commits into
kokkos:developfrom
masterleinad:query_memory_sycl

Conversation

@masterleinad

Copy link
Copy Markdown
Contributor

This is an intermediate solution for #1062 until the functionality is properly supported in the compiler.
Currently, there are some issues with using Sysman.

@kokkos-devops-admin

Copy link
Copy Markdown

Status Flag 'Pre-Test Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging
NO INSPECTION HAS BEEN PERFORMED ON THIS PULL REQUEST! - This PR must be inspected by setting label 'AT: PRE-TEST INSPECTED'.

@masterleinad

Copy link
Copy Markdown
Contributor Author

This works reasonably well for me as a workaround. Unfortunately, we currently need to build with shared libraries for which I have introduced another CMake variable and we also have to link with ze_loader which this pull request just assumes to be accessible to the linker.

@brian-kelley Would you mind checking if that works for you running, e.g. wiki_spgemm on an Intel GPU?

@masterleinad
masterleinad marked this pull request as ready for review December 16, 2021 21:17
@kokkos-devops-admin

Copy link
Copy Markdown

Status Flag 'Pre-Test Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging
NO INSPECTION HAS BEEN PERFORMED ON THIS PULL REQUEST! - This PR must be inspected by setting label 'AT: PRE-TEST INSPECTED'.

@brian-kelley

Copy link
Copy Markdown
Contributor

@masterleinad Yes, that worked, thanks! The only caveat was I had to do export ZES_ENABLE_SYSMAN=1 before running.

@srajama1 srajama1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@masterleinad : Is there some reference for this memory module business?

@masterleinad

Copy link
Copy Markdown
Contributor Author

@masterleinad : Is there some reference for this memory module business?

See https://spec.oneapi.io/level-zero/latest/sysman/api.html#zesdeviceenummemorymodules and https://spec.oneapi.io/level-zero/latest/sysman/api.html#zesmemorygetproperties. It's hard to find precise information and I would consider the functionality provided here fairly brittle but it seems to work well enough for the tests to pass until https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/LevelZeroBackend/LevelZeroBackend.md#51-device-information-descriptors is actually implemented in the compiler.

@masterleinad

Copy link
Copy Markdown
Contributor Author

It would be great if we can think about this being considered for the next release.

@kokkos-devops-admin

Copy link
Copy Markdown

Status Flag 'Pre-Test Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging
NO INSPECTION HAS BEEN PERFORMED ON THIS PULL REQUEST! - This PR must be inspected by setting label 'AT: PRE-TEST INSPECTED'.

brian-kelley added a commit to brian-kelley/kokkos-kernels that referenced this pull request Jan 17, 2022
Just needs kokkos#1225 to allow querying free/total memory. This will make spgemm,
spgemm-jacobi and block GS tests pass. replaceSumIntoLonger still has a runtime error
(too many registers used by arrays?), so that is disabled for now.
brian-kelley added a commit to brian-kelley/kokkos-kernels that referenced this pull request Jan 17, 2022
Just needs kokkos#1225 to allow querying free/total memory. This will make spgemm,
spgemm-jacobi and block GS tests pass. replaceSumIntoLonger still has a runtime error
(too many registers used by arrays?), so that is disabled for now.
brian-kelley added a commit to brian-kelley/kokkos-kernels that referenced this pull request Jan 17, 2022
Just needs kokkos#1225 to allow querying free/total memory. This will make spgemm,
spgemm-jacobi and block GS tests pass. replaceSumIntoLonger still has a runtime error
(too many registers used by arrays?), so that is disabled for now.
brian-kelley added a commit to brian-kelley/kokkos-kernels that referenced this pull request Jan 18, 2022
Just needs kokkos#1225 to allow querying free/total memory. This will make spgemm,
spgemm-jacobi and block GS tests pass. replaceSumIntoLonger still has a runtime error
(too many registers used by arrays?), so that is disabled for now.
@lucbv

lucbv commented Jan 18, 2022

Copy link
Copy Markdown
Contributor

@masterleinad would you mind rebasing on top of develop?
After a quick review, I am happy to give the pre-approved label to have the CI pick it up.
@srajama1 is also looking at it today : )

@masterleinad

Copy link
Copy Markdown
Contributor Author

Rebased.

Comment thread src/CMakeLists.txt
Comment on lines +467 to +472
IF (NOT BUILD_SHARED_LIBS)
MESSAGE(SEND_ERROR
"At the moment, we require KokkosKernels (and Kokkos) to be built as "
"shared libraries to allow querying free and total device memory!"
)
ENDIF()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Note that this is a new restriction that may surprise users already using SYCL.

Comment thread CMakeLists.txt
INCLUDE(cmake/fake_tribits.cmake)
INCLUDE(cmake/kokkoskernels_tribits.cmake)

OPTION(BUILD_SHARED_LIBS "Build shared libraries" OFF)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This will change the default build behavior of Kokkos Kernels which does a shared library build by default.
Is this change required for your fix?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh, really? In fact, this patch requires building with shared libraries, see https://github.com/masterleinad/kokkos-kernels/blob/5a8e0146189c898551662b0ac9b1e2c580bfaa14/src/CMakeLists.txt#L470. I can check tomorrow if the on;y problem was that Kokkos didn't get built as a shared library.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actually after double checking, we are building static libraries by default so this line should not change anything.

@lucbv lucbv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks to me

@kokkos-devops-admin

Copy link
Copy Markdown

Status Flag 'Pre-Test Inspection' - SUCCESS: The last commit to this Pull Request has been INSPECTED by label AT: PRE-TEST INSPECTED! Autotester is Removing Label; This inspection will remain valid until a new commit to source branch is performed.

@kokkos-devops-admin

Copy link
Copy Markdown

Status Flag 'Pull Request AutoTester' - Testing Jenkins Projects:

Pull Request Auto Testing STARTING (click to expand)

Build Information

Test Name: KokkosKernels_PullRequest_Tpls_CUDA9_GCC720_Light_Tpls_GCC720_GCC740

  • Build Num: 125
  • Status: STARTED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH query_memory_sycl
KOKKOSKERNELS_SOURCE_REPO https://github.com/masterleinad/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 5a8e014
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 86f783a
PR_LABELS
PULLREQUESTNUM 1225
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_Tpls_CUDA10_Tpls_CUDA10_LayoutRight

  • Build Num: 123
  • Status: STARTED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH query_memory_sycl
KOKKOSKERNELS_SOURCE_REPO https://github.com/masterleinad/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 5a8e014
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 86f783a
PR_LABELS
PULLREQUESTNUM 1225
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_GCC720

  • Build Num: 781
  • Status: STARTED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH query_memory_sycl
KOKKOSKERNELS_SOURCE_REPO https://github.com/masterleinad/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 5a8e014
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 86f783a
PR_LABELS
PULLREQUESTNUM 1225
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_GCC720_Light_LayoutRight

  • Build Num: 428
  • Status: STARTED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH query_memory_sycl
KOKKOSKERNELS_SOURCE_REPO https://github.com/masterleinad/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 5a8e014
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 86f783a
PR_LABELS
PULLREQUESTNUM 1225
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_Tpls_GCC720

  • Build Num: 772
  • Status: STARTED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH query_memory_sycl
KOKKOSKERNELS_SOURCE_REPO https://github.com/masterleinad/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 5a8e014
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 86f783a
PR_LABELS
PULLREQUESTNUM 1225
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_Tpls_INTEL18

  • Build Num: 760
  • Status: STARTED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH query_memory_sycl
KOKKOSKERNELS_SOURCE_REPO https://github.com/masterleinad/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 5a8e014
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 86f783a
PR_LABELS
PULLREQUESTNUM 1225
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_CLANG1001

  • Build Num: 165
  • Status: STARTED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH query_memory_sycl
KOKKOSKERNELS_SOURCE_REPO https://github.com/masterleinad/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 5a8e014
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 86f783a
PR_LABELS
PULLREQUESTNUM 1225
TEST_REPO_ALIAS KOKKOSKERNELS

Using Repos:

Repo: KOKKOSKERNELS (masterleinad/kokkos-kernels)
  • Branch: query_memory_sycl
  • SHA: 5a8e014
  • Mode: TEST_REPO

Pull Request Author: masterleinad

@kokkos-devops-admin

Copy link
Copy Markdown

Status Flag 'Pull Request AutoTester' - Jenkins Testing: all Jobs PASSED

Pull Request Auto Testing has PASSED (click to expand)

Build Information

Test Name: KokkosKernels_PullRequest_Tpls_CUDA9_GCC720_Light_Tpls_GCC720_GCC740

  • Build Num: 125
  • Status: PASSED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH query_memory_sycl
KOKKOSKERNELS_SOURCE_REPO https://github.com/masterleinad/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 5a8e014
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 86f783a
PR_LABELS
PULLREQUESTNUM 1225
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_Tpls_CUDA10_Tpls_CUDA10_LayoutRight

  • Build Num: 123
  • Status: PASSED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH query_memory_sycl
KOKKOSKERNELS_SOURCE_REPO https://github.com/masterleinad/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 5a8e014
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 86f783a
PR_LABELS
PULLREQUESTNUM 1225
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_GCC720

  • Build Num: 781
  • Status: PASSED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH query_memory_sycl
KOKKOSKERNELS_SOURCE_REPO https://github.com/masterleinad/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 5a8e014
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 86f783a
PR_LABELS
PULLREQUESTNUM 1225
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_GCC720_Light_LayoutRight

  • Build Num: 428
  • Status: PASSED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH query_memory_sycl
KOKKOSKERNELS_SOURCE_REPO https://github.com/masterleinad/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 5a8e014
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 86f783a
PR_LABELS
PULLREQUESTNUM 1225
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_Tpls_GCC720

  • Build Num: 772
  • Status: PASSED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH query_memory_sycl
KOKKOSKERNELS_SOURCE_REPO https://github.com/masterleinad/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 5a8e014
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 86f783a
PR_LABELS
PULLREQUESTNUM 1225
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_Tpls_INTEL18

  • Build Num: 760
  • Status: PASSED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH query_memory_sycl
KOKKOSKERNELS_SOURCE_REPO https://github.com/masterleinad/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 5a8e014
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 86f783a
PR_LABELS
PULLREQUESTNUM 1225
TEST_REPO_ALIAS KOKKOSKERNELS

Build Information

Test Name: KokkosKernels_PullRequest_CLANG1001

  • Build Num: 165
  • Status: PASSED

Jenkins Parameters

Parameter Name Value
KOKKOSKERNELS_SOURCE_BRANCH query_memory_sycl
KOKKOSKERNELS_SOURCE_REPO https://github.com/masterleinad/kokkos-kernels
KOKKOSKERNELS_SOURCE_SHA 5a8e014
KOKKOSKERNELS_TARGET_BRANCH develop
KOKKOSKERNELS_TARGET_REPO https://github.com/kokkos/kokkos-kernels
KOKKOSKERNELS_TARGET_SHA 86f783a
PR_LABELS
PULLREQUESTNUM 1225
TEST_REPO_ALIAS KOKKOSKERNELS

@kokkos-devops-admin

Copy link
Copy Markdown

Status Flag 'Pre-Merge Inspection' - SUCCESS: The last commit to this Pull Request has been INSPECTED AND APPROVED by [ lucbv ]!

@kokkos-devops-admin

Copy link
Copy Markdown

Status Flag 'Pull Request AutoTester' - Pull Request MUST BE MERGED MANUALLY BY Project Team - This Repo does not support Automerge

@sivascience sivascience left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks @masterleinad ! Looks good to me.

@lucbv
lucbv merged commit 701fb05 into kokkos:develop Jan 19, 2022
brian-kelley added a commit to brian-kelley/kokkos-kernels that referenced this pull request Jan 19, 2022
Just needs kokkos#1225 to allow querying free/total memory. This will make spgemm,
spgemm-jacobi and block GS tests pass. replaceSumIntoLonger still has a runtime error
(too many registers used by arrays?), so that is disabled for now.
brian-kelley added a commit that referenced this pull request Jan 20, 2022
* Get sparse tests enabled and working for SYCL

Just needs #1225 to allow querying free/total memory. This will make spgemm,
spgemm-jacobi and block GS tests pass. replaceSumIntoLonger still has a runtime error
(too many registers used by arrays?), so that is disabled for now.

* Added --shared option to cm_generate_makefile

to build Kokkos and KokkosKernels as shared libraries.
Static libraries are still the default. This option is useful because
SYCL builds on Intel now require a shared library build.
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.

6 participants