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

Backport build and stability changes to v13 #6533

Merged
merged 15 commits into from
Jan 6, 2022
Merged

Conversation

LebedevRI and others added 11 commits January 4, 2022 15:56
https://buildd.debian.org/status/fetch.php?pkg=halide&arch=riscv64&ver=13.0.2-1&stamp=1639833165&raw=0

```
[1283/3260] /usr/bin/clang++-13 -DHALIDE_ENABLE_RTTI -DHALIDE_WITH_EXCEPTIONS -DHalide_EXPORTS -DLLVM_VERSION=130 -DWITH_AARCH64 -DWITH_AMDGPU -DWITH_ARM -DWITH_D3D12 -DWITH_HEXAGON -DWITH_INTROSPECTION -DWITH_METAL -DWITH_MIPS -DWITH_NVPTX -DWITH_OPENCL -DWITH_OPENGLCOMPUTE -DWITH_POWERPC -DWITH_RISCV -DWITH_WEBASSEMBLY -DWITH_X86 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/usr/lib/llvm-13/include -g -O3 -DNDEBUG -fPIC -Wall -Wcast-qual -Wignored-qualifiers -Woverloaded-virtual -Winconsistent-missing-destructor-override -Winconsistent-missing-override -Wno-deprecated-declarations -Wno-double-promotion -Wno-float-conversion -Wno-float-equal -Wno-missing-field-initializers -Wno-old-style-cast -Wno-shadow -Wno-sign-conversion -Wno-switch-enum -Wno-undef -Wno-unused-function -Wno-unused-macros -Wno-unused-parameter -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-cast-align -Wno-comma -Wno-covered-switch-default -Wno-documentation-unknown-command -Wno-documentation -Wno-exit-time-destructors -Wno-global-constructors -Wno-implicit-float-conversion -Wno-implicit-int-conversion -Wno-implicit-int-float-conversion -Wno-missing-prototypes -Wno-nonportable-system-include-path -Wno-reserved-id-macro -Wno-return-std-move-in-c++11 -Wno-shadow-field-in-constructor -Wno-shadow-field -Wno-shorten-64-to-32 -Wno-undefined-func-template -Wno-unused-member-function -Wno-unused-template -pthread -std=c++17 -MD -MT src/CMakeFiles/Halide.dir/Target.cpp.o -MF src/CMakeFiles/Halide.dir/Target.cpp.o.d -o src/CMakeFiles/Halide.dir/Target.cpp.o -c /<<PKGBUILDDIR>>/src/Target.cpp
FAILED: src/CMakeFiles/Halide.dir/Target.cpp.o
/usr/bin/clang++-13 -DHALIDE_ENABLE_RTTI -DHALIDE_WITH_EXCEPTIONS -DHalide_EXPORTS -DLLVM_VERSION=130 -DWITH_AARCH64 -DWITH_AMDGPU -DWITH_ARM -DWITH_D3D12 -DWITH_HEXAGON -DWITH_INTROSPECTION -DWITH_METAL -DWITH_MIPS -DWITH_NVPTX -DWITH_OPENCL -DWITH_OPENGLCOMPUTE -DWITH_POWERPC -DWITH_RISCV -DWITH_WEBASSEMBLY -DWITH_X86 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/usr/lib/llvm-13/include -g -O3 -DNDEBUG -fPIC -Wall -Wcast-qual -Wignored-qualifiers -Woverloaded-virtual -Winconsistent-missing-destructor-override -Winconsistent-missing-override -Wno-deprecated-declarations -Wno-double-promotion -Wno-float-conversion -Wno-float-equal -Wno-missing-field-initializers -Wno-old-style-cast -Wno-shadow -Wno-sign-conversion -Wno-switch-enum -Wno-undef -Wno-unused-function -Wno-unused-macros -Wno-unused-parameter -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-cast-align -Wno-comma -Wno-covered-switch-default -Wno-documentation-unknown-command -Wno-documentation -Wno-exit-time-destructors -Wno-global-constructors -Wno-implicit-float-conversion -Wno-implicit-int-conversion -Wno-implicit-int-float-conversion -Wno-missing-prototypes -Wno-nonportable-system-include-path -Wno-reserved-id-macro -Wno-return-std-move-in-c++11 -Wno-shadow-field-in-constructor -Wno-shadow-field -Wno-shorten-64-to-32 -Wno-undefined-func-template -Wno-unused-member-function -Wno-unused-template -pthread -std=c++17 -MD -MT src/CMakeFiles/Halide.dir/Target.cpp.o -MF src/CMakeFiles/Halide.dir/Target.cpp.o.d -o src/CMakeFiles/Halide.dir/Target.cpp.o -c /<<PKGBUILDDIR>>/src/Target.cpp
warning: unknown warning option '-Wno-return-std-move-in-c++11' [-Wunknown-warning-option]
/<<PKGBUILDDIR>>/src/Target.cpp:114:5: error: use of undeclared identifier 'cpuid'
    cpuid(info, 1, 0);
    ^
/<<PKGBUILDDIR>>/src/Target.cpp:148:9: error: use of undeclared identifier 'cpuid'
        cpuid(info2, 7, 0);
        ^
/<<PKGBUILDDIR>>/src/Target.cpp:181:17: error: use of undeclared identifier 'cpuid'
                cpuid(info3, 7, 1);
                ^
1 warning and 3 errors generated.
```
... which doesn't make sense because that code is supposed to only compile
for X86. But that is because RISCV header guard is wrong,
https://github.com/riscv-non-isa/riscv-toolchain-conventions
says:
```
C/C++ preprocessor definitions
* __riscv: defined for any RISC-V target. Older versions of the GCC toolchain defined __riscv__.
```

(cherry picked from commit b0f4681)
* Fix a missing case in clamp_unsafe_accesses

* Don't check func_value_bounds of images

(cherry picked from commit e7f655b)
As discussed in #6518,
this is a bit dubious, and e.g. prevents building on RISC-V,
because there is no way to not build autoschedulers currently.

(cherry picked from commit 6ed65ba)
Without this, cmake fails with:
```
CMake Error in dependencies/llvm/CMakeLists.txt:
  Target "Halide_LLVM" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "/repositories/halide/dependencies/llvm/"

  which is prefixed in the source directory.
```

`LLVM_INCLUDE_DIRS` there is `/repositories/llvm-project/llvm/include;/builddirs/llvm-project/build-Clang13/include`,
and `INTERFACE_INCLUDE_DIRECTORIES`'s property beforehand is `` (empty),
but after this line it suddenly becomes `/repositories/halide/dependencies/llvm/$<BUILD_INTERFACE:/repositories/llvm-project/llvm/include;/builddirs/llvm-project/build-Clang13/include>`.

This is quite obscure. I don't really understand what is going on,
but with the patch it builds fine.

(cherry picked from commit 9a530b1)
Some decref-triggered runtime methods need the shape

Fixes #6509

Co-authored-by: Steven Johnson <srj@google.com>
(cherry picked from commit 5c33902)
Somehow, initially i missed that there was MSan support,
so it might be good to actually mention that we don't need to run
any MSan passes here, and that we didn't forget to run them.

Secondly, it seems inconsistent not annotate the functions
with `Attribute::SanitizeMemory`, like we do for others.

I suppose it isn't strictly required, since they are used
to actually drive the instrumentation passes, and we don't
run MSan pass, but they are also used to disable some LLVM optimizations,
and that //might// be important. Or not, but then i suppose
there should be a comment about it?

Co-authored-by: Steven Johnson <srj@google.com>
(cherry picked from commit 7eb9949)
* Install Python tutorials

I know we have previously discussed that `TYPE DOC` should be used,
but unfortunately i'm not sure that will work here,
because doc/tutorial directory is already occupied by C++ tutorials,
and i don't think they should be mixed.
I'm open to alternative suggestions.

(cherry picked from commit bce2ef4)
* Fix Python GIL lock handling (Fixes #6524, Fixes #5631)

As disscussed in #6523 (comment)
and later in #6524,
pybind11 v2.8.1 added some defensive checks that fail for halide,
namely in `python_tutorial_lesson_04_debugging_2`
and `python_tutorial_lesson_05_scheduling_1`.

#6524 (comment) notes:
> * Python calls a Halide-JIT-generated function , which runs with the GIL held.
> * Halide runtime spawns worker threads.
> * The worker threads try to call pybind11's py::print function to emit traces.
> * Pybind11 complains, correctly, that the worker thread doesn't hold the GIL.
>
> Trying to acquire the GIL hangs, because the main thread is still holding it. I tried teaching the main thread to release the GIL (as suggested in #5631), but I still saw hangs when I tried this.

I have tried, and just dropping the lock before calling into halide,
or just acquiring it in `halide_python_print` doesn't work,
we need to do both.

I have verified that the two tests fail without this fix,
and pass with it.

(cherry picked from commit b8eb22d)
@LebedevRI
Copy link
Contributor

Thanks!

steven-johnson and others added 4 commits January 5, 2022 13:50
Compilers with `-Werror` will fail with `error: moving a temporary object prevents copy elision`

(cherry picked from commit f8459da)
Debian and other third-party packagers might need or want
to patch our sources for a variety of reasons. In those
cases, they might also need to override the SOVERSION.

See here for a practical example:

https://salsa.debian.org/pkg-llvm-team/halide/-/blob/f881de70cd83095053e13047b63f61faf6bc7a36/debian/patches/0006-Fixup-libhalide-version-soversion-for-debian-package.patch
(cherry picked from commit 7bb8198)
* Allow third parties to externally override SOVERSION

Debian and other third-party packagers might need or want
to patch our sources for a variety of reasons. In those
cases, they might also need to override the SOVERSION.

See here for a practical example:

https://salsa.debian.org/pkg-llvm-team/halide/-/blob/f881de70cd83095053e13047b63f61faf6bc7a36/debian/patches/0006-Fixup-libhalide-version-soversion-for-debian-package.patch

* Update CMake documentation.

* Fix typo

* Add link to ToC

(cherry picked from commit 95737be)
@alexreinking alexreinking merged commit 6fb22ae into release/13.x Jan 6, 2022
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