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

Custom Doxygen executable to improve Sphinx builds #139

Merged
merged 16 commits into from
Sep 6, 2023

Conversation

MathiasMagnus
Copy link
Contributor

@MathiasMagnus MathiasMagnus commented Jul 24, 2023

This PR improves how Sphinx docs are built, specifically those using rocm-docs-core.

Changes

  • Updates the documentation of rocm_add_sphinx_doc (which even had it's name outdated.
  • Adds more validation of parameters and feedback to users who misuse the function.
  • Adds search of Doxygen executable
    • Defines an opt-in flag USE_DOXYGEN which triggers a poor man's version of REQUIRED for the Doxygen executable. It relays the full path of Doxygen to rocm-docs-core as enabled by this PR.
  • Adds a simple positive test of this function while previously there was none.

Notes

  • The requirements.in will need a change once the dependent PR of rocm-docs-core goes live and receives a tagged version.

Copy link
Collaborator

@lawruble13 lawruble13 left a comment

Choose a reason for hiding this comment

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

Overall this looks okay to me, pending the merge of the noted change to rocm-docs-core. My only concern at present is adding BUILDER as a mandatory argument, I worry that will cause issues for backwards compatibility. I would prefer that this variable have a sane default (perhaps html?), but am open to arguments.

get_filename_component(OUTPUT_DIR "${PARSE_OUTPUT_DIR}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
else()
set(OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/sphinx/${PARSE_BUILDER}")
endif()
Copy link
Collaborator

@lawruble13 lawruble13 Jul 25, 2023

Choose a reason for hiding this comment

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

This also removes some functionality, namely that the cache variables for the output directories of different builders are removed, so that setting these cache variables manually can no longer alter the output directories. I don't know if this functionality is used by anything, but it's worth noting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe worth noting. I saw only 2 projects use this module. Hoping that will change in the future.

The cache variables in the long run have to go. While using ExternalProject excessively to drive the docs super build such that we could have multiple instances of these cache vars (one per project), the end game IMHO should be getting ROCm projects to a state where they are add_subdirectory friendly, at least among themselves and the entire thing (minus LLVM) can be built using one ninja process. If that's not something we're aspiring towards, I could restore the cache variables to how they were, but it will cause conflicts as soon as two documented projects share a build.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I dont know how much this is used, but it is nice to be able to set the OUTPUT_DIR without needing to modify the source files. Maybe you could just do if(DEFINED) check and then use the variable. This shouldn't cause problems for add_subdirectory.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree with the justification on removing the cache variables in the long-term. Paul's suggestion of just checking to see if a variable is defined seems reasonable to me to duplicate the functionality noted while not having collisions. I would also note that collisions could be avoided by adding the project name to the cache variable used, although that definitely leads to other potential usability issues of knowing exactly how that variable should be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please take a look at the current solution driven by ROCM_CMAKE_DOCS_DIR. This was the closest to replicating a possibility of specifying externally an output directory while also keeping it idiomatic CMake (as far as command wrappers can be idiomatic). It tries to mimic globally defined variables that target-props take their default from, such as CMAKE_RUNTIME_OUTPUT_DIRECTORY.

@MathiasMagnus
Copy link
Contributor Author

My only concern at present is adding BUILDER as a mandatory argument, I worry that will cause issues for backwards compatibility. I would prefer that this variable have a sane default (perhaps html?), but am open to arguments.

@lawruble13 BUILDER being mandatory hasn't changed. While the docs suggested it isn't mandatory, the internal logic just assumed it exists. I just clarified it instead of letting it blow up in the users' face.

List of HTML template values passed to Sphinx. List items will be passed as
command-line args by prepending ``-A`` to each item.

``USES_DOXYGEN``
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would prefer it to be imperative: USE_DOXYGEN.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -1,5 +1,5 @@
# ######################################################################################################################
# Copyright (C) 2017 Advanced Micro Devices, Inc.
# Copyright (C) 2023 Advanced Micro Devices, Inc.
Copy link
Member

Choose a reason for hiding this comment

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

2017-2023

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. (been done for a while, just didn't mark here)

@@ -1,7 +1,9 @@
# ######################################################################################################################
# Copyright (C) 2021 Advanced Micro Devices, Inc.
Copy link
Member

Choose a reason for hiding this comment

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

2021-2023

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. (been done for a while, just didn't mark here)

Copy link
Member

@saadrahim saadrahim left a comment

Choose a reason for hiding this comment

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

Minor copyright updates

@MathiasMagnus
Copy link
Contributor Author

@saadrahim Should be okay.

@saadrahim saadrahim changed the title Sphinx improvement Custom Doxygen Executable to improve Sphinx builds Sep 6, 2023
@saadrahim saadrahim changed the title Custom Doxygen Executable to improve Sphinx builds Custom Doxygen executable to improve Sphinx builds Sep 6, 2023
@saadrahim saadrahim merged commit 433d5cb into ROCm:develop Sep 6, 2023
7 checks passed
@pramenku
Copy link

This change is causing MiGraphX failed to compile.

Do we need to install any pre-req @pfultz2 ?

11:18:25 -- MIGraphx is using Find-2.0 API of MIOpen
11:18:25 -- MIGraphx is using Find Mode API of MIOpen
11:18:25 �[91mCMake Error at /opt/rocm/share/rocm/cmake/ROCMSphinxDoc.cmake:10 (find_program):
11:18:25 Could not find SPHINX_EXECUTABLE using the following names: sphinx-build
11:18:25 Call Stack (most recent call first):
11:18:25 docs/CMakeLists.txt:27 (include)
11:18:25

Command to build MigraphX

pip3 install https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz && git clone --depth=1 https://github.com/ROCmSoftwarePlatform/AMDMIGraphX --branch master && cd AMDMIGraphX && rbuild package --cxx /opt/rocm/llvm/bin/clang++ -DGPU_TARGETS="gfx906;gfx908;gfx90a;gfx1030;gfx1100;gfx1101;gfx1102" -d /workspace/AMDMIGraphX/deps -B /workspace/AMDMIGraphX/build'

@pramenku
Copy link

python3 -m pip install sphinx -> After installation, it's passing

But, @pfultz2 has patch #144 which will help us.
Can we get this PR merged in https://github.com/RadeonOpenCompute/rocm-cmake/tree/release-staging/rocm-rel-6.0 branch too so that it will come to 6.0 Mainline.

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.

5 participants