Skip to content

Commit 932ad0b

Browse files
authored
Deprecate OpenGLCompute for Halide 16 (#7627)
* Deprecate OpenGLCompute for Halide 16 * clang-format
1 parent 1f5b207 commit 932ad0b

7 files changed

+21
-4
lines changed

src/JITModule.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -762,15 +762,15 @@ enum RuntimeKind {
762762
OpenCL,
763763
Metal,
764764
CUDA,
765-
OpenGLCompute,
765+
OpenGLCompute, // NOTE: this feature is deprecated and will be removed in Halide 17
766766
Hexagon,
767767
D3D12Compute,
768768
Vulkan,
769769
WebGPU,
770770
OpenCLDebug,
771771
MetalDebug,
772772
CUDADebug,
773-
OpenGLComputeDebug,
773+
OpenGLComputeDebug, // NOTE: this feature is deprecated and will be removed in Halide 17
774774
HexagonDebug,
775775
D3D12ComputeDebug,
776776
VulkanDebug,

src/Module.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,10 @@ MetadataNameMap Module::get_metadata_name_map() const {
521521
void Module::compile(const std::map<OutputFileType, std::string> &output_files) const {
522522
validate_outputs(output_files);
523523

524+
if (target().has_feature(Target::OpenGLCompute)) {
525+
user_warning << "WARNING: OpenGLCompute is deprecated in Halide 16 and will be removed in Halide 17.\n";
526+
}
527+
524528
// Minor but worthwhile optimization: if all of the output files are of types that won't
525529
// ever rely on submodules (e.g.: toplevel declarations in C/C++), don't bother resolving
526530
// the submodules, which can call compile_to_buffer().

src/Pipeline.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,10 @@ void Pipeline::realize(JITUserContext *context,
929929
Target target = t;
930930
user_assert(defined()) << "Can't realize an undefined Pipeline\n";
931931

932+
if (t.has_feature(Target::OpenGLCompute)) {
933+
user_warning << "WARNING: OpenGLCompute is deprecated in Halide 16 and will be removed in Halide 17.\n";
934+
}
935+
932936
debug(2) << "Realizing Pipeline for " << target << "\n";
933937

934938
if (target.has_unknowns()) {

src/Target.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ struct Target {
108108
CLDoubles = halide_target_feature_cl_doubles,
109109
CLHalf = halide_target_feature_cl_half,
110110
CLAtomics64 = halide_target_feature_cl_atomic64,
111-
OpenGLCompute = halide_target_feature_openglcompute,
111+
OpenGLCompute = halide_target_feature_openglcompute, // NOTE: This feature is deprecated and will be removed in Halide 17.
112112
EGL = halide_target_feature_egl,
113113
UserContext = halide_target_feature_user_context,
114114
Profile = halide_target_feature_profile,

src/runtime/HalideRuntime.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ typedef enum halide_target_feature_t {
13381338
halide_target_feature_cl_doubles, ///< Enable double support on OpenCL targets
13391339
halide_target_feature_cl_atomic64, ///< Enable 64-bit atomics operations on OpenCL targets
13401340

1341-
halide_target_feature_openglcompute, ///< Enable OpenGL Compute runtime.
1341+
halide_target_feature_openglcompute, ///< Enable OpenGL Compute runtime. NOTE: This feature is deprecated and will be removed in Halide 17.
13421342

13431343
halide_target_feature_user_context, ///< Generated code takes a user_context pointer as first argument
13441344

src/runtime/HalideRuntimeOpenGLCompute.h

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ extern "C" {
1818

1919
#define HALIDE_RUNTIME_OPENGLCOMPUTE
2020

21+
HALIDE_ATTRIBUTE_DEPRECATED("OpenGLCompute is deprecated in Halide 16 and will be removed in Halide 17.")
2122
extern const struct halide_device_interface_t *halide_openglcompute_device_interface();
2223

2324
/** These are forward declared here to allow clients to override the
@@ -27,6 +28,7 @@ extern const struct halide_device_interface_t *halide_openglcompute_device_inter
2728
/** This function sets up OpenGL context, loads relevant GL functions, then
2829
* compiles src OpenGL compute shader into OpenGL program and stores it for future use.
2930
*/
31+
HALIDE_ATTRIBUTE_DEPRECATED("OpenGLCompute is deprecated in Halide 16 and will be removed in Halide 17.")
3032
extern int halide_openglcompute_initialize_kernels(void *user_context, void **state_ptr,
3133
const char *src, int size);
3234

@@ -36,6 +38,7 @@ extern int halide_openglcompute_initialize_kernels(void *user_context, void **st
3638
* This function doesn't wait for the completion of the shader, but it sets memory
3739
* barrier which forces successive retrieval of output data to wait until shader is done.
3840
*/
41+
HALIDE_ATTRIBUTE_DEPRECATED("OpenGLCompute is deprecated in Halide 16 and will be removed in Halide 17.")
3942
extern int halide_openglcompute_run(void *user_context,
4043
void *state_ptr,
4144
const char *entry_name,
@@ -46,6 +49,7 @@ extern int halide_openglcompute_run(void *user_context,
4649
void *args[],
4750
int8_t is_buffer[]);
4851

52+
HALIDE_ATTRIBUTE_DEPRECATED("OpenGLCompute is deprecated in Halide 16 and will be removed in Halide 17.")
4953
extern void halide_openglcompute_finalize_kernels(void *user_context, void *state_ptr);
5054
// @}
5155

@@ -54,13 +58,15 @@ extern void halide_openglcompute_finalize_kernels(void *user_context, void *stat
5458
* You may have to implement this yourself. Halide only provides implementations
5559
* for some platforms."
5660
*/
61+
HALIDE_ATTRIBUTE_DEPRECATED("OpenGLCompute is deprecated in Halide 16 and will be removed in Halide 17.")
5762
extern void *halide_opengl_get_proc_address(void *user_context, const char *name);
5863

5964
/** This function creates an OpenGL context for use by the OpenGL backend.
6065
*
6166
* You may have to implement this yourself as well. Halide only provides
6267
* implementations for some platforms."
6368
*/
69+
HALIDE_ATTRIBUTE_DEPRECATED("OpenGLCompute is deprecated in Halide 16 and will be removed in Halide 17.")
6470
extern int halide_opengl_create_context(void *user_context);
6571

6672
#ifdef __cplusplus

src/runtime/openglcompute.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Ignore deprecation warnings inside our own runtime
2+
#define HALIDE_ALLOW_DEPRECATED 1
3+
14
#include "HalideRuntimeOpenGLCompute.h"
25
#include "device_buffer_utils.h"
36
#include "device_interface.h"

0 commit comments

Comments
 (0)