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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

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
Collaborator

@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
@@ -1857,6 +1857,12 @@ def core_build(
os.path.join(install_dir, "python"),
)

cmake_script.mkdir(os.path.join(install_dir, "python"))
cmake_script.cp(
os.path.join(repo_install_dir, "python", "tritonfrontend*.whl"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this needed? triton*.whl right above this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the catch. Just removed it.

@@ -521,15 +521,21 @@ if(${TRITON_ENABLE_TRACING})
if (NOT WIN32)
target_include_directories(
tracing-library
PRIVATE ${OPENTELEMETRY_CPP_INCLUDE_DIRS}
PUBLIC ${OPENTELEMETRY_CPP_INCLUDE_DIRS}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@fpetrini15 any general wisdom on necessity of PUBLIC vs PRIVATE and why it fixes it? or @KrishnanPrash

Copy link
Contributor

@fpetrini15 fpetrini15 Oct 9, 2024

Choose a reason for hiding this comment

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

IIUC, by specifying tracing-library's dependencies as private, any other targets that depend on tracing-library will not be able to see its dependencies (not inherited)--they will have to link/include them again individually. In this case, it appears that to compile the tracing-library, CMake needs to have access to the open telemetry include directories. From my meetings with @KrishnanPrash, it seems like anything that depends on tracing-library also needs to have access to this directory. In this case, it would make sense to expose this as a public dependency.

Take this with a grain of salt, however, as I am no CMake expert 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changing from PRIVATE to PUBLIC allows the directories to be included with any library that links to the tracing-library, which in this case is py-bindings.

${OPENTELEMETRY_CPP_LIBRARIES})
endif()

set_target_properties(
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this modification still required?

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 the -fPIC flag set to ON, the CMake build process errors out.

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.

py-bindings
PRIVATE ${OPENTELEMETRY_CPP_INCLUDE_DIRS}
PUBLIC ${OPENTELEMETRY_CPP_INCLUDE_DIRS}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this may also be unnecessary now for the same reason as described below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in comment above.

@rmccorm4 rmccorm4 changed the title feat: tritonfrontend support for no/partial endpoint builds build: tritonfrontend support for no/partial endpoint builds Oct 9, 2024
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.

4 participants