Skip to content

Add a compositing example app#7646

Merged
abadams merged 20 commits into
mainfrom
abadams/compositing_app
Jun 23, 2023
Merged

Add a compositing example app#7646
abadams merged 20 commits into
mainfrom
abadams/compositing_app

Conversation

@abadams

@abadams abadams commented Jun 21, 2023

Copy link
Copy Markdown
Member

This PR adds a new app that does Porter-Duff compositing with a handful of operators. The purpose of the app is to demonstrate two things:

  • How to write a mini-interpreter in Halide that uses a bytecode input to switch between different operations.
  • Some fixed-point math patterns, though unfortunately for this app float is actually faster on CPUs.

It also makes two changes to the Mullapudi autoscheduler. It silences a warning about some fixed point intrinsics, and it fixes a bug where the autoscheduler was not considering all Exprs associated with a Func, just the RHS, which was making it miss the ops input buffer, which is only ever referenced in an RDom predicate.

@steven-johnson

Copy link
Copy Markdown
Contributor

Lots of legit-looking compile errors

static constexpr int num_blend_modes = 5;

public:
Input<Buffer<uint8_t, 3>[num_layers]> layer_rgba { "layer_rgba" };

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comments describing these arguments might be useful.

@zvookin

zvookin commented Jun 22, 2023

Copy link
Copy Markdown
Member

Might make sense to add one liners to the PR description for the change to RegionCosts and the Mullapudi autoscheduler. (In case someone is looking for info to track down a change in behavior in the future.)

@steven-johnson

steven-johnson commented Jun 22, 2023

Copy link
Copy Markdown
Contributor

C:\build_bot\worker\halide-testbranch-main-llvm17-x86-64-windows-cmake\halide-source\apps\compositing\process.cpp(37): error C2065: 'M_PI': undeclared identifier

EDIT: I took the liberty of pushing a fix

@steven-johnson steven-johnson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM pending green, but I'd kinda prefer that the changes to Halide proper get landed separately from the app, for future maintenance reasons -- and do any of those changes need tests?

Comment thread apps/compositing/process.cpp Outdated
@@ -1,4 +1,5 @@
#include <chrono>
#include <cmath>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@abadams

abadams commented Jun 23, 2023

Copy link
Copy Markdown
Member Author

Failures unrelated. It looks like vulkan is frequently failing to allocate device memory.

@abadams abadams merged commit 0218c9e into main Jun 23, 2023
@steven-johnson

Copy link
Copy Markdown
Contributor

Failures unrelated. It looks like vulkan is frequently failing to allocate device memory.

Tagging @derek-gerstmann

ardier pushed a commit to ardier/Halide-mutation that referenced this pull request Mar 3, 2024
* Initial version of a compositing demo app

* Improve schedule; add GPU version

* Better mux codegen

* Consider all definition exprs in mullapudi autoscheduler

* Add Tuple mux to IROperator

* clang-format, better comments

* Remove pointless blank line

* Add some fixed-point intrinsics to RegionCosts.cpp to suppress warnings

* Add perf numbers

* Hopefully fix cmake build

* clang-format

* clang-format

* Fix muxing FuncRefs

* More comments

* Update process.cpp

* Include cmath to hopefully get M_PI

* Revert inclusion of cmath

---------

Co-authored-by: Steven Johnson <srj@google.com>
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.

3 participants