-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Makes PyCallable dimension reversing logic consistent with that of PythonExtensionGen #8931
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
jiawen
wants to merge
2
commits into
main
Choose a base branch
from
jiawen-pycallable
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.
+158
−66
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,13 +63,13 @@ We recommend installing CMake using [pipx] to avoid package conflicts and | |
| redundant installations. After installing pipx, run: | ||
|
|
||
| ```shell | ||
| $ pipx install cmake | ||
| pipx install cmake | ||
| ``` | ||
|
|
||
| Alternatively, you can use a normal virtual environment: | ||
|
|
||
| ```shell | ||
| $ python -m pip install cmake | ||
| python -m pip install cmake | ||
| ``` | ||
|
|
||
| If you don't want Python to manage your CMake installation, you can either | ||
|
|
@@ -84,6 +84,7 @@ On Windows, there are two primary methods for installing an up-to-date CMake: | |
|
|
||
| 1. You can get CMake through the Visual Studio 2022 installer. | ||
| 2. You can use Windows's built-in package manager, [winget][winget]: | ||
|
|
||
| ```shell | ||
| winget install Kitware.CMake | ||
| ``` | ||
|
|
@@ -96,7 +97,7 @@ Microsoft's [documentation][vs-cmake-docs] for more details. | |
| [Homebrew] keeps its [CMake package][brew-cmake] up to date. Simply run: | ||
|
|
||
| ```shell | ||
| $ brew install cmake | ||
| brew install cmake | ||
| ``` | ||
|
|
||
| ## Ubuntu Linux | ||
|
|
@@ -219,7 +220,7 @@ To build the documentation, you will need to install [Doxygen]. This can be done | |
| either from the [Doxygen website][doxygen-download] or through [winget][winget]: | ||
|
|
||
| ```shell | ||
| $ winget install DimitriVanHeesch.Doxygen | ||
| winget install DimitriVanHeesch.Doxygen | ||
| ``` | ||
|
|
||
| To build the Python bindings, you will need to install Python 3. This should be | ||
|
|
@@ -234,7 +235,7 @@ Once Python is installed, you can install the Python module dependencies either | |
| globally or in a [virtual environment][venv] by running | ||
|
|
||
| ```shell | ||
| $ python -m pip install -r requirements.txt | ||
| python -m pip install -r requirements.txt | ||
| ``` | ||
|
|
||
| from the root of the repository. | ||
|
|
@@ -244,14 +245,13 @@ from the root of the repository. | |
| On macOS, it is possible to install all dependencies via [Homebrew][homebrew]: | ||
|
|
||
| ```shell | ||
| $ brew install llvm flatbuffers wabt python pybind11 doxygen eigen libpng libjpeg-turbo openblas | ||
| brew install clang-format lld llvm flatbuffers wabt python pybind11 doxygen eigen libpng libjpeg-turbo openblas | ||
| ``` | ||
|
|
||
| The `llvm` package includes `clang`, `clang-format`, and `lld`, too. To ensure | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Homebrew pulled these out long ago. |
||
| CMake can find LLVM, set the following cache variable: | ||
| To ensure that CMake can find LLVM, set the following cache variable: | ||
|
|
||
| ```shell | ||
| $ cmake ... -DHalide_ROOT=/opt/homebrew/opt/llvm | ||
| cmake ... -DHalide_LLVM_ROOT=/opt/homebrew/opt/llvm | ||
| ``` | ||
|
|
||
| Or use the `macOS` CMake preset, which does this for you. | ||
|
|
@@ -275,8 +275,8 @@ dependencies. These are tabulated in `requirements.txt` and may be installed | |
| with: | ||
|
|
||
| ```shell | ||
| $ python -m pip install -U pip "setuptools[core]" wheel | ||
| $ python -m pip install -r requirements.txt | ||
| python -m pip install -U pip "setuptools[core]" wheel | ||
| python -m pip install -r requirements.txt | ||
| ``` | ||
|
|
||
| # Building Halide | ||
|
|
@@ -299,16 +299,16 @@ You should either open the correct Developer Command Prompt directly or run the | |
| following: | ||
|
|
||
| ```shell | ||
| $ "C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 | ||
| $ "C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64_x86 | ||
| $ "C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64_arm | ||
| "C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 | ||
| "C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64_x86 | ||
| "C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64_arm | ||
| ``` | ||
|
|
||
| Then, assuming that vcpkg is installed to `D:\vcpkg`, simply run: | ||
|
|
||
| ```shell | ||
| $ cmake -G Ninja -S . -B build --toolchain D:\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release | ||
| $ cmake --build .\build | ||
| cmake -G Ninja -S . -B build --toolchain D:\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release | ||
| cmake --build .\build | ||
| ``` | ||
|
|
||
| Valid values of [`CMAKE_BUILD_TYPE`][cmake_build_type] are `Debug`, | ||
|
|
@@ -351,8 +351,8 @@ The instructions here are straightforward. Assuming your environment is set up | |
| correctly, just run: | ||
|
|
||
| ```shell | ||
| $ cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Release | ||
| $ cmake --build build | ||
| cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Release | ||
| cmake --build build | ||
| ``` | ||
|
|
||
| If you omit `-G Ninja`, a Makefile-based generator will likely be used instead. | ||
|
|
@@ -368,11 +368,11 @@ convenient. The following CMake preset commands correspond to the longer ones | |
| above. | ||
|
|
||
| ```shell | ||
| $ cmake --preset=win64 # VS 2022 generator, 64-bit build, vcpkg deps | ||
| $ cmake --preset=win32 # VS 2022 generator, 32-bit build, vcpkg deps | ||
| $ cmake --preset=macOS # Ninja generator, macOS host build, Homebrew deps | ||
| $ cmake --preset=debug # Debug mode, any single-config generator / compiler | ||
| $ cmake --preset=release # Release mode, any single-config generator / compiler | ||
| cmake --preset=win64 # VS 2022 generator, 64-bit build, vcpkg deps | ||
| cmake --preset=win32 # VS 2022 generator, 32-bit build, vcpkg deps | ||
| cmake --preset=macOS # Ninja generator, macOS host build, Homebrew deps | ||
| cmake --preset=debug # Debug mode, any single-config generator / compiler | ||
| cmake --preset=release # Release mode, any single-config generator / compiler | ||
| ``` | ||
|
|
||
| ### Vcpkg presets | ||
|
|
@@ -481,15 +481,15 @@ separate project. On any platform, this means running the | |
| single-configuration generator (like Ninja), run either: | ||
|
|
||
| ```shell | ||
| $ cmake --install ./build --prefix /path/to/Halide-install | ||
| $ cmake --install .\build --prefix X:\path\to\Halide-install | ||
| cmake --install ./build --prefix /path/to/Halide-install | ||
| cmake --install .\build --prefix X:\path\to\Halide-install | ||
| ``` | ||
|
|
||
| For a multi-configuration generator (like Visual Studio) run: | ||
|
|
||
| ```shell | ||
| $ cmake --install ./build --prefix /path/to/Halide-install --config Release | ||
| $ cmake --install .\build --prefix X:\path\to\Halide-install --config Release | ||
| cmake --install ./build --prefix /path/to/Halide-install --config Release | ||
| cmake --install .\build --prefix X:\path\to\Halide-install --config Release | ||
| ``` | ||
|
|
||
| Of course, make sure that you build the corresponding config before attempting | ||
|
|
||
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 |
|---|---|---|
|
|
@@ -32,13 +32,6 @@ Halide::Runtime::Buffer<T, Dims, InClassDimStorage> pybufferinfo_to_halidebuffer | |
| return Halide::Runtime::Buffer<T, Dims, InClassDimStorage>(t, info.ptr, (int)info.ndim, dims); | ||
| } | ||
|
|
||
| template<typename T = void, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No longer used. |
||
| int Dims = AnyDims, | ||
| int InClassDimStorage = (Dims == AnyDims ? 4 : std::max(Dims, 1))> | ||
| Halide::Runtime::Buffer<T, Dims, InClassDimStorage> pybuffer_to_halidebuffer(const py::buffer &pyb, bool writable, bool reverse_axes) { | ||
| return pybufferinfo_to_halidebuffer(pyb.request(writable), reverse_axes); | ||
| } | ||
|
|
||
| } // namespace PythonBindings | ||
| } // namespace Halide | ||
|
|
||
|
|
||
Oops, something went wrong.
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.
Sorry for the drive-by. My vs code auto-formatted this entire file - but for the better I think.