Revision 94ad5427ad1ecd9480e41418ccfff21169486524 authored by Steven Johnson on 13 March 2023, 18:16:04 UTC, committed by Steven Johnson on 13 March 2023, 18:16:04 UTC
- printer.h uses `uint64_t`, so it needs to include something that ensures that type is defined. `HalideRuntime.h` is probably the right choice (since it always transitively includes `runtime_internal.h` when compiling runtime.

- HalideBuffer.h should completely elide itself when `COMPILING_HALIDE_RUNTIME` is defined, for a subtle reason: some compilation environments require that all .h files can be compiled 'standalone' -- ie, they include all prerequisites and can be included in any order. As it turns out, HalideBuffer.h has a previously unnoticed glitch that is now being caught by this:
    - It includes both `<cstring>` and `HalideRuntime.h`
    - but when `COMPILING_HALIDE_RUNTIME` is defined, `HalideRuntime.h` includes `runtime_internal.h`, which assumes that no std headers are included
    - as it happens, `runtime_internal.h` defines `strstr()` and `strchr()` in a way that doesn't match the std headers (they both return non-const `char *`, perversely enough) and we get a compile error for mismatched function prototypes

I think the neatest solution here is to just skip the entire contents of `HalideBuffer.h` in this situation, since none of its contents should ever be used inside the Halide runtime. (I could work around this situation on the google side by loosening the 'must be able to compile on its own' requirement in this case, but IMHO it's a good check and one that is worthy of keeping.)

The fact that our function prototypes are a mismatch for the 'correct' ones could be debated; IMHO our 'wrong' definitions are safer that the std and should be kept.
1 parent 78097a7
Raw File
.gitignore
# NOTE: one can debug these rules with the following commands:
#
# $ git clean -ffdx
# $ find . -not -path './.git/*' | git check-ignore --stdin --no-index
#
# The first command will delete all files that are ignored by Git (be warned!).
# The second command will print all files that are checked in, but _would be_
# ignored under the rules in this file. Such files should either be explicitly
# added to the exclusions at the bottom of this file, or the rule excluding them
# should be refined.

################################################################################
## Exclude files without extensions

*
!*.*
!*/

################################################################################
## Halide-specific exclusions

# Images only allowed in apps and directories named "images"
*.png
!apps/**/*.png
!**/images/**/*.png

# Pre-trained weights only allowed in autoscheduler directories
*.weights
!src/autoschedulers/**/*.weights

################################################################################
## Halide-specific build artifacts

# Apps
apps/*/*.def
apps/*/*.ptx
apps/*/*.sass
apps/*/*out*.png
apps/*/filter
apps/*/passes.txt
apps/HelloAndroidGL/jni/halide_gl_filter.h

# Autoschedulers
**/src/autoschedulers/adams2019/baseline.cpp
**/src/autoschedulers/adams2019/cost_model.h
**/src/autoschedulers/adams2019/demo.h
**/src/autoschedulers/adams2019/included_schedule_file.h
**/src/autoschedulers/adams2019/train_cost_model.h
**/src/autoschedulers/li2018/demo_gradient.h

# CMake configuration
Halide-*-deps.cmake

# Distribution headers
**/include/Halide*.h
**/include/wasm-rt*.h

# Generator executables
*.generator

# Generator outputs
*.bc
*.featurization
*.halide_compiler_log
*.halide_generated.cpp
*.ll
*.py.cpp
*.pytorch.h
*.registration.cpp
*.s
*.schedule.h
*.stmt
*.stmt.html
*.stub.h

# Linker scripts
py_*.ldscript*

# Runtime modules
_initmod*.cpp

# Tests
**/python_bindings/correctness/generators/*.h
**/test/generator/*.h
**/test/generator/external_code_extern_bitcode_32.cpp
**/test/generator/external_code_extern_bitcode_64.cpp
**/test/generator/external_code_extern_cpp_source.cpp
compile_log.txt
stderr.txt
stdout.txt

# Tutorials
**/tutorial/auto_schedule_false.h
**/tutorial/auto_schedule_true.h
**/tutorial/brighten_either.h
**/tutorial/brighten_interleaved.h
**/tutorial/brighten_planar.h
**/tutorial/brighten_specialized.h
**/tutorial/lesson_10_halide.h
**/tutorial/my_first_generator_win32.h
**/tutorial/my_first_generator.h
**/tutorial/my_second_generator_1.h
**/tutorial/my_second_generator_2.h
**/tutorial/my_second_generator_3.h

# Tutorial images that were copied to the install tree
**/tutorial/images/
!tutorial/images/

################################################################################
## Common build artifacts

# Directories
bin/
distrib/
lib/
lib64/
share/

# Binaries
*.a
*.cubin
*.dll
*.dylib
*.exe
*.lib
*.o
*.obj
*.so
*.so.*
a.out

# Compiler intermediates / debugging info
*.[ip]db
*.[pg]ch
*.d
*.dSYM

# Package files
*.deb
*.tar.gz
*.tgz
*.zip

################################################################################
## Temporary and swap files

temp/
tmp/

.*.swp
.\#*
.DS_Store
*.log
*.tmp
*.txt.user*
*~
\#*\#

################################################################################
## Python

# Common virtual environment directory names
.venv/
venv/

# Python binary caches
__pycache__
*.py[cod]

# Python package build artifacts
*.egg-info/
*.whl
MANIFEST.in
dist/

################################################################################
## CMake

# User-specific configuration files
CMakeUserPresets.json

# Common build directory names
build*/
cmake[-_]build*/

# Generated config files
*-config-version.cmake
*-config.cmake
*Config.cmake
*ConfigVersion.cmake

# Build directory contents
_deps/
.cmake/
cmake_install.cmake
CMakeCache.txt
CMakeFiles/
compile_commands.json
CPack*.cmake
CTest*.cmake
CTest*.txt
install_manifest.txt

# Ninja files
*.ninja*

################################################################################
## IDE directories and metadata

# Visual Studio
.vs/
out/

CMakeSettings.json

# XCode
*.xcworkspacedata
tools/objc/*.mobileprovision
tools/objc/BUILD
xcuserdata

# CLion
.idea/

# VSCode
.vscode/

# TextMate
.tm_properties

# Sublime Text
.tags
.tags_sorted_by_file
*.sublime-*

# Vim
.clang_complete

# Emacs
tags
TAGS

################################################################################
## Halide-specific rule overrides

# Allow particular extension-less files
!gradlew
!Makefile
!packaging/ubuntu/changelog
!packaging/ubuntu/copyright
!packaging/ubuntu/triggers

# Allow XCode PCHs in the HelloiOS app
!apps/HelloiOS/**/*-Prefix.pch

# Allow the runtime to have handwritten LLVM modules
!src/runtime/*.ll

# Allow precompiled Nvidia bitcode
!src/runtime/nvidia_libdevice_bitcode/*.bc

# Anything goes in the hexagon_remote binaries
!src/runtime/hexagon_remote/**/*

# TODO: should this be checked in?
!src/autoschedulers/adams2019/included_schedule_file.schedule.h

# TODO: these should become .cmake.in
!packaging/common/HalideConfig.cmake
!packaging/common/HalideHelpersConfig.cmake
back to top