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

Deprecate OpenGLCompute for Halide 16 #7627

Merged
merged 2 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/JITModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,15 +762,15 @@ enum RuntimeKind {
OpenCL,
Metal,
CUDA,
OpenGLCompute,
OpenGLCompute, // NOTE: this feature is deprecated and will be removed in Halide 17
Hexagon,
D3D12Compute,
Vulkan,
WebGPU,
OpenCLDebug,
MetalDebug,
CUDADebug,
OpenGLComputeDebug,
OpenGLComputeDebug, // NOTE: this feature is deprecated and will be removed in Halide 17
HexagonDebug,
D3D12ComputeDebug,
VulkanDebug,
Expand Down
4 changes: 4 additions & 0 deletions src/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,10 @@ MetadataNameMap Module::get_metadata_name_map() const {
void Module::compile(const std::map<OutputFileType, std::string> &output_files) const {
validate_outputs(output_files);

if (target().has_feature(Target::OpenGLCompute)) {
user_warning << "WARNING: OpenGLCompute is deprecated in Halide 16 and will be removed in Halide 17.\n";
}

// Minor but worthwhile optimization: if all of the output files are of types that won't
// ever rely on submodules (e.g.: toplevel declarations in C/C++), don't bother resolving
// the submodules, which can call compile_to_buffer().
Expand Down
4 changes: 4 additions & 0 deletions src/Pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,10 @@ void Pipeline::realize(JITUserContext *context,
Target target = t;
user_assert(defined()) << "Can't realize an undefined Pipeline\n";

if (t.has_feature(Target::OpenGLCompute)) {
user_warning << "WARNING: OpenGLCompute is deprecated in Halide 16 and will be removed in Halide 17.\n";
}

debug(2) << "Realizing Pipeline for " << target << "\n";

if (target.has_unknowns()) {
Expand Down
2 changes: 1 addition & 1 deletion src/Target.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ struct Target {
CLDoubles = halide_target_feature_cl_doubles,
CLHalf = halide_target_feature_cl_half,
CLAtomics64 = halide_target_feature_cl_atomic64,
OpenGLCompute = halide_target_feature_openglcompute,
OpenGLCompute = halide_target_feature_openglcompute, // NOTE: This feature is deprecated and will be removed in Halide 17.
EGL = halide_target_feature_egl,
UserContext = halide_target_feature_user_context,
Profile = halide_target_feature_profile,
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/HalideRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ typedef enum halide_target_feature_t {
halide_target_feature_cl_doubles, ///< Enable double support on OpenCL targets
halide_target_feature_cl_atomic64, ///< Enable 64-bit atomics operations on OpenCL targets

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

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

Expand Down
6 changes: 6 additions & 0 deletions src/runtime/HalideRuntimeOpenGLCompute.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ extern "C" {

#define HALIDE_RUNTIME_OPENGLCOMPUTE

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

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

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

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

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

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

#ifdef __cplusplus
Expand Down
3 changes: 3 additions & 0 deletions src/runtime/openglcompute.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Ignore deprecation warnings inside our own runtime
#define HALIDE_ALLOW_DEPRECATED 1

#include "HalideRuntimeOpenGLCompute.h"
#include "device_buffer_utils.h"
#include "device_interface.h"
Expand Down