Using add_halide_runtime when compiling with MSVC + GPU support? #9098
|
Hi Halide Developers, I am trying to better understand when I should try to use I have a library ( The error seems to come from here: https://github.com/halide/Halide/blob/main/src/runtime/device_interface.cpp#L170 What ended fixing this error was that in MSVC I had to make my library I tried fixing this by using I am wondering if CMakeLists SnippetsThis worked: This did not work |
Replies: 1 comment 3 replies
|
If any of the AOT libraries is still built without So the important part is that all GPU-using AOT libraries share the same runtime target: add_halide_runtime(my_runtime TARGETS ${Halide_TARGET})
add_halide_library(func1 FROM func1.generator
GENERATOR func1
TARGETS ${Halide_TARGET}
FEATURES cuda
USE_RUNTIME my_runtime
)
add_halide_library(func2 FROM func2.generator
GENERATOR func2
TARGETS ${Halide_TARGET}
FEATURES cuda
USE_RUNTIME my_runtime
)
target_link_libraries(mylib PUBLIC
my_runtime
func1
func2
)Your Also, I would keep |
USE_RUNTIME my_runtimeneeds to be applied to everyadd_halide_library()target that should share the same Halide runtime, not just one of themIf any of the AOT libraries is still built without
USE_RUNTIME, Halide will generate a separate<target>.runtimefor that library. That can leave you with multiple copies of the runtime/device-interface state in the same process, which is a common way to get errors like:So the important part is that all GPU-using AOT libraries share the same runtime target: