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
3
votes
1 answer

Unexpected behavior: Empty loop causes improved results in blur function

I've attended a few Halide panels over the years at Siggraph and I finally decided to do some testing to determine if it would be useful to transcode my existing software. So far the results have been impressive. I was writing a Gaussian Blur based…
BHawk
  • 2,382
  • 1
  • 16
  • 24
3
votes
3 answers

Variable Domain Reduction in Halide

Right now I'm trying to write some Halide code that subsamples an image. Basically I want every 2 by 2 square of the image to be reduced to one pixel that contains the maximum. A simple example would be transforming 1 2 3 4 5 6 7 8 9 0 1 2 4 3 5…
Philip Massey
  • 1,401
  • 3
  • 14
  • 24
3
votes
1 answer

Getting started with the Halide programming language?

I'm trying to get started with a domain-specific language (C++ extension) for image processing called Halide. Following the Halide README, here's what I've tried: Downloaded the Ubuntu 12.04 Halide binary, and extracted in a directory called…
solvingPuzzles
  • 8,541
  • 16
  • 69
  • 112
2
votes
1 answer

Inlining a rvar to a var stage in Halide

I’m trying to inline a rvar to a regular var stage. Let’s say I have an input vector of some size, which I would like to multiply each element by 2, as well as sum all of its elements. something like : Input> vector {“vector”,…
2
votes
1 answer

Express time-step loops in Halide

I am trying to implement the following loop nest in Halide for (t = 0; t < TSTEPS; t++) for (i = 1; i < N - 1; i++) A[i] = (A[i-1] + A[i] + A[i + 1])/3; But I couldn't figure out how to express the "t" loop since it doesn't contribute in the…
2
votes
2 answers

HEXAGON Halide Tools 2.3: /usr/bin/ld: cannot find -lc++abi

I did not get response from Qualcomm forum so I decided to post here. When I was trying to run examples of Halide for Hexagon by running make run as written in the document. Then I got the following issue. The -lc++abi is missing. clang++ -std=c++11…
Yaoshen
  • 23
  • 4
2
votes
1 answer

Halide with GPU schedule produce black image

I'm trying to learn Halide and I can't get GPU right, because it generate black images when scheduled for GPU. For CPU it produce good result (when comment out brighter.gpu_tile(x, y, xo, yo, xi, yi, 8, 8);) #include "Halide.h" #include…
CzakCzan
  • 65
  • 7
2
votes
0 answers

Halide: How to explicitly schedule the anonymous reduction function, like sum?

This is the convolution function wrote with Halide: output(x, y, z, n) = sum(Input(x * stride + r.x, y * stride + r.y, r.z, n) * Kernel(r.x, r.y, r.z, z)); The html is like below: I kinda expecting I can schedule sum,…
derek
  • 55
  • 5
2
votes
1 answer

Header file for installed NuGet package not recognized in Visual Studio

I am trying to learn Halide by walking through the tutorials. I'm working in VS 15, and have added the NuGet package for Halide and added it as a reference to my project (as shown in the image). The NuGet tutorials I've watched seem to indicate that…
2
votes
1 answer

Is Halide indexing row major, column major, or a mix?

I would like to check my understanding of how indexing in Halide works. In many tutorials I see halide buffers indexed as [x,y,c], namely [column, row, channel]. The function that triggers JIT is consistent with this: realize(input.width(),…
Andrew Wagner
  • 22,677
  • 21
  • 86
  • 100
2
votes
1 answer

Halide/Hexagon support on Linux

Is Halide's Hexagon targeting supported on 820E Linux platforms? The Github project says: The currently supported combination of targets is to use the HVX target features with an x86 linux host (to use the simulator) or with an ARM android target…
2
votes
1 answer

Replace Opencv Fillpoly functions with Halide Funcs

I'm trying to realize some opencv functions by Halide, one of the difficulty I have met is how to write the cv::fillpoly in Halide. This function, in opencv, fills a polygon according to the given vertex of this polygon. The details in Opencv:…
Francois
  • 21
  • 2
2
votes
1 answer

How to use the auto-scheduler to generate schedules for GPU?

I want to re-examine the experiments about the auto scheduling for GPU in the paper published at SIGGRAPH'16. I compiled the below code using the auto-scheduler branch, but a generated code was scheduled for CPU. How to use the auto-scheduler to…
2
votes
1 answer

Using Halide ahead-of-time (AOT) with Metal on iOS

I'm trying to use Metal as the target for my ahead-of-time (AOT) Halide pipeline for use on iOS. I've successfully created a Halide generator that generates a static binary using Metal. I can link and call this binary in my iOS app. However, when I…
ryguy
  • 48
  • 5
2
votes
1 answer

Bilateral Grid Generator class using Enhanced Generator

I am trying to re-implement the bilateral grid example using the enhanced generator class (e.g. using schedule() and generate(). But I've got an error when trying to compile the code. g++ -std=c++11 -I ../../include/ -I ../../tools/ -I…
aristg
  • 62
  • 6
1
2
3
16 17