Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 21 additions & 67 deletions master/master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ class HalideBuilder(BuilderConfig):

return None

def cmake_preset(self):
if self.sanitizer:
return self.sanitizer_preset()
os_name = {"linux": "linux", "osx": "macos", "windows": "windows"}[self.os]
return f"ci-{os_name}-{self.arch}-{self.bits}"

def handles_hexagon(self):
return self.arch == "x86" and self.os == "linux" and self.llvm_branch == LLVM_MAIN

Expand Down Expand Up @@ -405,27 +411,11 @@ def get_msvc_config_steps(factory, builder_type):


def get_cmake_options(builder_type, build_dir):
options = []

if builder_type.sanitizer:
assert builder_type.handles_sanitizers()
options.append(f"--preset={builder_type.sanitizer_preset()}")
# append *after* preset so we override the build dir
options += ["-B", build_dir]

return options
return [f"--preset={builder_type.cmake_preset()}", "-B", build_dir]


def get_ctest_options(builder_type):
if builder_type.sanitizer:
assert builder_type.handles_sanitizers()
# No, this won't work, see https://gitlab.kitware.com/cmake/cmake/-/issues/23982 --
# fortunately, we don't need to specify the current sanitizer toolchains
# at test time (just at configure time).
# return {'preset': builder_type.sanitizer_preset(), 'test_dir': build_dir}
return {"build_config": builder_type.sanitizer_preset()}

return {"build_config": "Release"}
return {"build_config": "RelWithDebInfo"}


def get_cmake_definitions(builder_type, halide_target="host", wasm_jit="wabt", extra_cmake_defs=None):
Expand All @@ -436,29 +426,17 @@ def get_cmake_definitions(builder_type, halide_target="host", wasm_jit="wabt", e
"CMAKE_INSTALL_PREFIX": get_install_path(builder_type),
"Halide_LLVM_ROOT": Property("HALIDE_LLVM_ROOT"),
"Halide_TARGET": halide_target,
"WITH_PYTHON_BINDINGS": "ON" if builder_type.handles_python() else "OFF",
"WITH_TEST_FUZZ": "ON" if builder_type.sanitizer == "fuzzer" else "OFF",
**extra_cmake_defs,
}

if builder_type.sanitizer and builder_type.handles_sanitizers():
# The sanitizer toolchain files reference ${LLVM_ROOT} for the compiler paths.
cmake_definitions["LLVM_ROOT"] = Property("HALIDE_LLVM_ROOT")
else:
cmake_definitions["CMAKE_BUILD_TYPE"] = "Release"

# Sanitizer builds intermittently fail when using CCache for reasons that aren't
# clear ("precompiled header modified") -- for now, just ignore CCache for them
if builder_type.has_ccache() and not builder_type.sanitizer_preset():
if builder_type.has_ccache():
cmake_definitions["Halide_CCACHE_BUILD"] = "ON"

cmake_definitions["CMAKE_TOOLCHAIN_FILE"] = Interpolate("%(prop:VCPKG_ROOT)s/scripts/buildsystems/vcpkg.cmake")

if builder_type.os == "windows":
# CMake on Windows can't reliably find our pip-installed PyBind11 unless we set pybind11_ROOT to point to it
cmake_definitions["pybind11_ROOT"] = Property("VIRTUAL_ENV")

# Don't bother with anything Python-related if we are targeting WebAssembly.
if "wasm" in halide_target:
cmake_definitions["WITH_PYTHON_BINDINGS"] = "OFF"

Expand Down Expand Up @@ -540,20 +518,9 @@ def add_env_setup_step(factory, builder_type):
# do this first because the SetPropertyFromCommand step isn't smart enough to merge
get_msvc_config_steps(factory, builder_type)

if builder_type.os == "linux":
cc = "gcc-9"
cxx = "g++-9"
elif builder_type.os == "windows":
cxx = "cl.exe"
cc = "cl.exe"
else:
cxx = "c++"
cc = "cc"

env: dict[str, Renderable] = {
"CC": cc,
"CXX": cxx,
"LD": "ld",
"VCPKG_INSTALLATION_ROOT": Property("VCPKG_INSTALLATION_ROOT"),
"UV_PROJECT_ENVIRONMENT": get_builddir_subpath(".venv"),
}

factory.addStep(
Expand Down Expand Up @@ -587,22 +554,6 @@ def add_env_setup_step(factory, builder_type):
# This will have no effect on CPU testing, just Metal testing
env["METAL_DEVICE_WRAPPER_TYPE"] = "1"

env["VCPKG_ROOT"] = Property("VCPKG_ROOT")
env["VCPKG_OVERLAY_PORTS"] = get_source_path("cmake/vcpkg")
env["VCPKG_MANIFEST_FEATURES"] = "developer"

if builder_type.os == "windows":
# Current NVidia drivers on our Windows buildbots can corrupt their own
# cache, leading to many spurious failures. Disable the cache
# for now, pending NVidia investigation.
env["CUDA_CACHE_DISABLE"] = "1"

# We don't ever want an Abort, Retry, Ignore dialog in our tests
env["HL_DISABLE_WINDOWS_ABORT_DIALOG"] = "1"

# UV virtual environments should not pollute the source directory
env["UV_PROJECT_ENVIRONMENT"] = get_builddir_subpath(".venv")

# Leaving this here (but commented out) in case we need to temporarily
# disable leak-checking in the future.
#
Expand Down Expand Up @@ -661,8 +612,8 @@ def add_vcpkg_step(factory, builder_type):

factory.addStep(
SetProperties(
name="Set VCPKG_ROOT",
properties={"VCPKG_ROOT": vcpkg_dir},
name="Set VCPKG_INSTALLATION_ROOT",
properties={"VCPKG_INSTALLATION_ROOT": vcpkg_dir},
)
)

Expand Down Expand Up @@ -716,7 +667,6 @@ def add_build_steps(factory, builder_type):
workdir=build_dir,
env=Property("env"),
path=source_dir,
generator="Ninja",
definitions=get_cmake_definitions(builder_type),
options=get_cmake_options(builder_type, build_dir),
)
Expand Down Expand Up @@ -936,7 +886,6 @@ def add_test_steps(factory, builder_type):
env=env,
workdir=build_dir,
path=source_dir,
generator="Ninja",
definitions=cmake_defs,
options=get_cmake_options(builder_type, build_dir),
)
Expand Down Expand Up @@ -1036,8 +985,14 @@ def add_test_steps(factory, builder_type):
apps_source_dir = get_source_path("apps")

# We currently don't attempt to build any of the apps with wasm
apps_cmake_defs = get_cmake_definitions(builder_type, halide_target=halide_target)
apps_cmake_defs["CMAKE_PREFIX_PATH"] = get_install_path(builder_type)
apps_cmake_defs: dict[str, Renderable] = {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"CMAKE_PREFIX_PATH": get_install_path(builder_type),
"CMAKE_TOOLCHAIN_FILE": Interpolate(
"%(prop:VCPKG_INSTALLATION_ROOT)s/scripts/buildsystems/vcpkg.cmake"
),
"Halide_TARGET": halide_target,
}

# apps/hannk is expensive to build and doesn't (yet) build on all systems, so special-case it here
want_hannk = builder_type.has_tflite() and not halide_target.startswith("wasm-")
Expand All @@ -1058,7 +1013,6 @@ def add_test_steps(factory, builder_type):
path=apps_source_dir,
generator="Ninja",
definitions=apps_cmake_defs,
options=get_cmake_options(builder_type, build_dir),
)
)

Expand Down