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

Remove OpenGL support (part 1) #5626

Merged
merged 13 commits into from
Jan 12, 2021
Merged

Remove OpenGL support (part 1) #5626

merged 13 commits into from
Jan 12, 2021

Conversation

steven-johnson
Copy link
Contributor

Fixes #5475

This removes the OpenGL backend (but not the OpenGLCompute backend) from public use:

  • Remove Target::OpenGL
  • remove DeviceAPI::GLSL
  • remove Func::glsl() and Func::shader()
  • remove all OpenGL-specific apps and tests
  • remove HalideRuntimeOpenGL.h
  • remove some internal code that is OpenGL-only

Note that there is still internal code that needs trimming; since the OpenGLCompute backend uses some of the same code, and some of the same build deps, and some of the same runtime shared-library loading, I tried to err on the side of leaving code/buildrules/etc in place for now, with the plan to clean that up in subsequent PRs.

Note also that feature Target::EGL is still present, as I believe it is still useful in conjunction with OpenGLCompute.

Fixes #5475

This removes the OpenGL backend (but *not* the OpenGLCompute backend) from public use:

- Remove Target::OpenGL
- remove DeviceAPI::GLSL
- remove Func::glsl() and Func::shader()
- remove all OpenGL-specific apps and tests
- remove HalideRuntimeOpenGL.h
- remove some internal code that is OpenGL-only

Note that there is still internal code that needs trimming; since the OpenGLCompute backend uses some of the same code, and some of the same build deps, and some of the same runtime shared-library loading, I tried to err on the side of leaving code/buildrules/etc in place for now, with the plan to clean that up in subsequent PRs.

Note also that feature Target::EGL is still present, as I believe it is still useful in conjunction with OpenGLCompute.
@steven-johnson steven-johnson added the release_notes For changes that may warrant a note in README for official releases. label Jan 9, 2021
@steven-johnson steven-johnson added this to the v12.0.0 milestone Jan 9, 2021
(void *)&halide_opengl_run,
(void *)&halide_opengl_wrap_render_target,
(void *)&halide_opengl_wrap_texture,
// (void *)&halide_opengl_context_lost,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why comment and not delete?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...scalpel left in patient, sorry, fixing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, halide_opengl_create_context and halide_opengl_get_proc_address still appear to be needed by OpenGLCompute

@steven-johnson
Copy link
Contributor Author

Only failure is the rogue mul_div_mod failure:

FAILED TEST: mul_div_mod
Testing mul vector_width: 1
Testing mul vector_width: 2
Testing mul vector_width: 4
Testing mul vector_width: 8
Testing mul vector_width: 16
Testing div_mod vector_width: 1
Testing div_mod vector_width: 2
Testing div_mod vector_width: 4
Testing div_mod vector_width: 8
Testing div_mod vector_width: 16
Failure!
0*-2147483648 -> -2147483648 != 0
Compiled a*b != simplified a*b: 0*-2147483648 = -2147483648 != 0
0*2147483647 -> 2147464527 != 0
Compiled a*b != simplified a*b: 0*2147483647 = 2147464527 != 0
65535*156429877 -> 946612400 != -454946357
23964*-1339975209 -> -1705444715 != -1990403580
47774*672691988 -> 1426553552 != -2053241256
52075*-387718748 -> 419095856 != 187456396
53663*975805134 -> -2138888350 != 389633010
19650*418751201 -> 1851754037 != -696239486
0*-2147483648 -> -2147483648 != 0
Compiled a*b != simplified a*b: 0*-2147483648 = -2147483648 != 0
0*2147483647 -> 2147464527 != 0
Compiled a*b != simplified a*b: 0*2147483647 = 2147464527 != 0
65535*156429877 -> 946612400 != -454946357
23964*-1339975209 -> -1705444715 != -1990403580
47774*672691988 -> 1426553552 != -2053241256
52075*-387718748 -> 419095856 != 187456396
53663*975805134 -> -2138888350 != 389633010
19650*418751201 -> 1851754037 != -696239486
make: *** [/home/halidenightly/build_bot/worker/x86-64-linux-testbranch-11-make/halide-source/Makefile:1820: quiet_correctness_mul_div_mod] Error 1
make: *** Waiting for unfinished jobs....

@steven-johnson steven-johnson marked this pull request as ready for review January 12, 2021 00:10
README_cmake.md Outdated
@@ -466,6 +464,8 @@ If the CMake version is lower than 3.18, the deprecated [`FindCUDA`][findcuda]
module will be used instead. It reads the variable `CUDA_TOOLKIT_ROOT_DIR`
instead of `CUDAToolkit_ROOT` above.

TODO: update this section for OpenGLCompute, which needs some (but maybe not all) of this.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you planning to get to this TODO before merging?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I was, but since OpenGLCompute is ~untestable on desktop Linux until we fix the LLVM-exports issues (see #5627), I think it's probably more useful to leave these as TODO (but open an Issue to fix them once OpenGLCompute is testable again)...

if (op->for_type == ForType::GPUBlock ||
op->for_type == ForType::GPUThread) {
in_gpu = true;
}
// TODO: in_shader = true is no longer possible, clean up code accordingly
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the branch that adds texture support for cuda might need this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please point me at branch?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't appear to use in_shader -- it adds a new clause to preserve the device-api

@abadams
Copy link
Member

abadams commented Jan 12, 2021

There are possibly some now unused intrinsics in IR.cpp: glsl_texture_*

@steven-johnson
Copy link
Contributor Author

There are possibly some now unused intrinsics in IR.cpp: glsl_texture_*

Done

@steven-johnson steven-johnson merged commit 27f55dd into master Jan 12, 2021
@steven-johnson steven-johnson deleted the srj/remove-opengl branch January 12, 2021 17:55
steven-johnson added a commit that referenced this pull request Jan 12, 2021
#5626 removed OpenGL support, but didn't remove this no-longer-needed class.
Comment on lines -457 to -461
option(TARGET_OPENGL "Include OpenGL/GLSL target" ON)
if (TARGET_OPENGL)
target_compile_definitions(Halide PRIVATE WITH_OPENGL)
endif ()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh! This breaks openglcompute! That macro is used later to enable OGLC stuff.

Comment on lines 662 to 664
#if !defined(WITH_OPENGL)
bad |= has_feature(Target::OpenGL) || has_feature(Target::OpenGLCompute);
bad |= has_feature(Target::OpenGLCompute);
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is never defined via CMake after this PR.

steven-johnson added a commit that referenced this pull request Jan 12, 2021
Inadvertently removed code for properly enabling/disabling OGLC in #5626, this restores it properly
steven-johnson added a commit that referenced this pull request Jan 13, 2021
Inadvertently removed code for properly enabling/disabling OGLC in #5626, this restores it properly
@alexreinking alexreinking removed the release_notes For changes that may warrant a note in README for official releases. label Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Future of OpenGL/OpenGLCompute needs deciding
5 participants