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

build: tritonfrontend support for no/partial endpoint builds #7605

Merged
merged 20 commits into from
Oct 18, 2024

Conversation

KrishnanPrash
Copy link
Contributor

@KrishnanPrash KrishnanPrash commented Sep 6, 2024

What does the PR do?

Currently, for the tritonfrontend python package only works for builds where all the supported endpoints are enabled. And for builds with partial endpoints enabled, the building of the tritonfrontend wheel is skipped.

This PR is meant to add support for partial endpoint builds for tritonfrontend. With these changes, tritonfrontend wheel will build in all cases and match the functionality of the tritonserver binary.

Checklist

  • PR title reflects the change and is of format <commit_type>: <Title>
  • Changes are described in the pull request.
  • Related issues are referenced.
  • Populated github labels field
  • Added test plan and verified test passes.
  • Verified that the PR passes existing CI.
  • Verified copyright is correct on all changed files.
  • Added succinct git squash message before merging ref.
  • All template sections are filled out.
  • Optional: Additional screenshots for behavior/output changes with before/after.

Commit Type:

Check the conventional commit type
box here and add the label to the github PR.

  • build
  • ci
  • docs
  • feat
  • fix
  • perf
  • refactor
  • revert
  • style
  • test

Where should the reviewer start?

src/python/tritonfrontend/_c/tritonfrontend_pybind.cc restricts portions of C++ code that is binded.
src/python/tritonfrontend/_api/__init__.py restricts which python apis are included in the tritonfrontend wheel.
build.py changes allow for wheel to be tested in CI

Test plan:

Added testing for tritonfrontend to variant builds test.

  • CI Pipeline ID: 19165151

@KrishnanPrash KrishnanPrash added the PR: feat A new feature label Sep 6, 2024
src/python/tritonfrontend/__init__.py Fixed Show resolved Hide resolved
src/python/tritonfrontend/_api/__init__.py Fixed Show fixed Hide fixed
src/python/tritonfrontend/_api/__init__.py Fixed Show resolved Hide resolved
Copy link
Contributor

@rmccorm4 rmccorm4 left a comment

Choose a reason for hiding this comment

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

Resolve CodeQL warnings

@rmccorm4 rmccorm4 marked this pull request as draft September 25, 2024 17:25
src/python/CMakeLists.txt Outdated Show resolved Hide resolved
@KrishnanPrash KrishnanPrash marked this pull request as ready for review October 9, 2024 16:21
build.py Outdated Show resolved Hide resolved
target_link_libraries(
py-bindings
PUBLIC
${OPENTELEMETRY_CPP_LIBRARIES}
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that these libs are exposed publicly by the tracing-library that is already linked to the py-bindings target, do we need to do it again here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without linking and including these libraries/directories to py-bindings, the build fail which points to the src/CMakeLists.txt linking change from PRIVATE to PUBLIC not having the intended consequence. Hence, will revert the src/CMakeLists.txt level changes and keep these link/include operations.

Copy link
Contributor

Choose a reason for hiding this comment

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

But how can maintarget don't need handling like this? Isn't main and py-bindings conceptually the same in terms of compilation and linking?

Copy link
Contributor Author

@KrishnanPrash KrishnanPrash Oct 14, 2024

Choose a reason for hiding this comment

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

Thank you for the suggestion. The new handling of tracing-library requires only linking py-bindings to tracing-library without including/linking any opentelemetry directories or libraries directly to py-bindings.

The fix was to link tracing-library "as is" and not link $<TARGET_OBJECTS:tracing-library> because linking the latter will not propagate the link interface of tracing-library when linked with the final library.

@rmccorm4 rmccorm4 changed the title feat: tritonfrontend support for no/partial endpoint builds build: tritonfrontend support for no/partial endpoint builds Oct 9, 2024
src/CMakeLists.txt Show resolved Hide resolved
@@ -96,13 +94,10 @@ endif()

if(${TRITON_ENABLE_TRACING})
message("TRACING/STATS IS CURRENTLY NOT SUPPORTED.")
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand this part, if not supported, then why introducing the dependency?

Copy link
Contributor Author

@KrishnanPrash KrishnanPrash Oct 10, 2024

Choose a reason for hiding this comment

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

Currently, when building through build.py or cmake, tracing can be enabled in the build. From my understanding, this means that tracing-library (tracer.h) will get built with the #ifdef TRITON_ENABLE_TRACING sections included. Hence, when http-endpoint-library or grpc-endpoint-library include tracer.h (here and here) it will look for the tracing dependencies that tracer.h requires.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hence, when http-endpoint-library or grpc-endpoint-library include tracer.h (here and here) it will look for the tracing dependencies that tracer.h requires.

Then shouldn't tracing-library be added as http-endpoint-library / grpc-endpoint-library's dependencies?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this would be a good change. Currently instead of linking the tracing-library, we do something along the lines of:
http_server.h

...
#include "tracer.h"
...

and in CMakeList.txt to handle the dependencies we do:

target_include_directories(
      http-endpoint-library
      PRIVATE ${OPENTELEMETRY_CPP_INCLUDE_DIRS}
    )

But now that we are changing the tracing-library links/includes to be public, I replaced:

target_include_directories(
main/http-endpoint-library/grpc-endpoint-library
PRIVATE 
${OPENTELEMETRY_CPP_INCLUDE_DIRS})

with this:

target_link_libraries(
main/http-endpoint-library/grpc-endpoint-library
PRIVATE
tracing-library)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With assistance from @fpetrini15, I was able to verify that these changes work with the windows build as well.
CI Pipeline ID: 19374177

Copy link
Contributor

@rmccorm4 rmccorm4 left a comment

Choose a reason for hiding this comment

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

LGTM, but defer to Guan/Francesco

GuanLuo
GuanLuo previously approved these changes Oct 16, 2024
Copy link
Contributor

@GuanLuo GuanLuo left a comment

Choose a reason for hiding this comment

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

Left comments, approve to unblock

src/python/tritonfrontend/CMakeLists.txt Outdated Show resolved Hide resolved
src/python/tritonfrontend/CMakeLists.txt Outdated Show resolved Hide resolved
@KrishnanPrash KrishnanPrash merged commit 8494c18 into main Oct 18, 2024
3 checks passed
@KrishnanPrash KrishnanPrash deleted the kprashanth-conditional-endpoints branch October 18, 2024 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: feat A new feature
Development

Successfully merging this pull request may close these issues.

5 participants