Skip to content

[SYCL] Instrumentation for application profiling #1129

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 1 commit into from
Mar 10, 2020

Conversation

tovinkere
Copy link
Contributor

Overview

  1. SYCL runtime is instrumented for capturing the semantic and trace information of the asynchronous task graph.
  2. For all data parallel constructs, end user code-location information is captured and preserved as metadata and made available to the tracing framework.
  3. Uses a CMake configuration to turn this instrumentation on and it is ON by default.
  4. Uses xpti proxy library for instrumentation and the proxy library is available under llvm/xpti. If the dynamic portion of the instrumentation framework is not available, then tracing gets disabled. Tracing can also be disabled by using environment variables as well.
  5. Documentation on what is being captured is available under llvm/xpti/doc.

Copy link
Contributor

@alexbatashev alexbatashev left a comment

Choose a reason for hiding this comment

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

A general comment. Am I right that users need to add some kind of definition to their command lines? Can you please document them in user guide? Should we also create a more user friendly alias for clang driver?

@tovinkere
Copy link
Contributor Author

A general comment. Am I right that users need to add some kind of definition to their command lines? Can you please document them in user guide? Should we also create a more user friendly alias for clang driver?

There should not be any definition in the command-lines as it stands right now, but -fsycl should automatically add -DSYCL_INSTRUMENTATION_METADATA to provide the opportunity to disable the default argument in the future

@bader bader changed the title SYCL Instrumentation for application profiling [SYCL] Instrumentation for application profiling Feb 18, 2020
Copy link
Contributor

@keryell keryell left a comment

Choose a reason for hiding this comment

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

Amazing work and useful feature!

A few remarks...
This is the first part of my review. Probably more tomorrow...

@tovinkere tovinkere force-pushed the xpti_instrumentation branch from 95cd2bc to 9fef108 Compare February 19, 2020 18:32
Copy link
Contributor

@keryell keryell left a comment

Choose a reason for hiding this comment

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

Thanks for the changes.
A few remarks for today.

@keryell
Copy link
Contributor

keryell commented Feb 20, 2020

I made another code review with 84 items but when I submit the review GitHub fails with:

This page is taking way too long to load.
Sorry about that. Please try refreshing and contact us if the problem persists.

Copy link
Contributor

@keryell keryell left a comment

Choose a reason for hiding this comment

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

Thanks for the changes.
Here are my comments for today.

@keryell
Copy link
Contributor

keryell commented Feb 20, 2020

Ah, GitHub is back and running...

@keryell
Copy link
Contributor

keryell commented Feb 20, 2020

Please avoid force-pushing, it is difficult to trace the evolution...

@tovinkere
Copy link
Contributor Author

Thanks for the changes.
Here are my comments for today.

Thank you for the exhaustive review. All cosmetic changes have been applied along with the {} initializer. API changes to reduce type casting will be batched together for separate commit.

Copy link
Contributor

@romanovvlad romanovvlad left a comment

Choose a reason for hiding this comment

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

First review.

// Save streams associated with this handler. Streams are then forwarded to
// command group and flushed in the scheduler.
void addStream(std::shared_ptr<detail::stream_impl> s) {
MStreamStorage.push_back(std::move(s));
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, @keryell Could you please point to some docs that say that "s" will be rvalue here?

alexbatashev
alexbatashev previously approved these changes Feb 21, 2020
@alexbatashev alexbatashev self-requested a review February 21, 2020 12:46
@alexbatashev alexbatashev dismissed their stale review February 21, 2020 12:47

That should have been "request changes"

@romanovvlad
Copy link
Contributor

"Resolved" some conversation which seems to be resolved. @keryell please, reopen if I closed something by mistake.
@tovinkere There are several not resolved old comment. Could you please address them as well?

Copy link
Contributor

@keryell keryell left a comment

Choose a reason for hiding this comment

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

Interesting feature!

After having a better view of the project, I think that you tried to adapt the Windows API using some std::wstring to the POSIX world but it seems simpler and more efficient to do the opposite and keep the Windows idiosyncrasies under very local control instead. For some discussion: https://stackoverflow.com/questions/402283/stdwstring-vs-stdstring

@tovinkere
Copy link
Contributor Author

Interesting feature!

After having a better view of the project, I think that you tried to adapt the Windows API using some std::wstring to the POSIX world but it seems simpler and more efficient to do the opposite and keep the Windows idiosyncrasies under very local control instead. For some discussion: https://stackoverflow.com/questions/402283/stdwstring-vs-stdstring

@keryell The std::wstring is primarily used to store wide string paths in the case of Windows with localization. To keep the interface simpe for this, std::wstring was applied to both WIndows and Linux/macOS

Copy link
Contributor

@keryell keryell left a comment

Choose a reason for hiding this comment

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

Great improvement!
The best code we can write is the one we do not write, because there is no bug in it. :-)

Copy link
Contributor

@keryell keryell left a comment

Choose a reason for hiding this comment

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

Almost done!

Copy link
Contributor

@romanovvlad romanovvlad left a comment

Choose a reason for hiding this comment

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

LGTM

keryell
keryell previously approved these changes Mar 4, 2020
Copy link
Contributor

@keryell keryell left a comment

Choose a reason for hiding this comment

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

That looks good.

@romanovvlad
Copy link
Contributor

@tovinkere Please, fix build issue reported by CI.

target_compile_options(xpti PRIVATE ${XPTI_CXX_FLAGS_RELEASE})
endif()
add_library(xptid STATIC ${SOURCES})
target_compile_options(xptid PRIVATE ${XPTI_CXX_FLAGS_DEBUG})
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the correct way to form options for xptid is to do the same things which are done in sycl/source/CMakeLists.txt:132-175. Please, fix in a separate PR.

romanovvlad
romanovvlad previously approved these changes Mar 10, 2020
@romanovvlad
Copy link
Contributor

@tovinkere There are some commits which are not sign-off'ed. This blocks merge, please resolve.
Suggest squashing all the commits.

+ XPTI proxy library to provide entry points into the
  xpti instrumentation framework
+ Header specification of the XPTI framework API calls
+ Documentation describing the changes to SYCL runtime
  available under xpti/doc
+ SYCL runtime instrumentation using XPTI proxy library
  to monitor the creation of the asynchronous task graph
  (nodes and dependencies)
+ Instrumentation of entry points in queue to capture
  the end-user source code locations of calls to submit,
  parallel_for etc.
+ Updates to the CMakeLists.txt to soft enable the XPTI
  instrumentation and linking of the SYCL library with
  the XPTI proxy/stub library
+ Updates to the CI scripts to include XPTI proxy library
  in building along with enabling of the instrumentation
  in the SYCL library

Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
@romanovvlad romanovvlad merged commit 9bf81eb into intel:sycl Mar 10, 2020
@tovinkere tovinkere deleted the xpti_instrumentation branch March 10, 2020 18:05
alexbatashev pushed a commit to alexbatashev/llvm that referenced this pull request Mar 12, 2020
…e_api_test

* origin/sycl:
  [SYCL][NFC] Fix static code analysis concerns (intel#1283)
  [SYCL] Fix the test/basic_tests/buffer/subbuffer.cpp (intel#1277)
  [SYCL][CUDA] Implement the program kernel names query (intel#1248)
  [SYCL] Honor the LLVM_LIBDIR_SUFFIX variable at installation time (intel#1261)
  [SYCL][UX] Diagnostic for undefined device functions (intel#1026)
  [SYCL] Reverse reqd_work_group_size attribute (intel#1234)
  [SYCL] Rename project to oneAPI DPC++ Compiler (intel#1249)
  [SYCL][XPTI] Instrumentation of SYCL runtime with XPTI (intel#1129)
alexbatashev added a commit to alexbatashev/llvm that referenced this pull request Mar 13, 2020
…st_commit

* otcshare/sycl: (469 commits)
  [SYCL] Implement thread-local storage restriction (intel#1281)
  [Driver][SYCL][FPGA] Adjust the output location for the project report (intel#1278)
  [SYCL][NFC] Fix static code analysis concerns (intel#1283)
  [SYCL] Fix the test/basic_tests/buffer/subbuffer.cpp (intel#1277)
  [SYCL][CUDA] Implement the program kernel names query (intel#1248)
  [SYCL] Honor the LLVM_LIBDIR_SUFFIX variable at installation time (intel#1261)
  [SYCL][UX] Diagnostic for undefined device functions (intel#1026)
  [SYCL] Reverse reqd_work_group_size attribute (intel#1234)
  [SYCL] Rename project to oneAPI DPC++ Compiler (intel#1249)
  [SYCL][XPTI] Instrumentation of SYCL runtime with XPTI (intel#1129)
  [SYCL] Add buffer dimensions restriction (intel#1147)
  [SYCL][NFC] Update copyright header in handler files (intel#1271)
  [SYCL][NFC] Format the code with clang-format
  [SYCL][Test] Fix SYCL library location path for LIT tests (intel#1228)
  [SYCL][NFC] Fix doxygen warnings (intel#1270)
  [SYCL][CUDA] Add the CUDA backend to the deploy-sycl-toolchain target (intel#1268)
  [SYCL][NFC] Fix a misleading comment regarding the SYCL flow (intel#1266)
  Change capability for SpecId decoration
  README.md: Mention retrieving llvm archive signatures
  travis: Restore macOS builds
  ...
alexbatashev pushed a commit to alexbatashev/llvm that referenced this pull request Mar 15, 2020
…_accessor_refactor

* origin/sycl: (454 commits)
  [SYCL][NFC] Fix static code analysis concerns (intel#1283)
  [SYCL] Fix the test/basic_tests/buffer/subbuffer.cpp (intel#1277)
  [SYCL][CUDA] Implement the program kernel names query (intel#1248)
  [SYCL] Honor the LLVM_LIBDIR_SUFFIX variable at installation time (intel#1261)
  [SYCL][UX] Diagnostic for undefined device functions (intel#1026)
  [SYCL] Reverse reqd_work_group_size attribute (intel#1234)
  [SYCL] Rename project to oneAPI DPC++ Compiler (intel#1249)
  [SYCL][XPTI] Instrumentation of SYCL runtime with XPTI (intel#1129)
  [SYCL] Add buffer dimensions restriction (intel#1147)
  [SYCL][NFC] Update copyright header in handler files (intel#1271)
  [SYCL][NFC] Format the code with clang-format
  [SYCL][Test] Fix SYCL library location path for LIT tests (intel#1228)
  [SYCL][NFC] Fix doxygen warnings (intel#1270)
  [SYCL][CUDA] Add the CUDA backend to the deploy-sycl-toolchain target (intel#1268)
  Change capability for SpecId decoration
  README.md: Mention retrieving llvm archive signatures
  travis: Restore macOS builds
  Fix DebugInfo creation after LLVM change 7a42bab
  Add more missing mixes
  Add missing fixes
  ...
aelovikov-intel pushed a commit to aelovikov-intel/llvm that referenced this pull request Feb 23, 2023
…ntal status. (intel#1129)

Tests changes for intel#6524

Signed-off-by: Rajiv Deodhar <rajiv.deodhar@intel.com>
Co-authored-by: JackAKirk <jack.kirk@codeplay.com>
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