12#include <spdlog/spdlog.h>
18 Halide::Var x(
"x"), y(
"y"), c(
"c");
21 Halide::Func rgb_input(
"rgb_input");
22 rgb_input(x, y, c) =
m_input(x, y, c);
34 final_rgb_output.output_buffer().dim(0).set_stride(4);
35 final_rgb_output.output_buffer().dim(2).set_stride(1);
38 applyScheduling(final_rgb_output, x, y, c);
41 final_rgb_output.compile_jit(target);
42 m_pipeline = Halide::Pipeline(final_rgb_output);
44 spdlog::info(
"[OperationPipelineExecutorGPU::buildOperationChain]: Pipeline compiled (Direct Chunky Oklab).");
45 }
catch (
const Halide::CompileError& e) {
46 spdlog::critical(
"[OperationPipelineExecutorGPU::buildOperationChain]: {}", e.what());
51void OperationPipelineExecutorGPU::applyScheduling(Halide::Func& pipeline, Halide::Var& x, Halide::Var& y, Halide::Var &c)
const
53 Halide::Var xo, yo, xi, yi;
54 pipeline.gpu_tile(x, y, xo, yo, xi, yi, 16, 16);
55 spdlog::trace(
"[OperationPipelineExecutorGPU::applyScheduling]: Applying GPU scheduling.");
62 if (!gpu_impl || !gpu_impl->isHalideBufferValid() || !gpu_impl->isOriginalHalideBufferValid()) {
63 spdlog::error(
"[OperationPipelineExecutorGPU::execute]: Invalid Halide buffer or GPU implementation.");
static const Halide::Target & getHalideTarget()
Gets the configured Halide Target object.
Abstract interface representing an image used as a working buffer.
Concrete implementation of WorkingImageGPU using Halide for processing.
Halide::ImageParam m_input
The shared Halide Input Parameter.
void buildOperationChain() override
Builds the Halide function graph based on m_operations.
bool execute(ImageProcessing::IWorkingImageHardware &working_image) override
Executes the compiled pipeline on a generic working image.
bool m_chain_built
Flag indicating if the pipeline has been successfully built and compiled.
Halide::Func applyOperations(const Halide::Func &input, const Halide::Var &x, const Halide::Var &y, const Halide::Var &c)
Applies all operations to the input function.
bool executeOnHalideBuffer(Halide::Buffer< float > &input_buffer, Halide::Buffer< float > &output_buffer) override
Executes the compiled pipeline directly on a Halide buffer.
Halide::Pipeline m_pipeline
The compiled Halide pipeline object.
Halide::Func oklabToRgb(const Halide::Func &input, const Halide::Var &x, const Halide::Var &y, const Halide::Var &c)
Converts a Chunky Oklab Halide::Func back to linear RGB.
Halide::Func rgbToOklab(const Halide::Func &input, const Halide::Var &x, const Halide::Var &y, const Halide::Var &c)
Converts RGB Halide::Func to Oklab.
Declaration of OperationPipelineExecutorGPU (Fused Adjustment Pipeline).
Concrete implementation of image working buffer on GPU using Halide for processing.