forked from pytorch/kineto
-
Notifications
You must be signed in to change notification settings - Fork 0
[XPU profiler] enable XPU profiler in kineto #3
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
Open
zejun-chen
wants to merge
1
commit into
main
Choose a base branch
from
zejun/xpu_profiler_2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # xpupti: XPU implementation for kineto profiler | ||
| # outputs: | ||
| # SYCL_INCLUDE_DIR -- SYCL include dir | ||
| # SYCL_LIBRARY -- SYCL library file | ||
| # XPU_xpupti_LIBRARY -- XPUPTI dependencies lib | ||
| # XPUPTI_BUILD_FLAG -- XPUPTI build flags | ||
|
|
||
| if((NOT SYCL_INCLUDE_DIR) OR (NOT SYCL_LIBRARY_DIR)) | ||
| include(FindSYCLToolkit.cmake) | ||
| if(NOT SYCLTOOLKIT_FOUND) | ||
| message(FATAL_ERROR "${SYCL_NOT_FOUND_MESSAGE}") | ||
| endif() | ||
| endif() | ||
|
|
||
| message(INFO " SYCL_INCLUDE_DIR = ${SYCL_INCLUDE_DIR}") | ||
| message(INFO " SYCL_LIBRARY = ${SYCL_LIBRARY}") | ||
|
|
||
| set(XPUPTI_INCLUDE_DIR ${SYCL_INCLUDE_DIR}) | ||
|
|
||
| # find xpupti sdk | ||
| find_package(Pti REQUIRED) | ||
| if(TARGET Pti::pti_view) | ||
| message(INFO " Found XPUPTI") | ||
|
|
||
| get_target_property(PTI_INCLUDE_DIR Pti::pti_view INTERFACE_INCLUDE_DIRECTORIES) | ||
| find_library(PTI_VIEW_LIBRARY NAMES pti_view PATHS "${PTI_INCLUDE_DIR}/../lib") | ||
| set(PTI_LIBRARY ${PTI_VIEW_LIBRARY} CACHE STRING "Imported PTI library.") | ||
| set(PTI_INCLUDE_DIR ${PTI_INCLUDE_DIR} CACHE STRING "PTI include directory.") | ||
|
|
||
| # find dependent lib | ||
| set(XPU_xpupti_LIBRARY ${SYCL_LIBRARY}) | ||
| list(APPEND XPU_xpupti_LIBRARY ${PTI_LIBRARY}) | ||
| set(XPU_xpupti_LIBRARY ${XPU_xpupti_LIBRARY} PARENT_SCOPE) | ||
|
|
||
| # find dependent include | ||
| list(APPEND XPUPTI_INCLUDE_DIR ${PTI_INCLUDE_DIR}) | ||
| set(XPUPTI_INCLUDE_DIR ${XPUPTI_INCLUDE_DIR} PARENT_SCOPE) | ||
|
|
||
| set(XPUPTI_BUILD_FLAG "-DHAS_XPUPTI" PARENT_SCOPE) | ||
|
|
||
| message(INFO " XPU_xpupti_LIBRARY = ${XPU_xpupti_LIBRARY}") | ||
| message(INFO " XPUPTI_INCLUDE_DIR = ${XPUPTI_INCLUDE_DIR}") | ||
| message(INFO " XPUPTI_BUILD_FLAG = ${XPUPTI_BUILD_FLAG}") | ||
| else() | ||
| set(LIBKINETO_NOXPUPTI ON CACHE STRING "" FORCE PARENT_SCOPE) | ||
| set(XPU_xpupti_LIBRARY PARENT_SCOPE) | ||
| set(XPUPTI_BUILD_FLAG PARENT_SCOPE) | ||
| set(XPUPTI_INCLUDE_DIR PARENT_SCOPE) | ||
| message(FATAL_ERROR " Could not find XPUPTI for building kineto") | ||
| return() | ||
| endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| #[=======================================================================[.rst: | ||
| SYCLConfig | ||
| ------- | ||
|
|
||
| Library to verify SYCL compatability of CMAKE_CXX_COMPILER | ||
| and passes relevant compiler flags. | ||
|
|
||
| Result Variables | ||
| ^^^^^^^^^^^^^^^^ | ||
|
|
||
| This will define the following variables: | ||
|
|
||
| ``SYCLTOOLKIT_FOUND`` | ||
| True if the system has the SYCL library. | ||
| ``SYCL_COMPILER`` | ||
| SYCL compiler executable. | ||
| ``SYCL_INCLUDE_DIR`` | ||
| Include directories needed to use SYCL. | ||
| ``SYCL_LIBRARY_DIR`` | ||
| Libaray directories needed to use SYCL. | ||
|
|
||
| #]=======================================================================] | ||
|
|
||
| set(SYCLTOOLKIT_FOUND False) | ||
| include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) | ||
|
|
||
| set(SYCL_ROOT "") | ||
| if(DEFINED ENV{SYCL_ROOT}) | ||
| set(SYCL_ROOT $ENV{SYCL_ROOT}) | ||
| elseif(DEFINED ENV{CMPLR_ROOT}) | ||
| set(SYCL_ROOT $ENV{CMPLR_ROOT}) | ||
| endif() | ||
|
|
||
| if(WIN32) | ||
| set(SYCL_EXECUTABLE_NAME icx) | ||
| else() | ||
| set(SYCL_EXECUTABLE_NAME icpx) | ||
| endif() | ||
|
|
||
| if(NOT SYCL_ROOT) | ||
| execute_process( | ||
| COMMAND which ${SYCL_EXECUTABLE_NAME} | ||
| OUTPUT_VARIABLE SYCL_CMPLR_FULL_PATH | ||
| OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
|
|
||
| if(NOT EXISTS "${SYCL_CMPLR_FULL_PATH}") | ||
| message(WARNING "Cannot find ENV{CMPLR_ROOT} or icpx, please setup SYCL compiler Tool kit enviroment before building!!") | ||
| return() | ||
| endif() | ||
|
|
||
| get_filename_component(SYCL_BIN_DIR "${SYCL_CMPLR_FULL_PATH}" DIRECTORY) | ||
| set(SYCL_ROOT ${SYCL_BIN_DIR}/..) | ||
| endif() | ||
|
|
||
| find_program( | ||
| SYCL_COMPILER | ||
| NAMES ${SYCL_EXECUTABLE_NAME} | ||
| PATHS "${SYCL_ROOT}" | ||
| PATH_SUFFIXES bin bin64 | ||
| NO_DEFAULT_PATH | ||
| ) | ||
|
|
||
| string(COMPARE EQUAL "${SYCL_COMPILER}" "" nocmplr) | ||
| if(nocmplr) | ||
| set(SYCLTOOLKIT_FOUND False) | ||
| set(SYCL_REASON_FAILURE "SYCL: CMAKE_CXX_COMPILER not set!!") | ||
| set(SYCL_NOT_FOUND_MESSAGE "${SYCL_REASON_FAILURE}") | ||
| endif() | ||
|
|
||
| find_file( | ||
| SYCL_INCLUDE_DIR | ||
| NAMES include | ||
| HINTS ${SYCL_ROOT} | ||
| NO_DEFAULT_PATH | ||
| ) | ||
|
|
||
| find_file( | ||
| SYCL_INCLUDE_SYCL_DIR | ||
| NAMES sycl | ||
| HINTS ${SYCL_ROOT}/include | ||
| NO_DEFAULT_PATH | ||
| ) | ||
|
|
||
| list(APPEND SYCL_INCLUDE_DIR ${SYCL_INCLUDE_SYCL_DIR}) | ||
|
|
||
| find_file( | ||
| SYCL_LIBRARY_DIR | ||
| NAMES lib lib64 | ||
| HINTS ${SYCL_ROOT} | ||
| NO_DEFAULT_PATH | ||
| ) | ||
|
|
||
| find_library( | ||
| SYCL_LIBRARY | ||
| NAMES sycl | ||
| HINTS ${SYCL_LIBRARY_DIR} | ||
| NO_DEFAULT_PATH | ||
| ) | ||
|
|
||
| if((NOT SYCL_INCLUDE_DIR) OR (NOT SYCL_LIBRARY_DIR) OR (NOT SYCL_LIBRARY)) | ||
| set(SYCLTOOLKIT_FOUND False) | ||
| set(SYCL_REASON_FAILURE "SYCL sdk is incomplete!!") | ||
| set(SYCL_NOT_FOUND_MESSAGE "${SYCL_REASON_FAILURE}") | ||
| return() | ||
| endif() | ||
|
|
||
| message(DEBUG "The SYCL compiler is ${SYCL_COMPILER}") | ||
| message(DEBUG "The SYCL Flags are ${SYCL_FLAGS}") | ||
|
|
||
| set(SYCLTOOLKIT_FOUND True) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move all of above lines to src/plugin/xpupti?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds like the better solution is, make xpupti as a separate static .a ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.a is not a MUST option. You can move these lines to separate cmakefile first.