Questions tagged [halide]

For question related to the Halide domain-specific language including scheduling, and computations. Halide supports different languages such as C, C++, Matlab/octave and Python. Please consider a language tag as well.

Overview

Halide is an open-source domain-specific language which allows flexibility in iterating over dimensions to apply computations.

There are two basic parts to Halide code. One describes the computations and the second is the schedule. The schedule allows trade-offs between redundant computations, cache locality and parallelism as the computations iterate over the data space.

Halide is principally used for image processing and computational photography, but it can be applied to audio, encryption, machine vision, and physical simulation. In some ways, Halide is an aspect oriented framework; it separates the description of the algorithm from the definition of how that algorithm is to be implemented via a schedule.

Halide is embedded within C++ and uses the LLVM plug-in mechanics to generate code. Two modes are supported:

  1. JIT (just in time) - in this mode, the code is created at run time. The generated code is available to be called. The Halide code consists of templates and classes which may be updated at runtime. This mode is very flexible for iterating over different design choices.
  2. AOT (ahead of time) - this is like a more traditional compilation mode. Two executeables are built. One is a generator which creates an object file with several functions. The object file take parameters (buffers, etc) and produces outputs (buffers, constants). The generates object can be linked to many languages that are ABI compliant, such as even thought the primary language used to code Halide is C++.

It can be helpful to specify which mode you are targeting when asking questions.

Resources/References

The Halide tutorials give a gentle introduction to topics and concepts related to the framework.

More information can be found on the website: http://halide-lang.org

Much of the information here is taken from a CppCon 2020 video by Alex Reinking.

253 questions
0
votes
1 answer

can't include standalone runtime to my project

I generated the standalone runtime that I could use with several compiled AOT functions that don't contain runtime but when I try to include it in linker it doesn't work because the file itself is of File type. I compiled the runtime by using…
Rok
  • 476
  • 1
  • 5
  • 12
0
votes
1 answer

Showing result of template matching

I ran into another problem while making template matching in Halide (original link with resolved issue: output shifted in template matching) Now I'm trying to draw a rectangle at the position with the lowest score (which indicates the best match).…
Rok
  • 476
  • 1
  • 5
  • 12
0
votes
1 answer

Creating fixed dimension Halide pipelines

My file is compiled ahead of time. I calculate small Regions out of an Image. Over these i'd like to normalize with overlap. Therefore i a Func thats calculating the factor with Reduction Domains. Afterwards i try to calculate normalized Regions…
F. Mue
  • 1
  • 1
0
votes
1 answer

How to initialize External Image with Margins for convolution?

Constraints: 1. Have a pointer to an image with margins of size (ImHeight,ImWidth) 2. Filter size (FH,FW) ; FH,FW are odd 3. ActualImageHeight = ImHeight-2*(FH/2); ActualImageWidth = ImWidth-2*(FW/2); How To: Initialize image with the pointer…
0
votes
2 answers

output shifted in template matching

I'm trying to create a template matching program that's using the following formula to determine the fit between the template and the image: my code is following: Halide::Var x, y, xt, yt; Halide::RDom r(0, t.width(), 0, t.height()); Halide::Func…
Rok
  • 476
  • 1
  • 5
  • 12
0
votes
2 answers

Can't run AOT code

I'm currently doing the AOT tutorial and the compilation part works but when I try to build the code (that's in a separate project), that includes the compiled code, it fails to build because of the following error: How do I resolve it? EDIT:…
Rok
  • 476
  • 1
  • 5
  • 12
0
votes
1 answer

Having problems with scheduling

I am trying to lower the execution time of my erosion function and the execution is actually slower when I try to divide the problem with tiling as shown in picture: my code without any scheduling is: Halide::Image
Rok
  • 476
  • 1
  • 5
  • 12
0
votes
1 answer

How to work with multidimensional data in Halide

I started working with Halide. I know it is explicitly an Image Processing framework, but is there a way to handle multidimensional array ( > 3D ) in it without doing any complex steps like Dimensionality Reduction or Separating the mathematical…
0
votes
2 answers

Halide::Expr' is not contextually convertible to 'bool' -- Storing values of functions in variables

I am new to using Halide and I am playing around with implementing algorithms first. I am trying to write a function which, depending on the value of the 8 pixels around it, either skips to the next pixel or does some processing and then moves on to…
Jorg
  • 3
  • 2
0
votes
1 answer

Accessing Funcs in a Halide pipeline

I have a Halide pipeline on which I would like to try a couple of schedules. I'd like to do this by creating a separate file with the optimizations and then apply these to a given Func at runtime so I can automatically try them out to find the…
0
votes
1 answer

Halide check if split is possible

I am writing a Halide program which takes different image sizes. When I optimize I split a loop in a number of "sub loops" so I can parallelize this with a given factor. For small images however, this can be a problem if the image is smaller than…
0
votes
1 answer

Programming a dynamic box blur

I tried making function that generates the expression for the box blur whose matrix's size can be either 3,5 or 7 and while the program does call the function it always returns a static number which I put as a definition of the Expr object. So…
Rok
  • 476
  • 1
  • 5
  • 12
0
votes
2 answers

How to use Halide profiler

I have been exploring the possibilities of Halide for a couple of weeks, and to better understand what Halide is doing I would like to try and use the halide profiler. Lets say I have a Func test. (For ease of reading I left out the variable…
0
votes
1 answer

Halide Expression: _pFirstBlock == pHead crash on simple program

I tried to create simple program using Halide. Used first tutorial copy paste few lines of code. Then got some problem at e = x + y; line; #include "stdafx.h" #include "Halide.h" int main() { Halide::Func gradient; Halide::Var x, y; …
0
votes
2 answers

Using halide with HDR images represented as float array

that's my first post here so sorry if I do something wrong:). I will try to do my best. I currently working on my HDR image processing program, and I wonna implement some basing TMO using Halide. Problem is all my images are represented as float…
1 2 3
16
17